This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 6/N v2] [x86_64] Vectorized math functions
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 26 Nov 2014 17:56:13 +0000
- Subject: Re: [PATCH 6/N v2] [x86_64] Vectorized math functions
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3t_obiHsvuuO01kgj_cRUubo=LtNeDcwNN-omc02LYFJg at mail dot gmail dot com>
On Mon, 24 Nov 2014, Andrew Senkevich wrote:
> +#define CONCAT(a,b) __CONCAT (a,b)
> +
> +#define WRAPPER_NAME(function) CONCAT (function,VEC_SUFF)
Watch out for spaces after commas. Lots of places in this patch need
them.
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps
> b/sysdeps/x86_64/fpu/libm-test-ulps
> index 36e1b76..0a0906e 100644
> --- a/sysdeps/x86_64/fpu/libm-test-ulps
> +++ b/sysdeps/x86_64/fpu/libm-test-ulps
> @@ -905,6 +905,15 @@ idouble: 1
> ildouble: 2
> ldouble: 2
>
> +Function: "cos_vlen2":
> +double: 1
> +
> +Function: "cos_vlen4_avx":
> +double: 1
> +
> +Function: "cos_vlen4_avx2":
> +double: 1
> +
> Function: "cosh":
> double: 1
> float: 1
> @@ -1961,6 +1970,15 @@ ifloat: 3
> ildouble: 4
> ldouble: 4
>
> +Function: "vlen2_cos":
> +double: 1
> +
> +Function: "vlen4_avx2_cos":
> +double: 1
> +
> +Function: "vlen4_avx_cos":
> +double: 1
> +
> Function: "y0":
> double: 2
> float: 1
You shouldn't have this second part of the change, now suffixes are being
used.
> +// Wrapper from scalar to vector function implemented in SSE4.
> +#define VECTOR_WRAPPER(scalar_func,vector_func) \
> +extern __m128d vector_func ( __m128d);\
> +FLOAT scalar_func (FLOAT x)\
> +{\
> + int i;\
> + __m128d mx = _mm_set1_pd (x);\
> + __m128d mr = vector_func (mx);\
> + for (i=1;i<2;i++)\
> + {\
> + if (((FLOAT*)&mr)[0]!=((FLOAT*)&mr)[i])\
> + {\
> + return ((FLOAT*)&mr)[0]+0.1;\
> + }\
> + }\
> + return ((FLOAT*)&mr)[0];\
> +}
Watch out for formatting. Spaces around binary operators, before '*',
after the ')' of a cast, after ';' in for (). No space after '(' in the
extern declaration.
The loop and return look like something architecture-independent and
vector-length-independent that should be factored out accordingly into
something taking the vector length (= loop length) as an argument.
--
Joseph S. Myers
joseph@codesourcery.com