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 x86-64][BZ #20024] Fixed vector sincos/sincosf ABI


On Sat, 11 Jun 2016, Andrew Senkevich wrote:

> +#define VECTOR_WRAPPER_fFF(scalar_func, vector_func)		\
> +extern void vector_func (VEC_TYPE, VEC_INT_TYPE, VEC_INT_TYPE);	\
> +void scalar_func (FLOAT x, FLOAT * r, FLOAT * r1)		\
> +{							\
> +  int i;						\
> +  VEC_TYPE mx;						\
> +  VEC_INT_TYPE mr, mr1;					\
> +  INIT_VEC_LOOP (mx, x, VEC_LEN);			\
> +  INIT_VEC_LOOP (((FLOAT **) &mr), r, VEC_LEN);		\
> +  INIT_VEC_LOOP (((FLOAT **) &mr1), r1, VEC_LEN);	\
> +  vector_func (mx, mr, mr1);				\
> +  char *mr_ptr = (char *) &mr;				\
> +  char *mr1_ptr = (char *) &mr1;			\
> +  TEST_VEC_LOOP (*((FLOAT **) mr_ptr), VEC_LEN);	\
> +  TEST_VEC_LOOP (*((FLOAT **) mr1_ptr), VEC_LEN);	\
> +  return;						\

You seem to have lots of duplicate copies of this VECTOR_WRAPPER_fFF 
definition.  Please unify them somehow.

Also, I don't see how this definition can work.  It looks to me like: you 
initialize the vectors of pointers with lots of copies of the same pointer 
(as INIT_VEC_LOOP is about putting lots of copies of the same value in a 
vector).  Then you call the vector function.  Then the TEST_VEC_LOOP calls 
have a first argument that is, via some indirection, just r or r1, so they 
would look successively at r[0], r[1] etc. - but only r[0] and r1[0] 
actually exist.  Given this, I don't understand why the implementation you 
have would have passed the tests at all.

What I'd expect is: you define vector result variables locally in the 
macro, like math/test-math-vector.h's copy of VECTOR_WRAPPER_fFF does.  
You initialize the vectors of pointers to point to each successive element 
of the vector result variables - not to have every element pointing to the 
same place.  Then everything after that would be as in the 
math/test-math-vector.h version.

-- 
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]