This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 6/N v2] [x86_64] Vectorized math functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]