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 2/N] [x86_64] Vectorized math functions


On Thu, 20 Nov 2014, Andrew Senkevich wrote:

> +#ifndef TEST_MATHVEC
> +# define TEST_MATHVEC 0
> +#endif

Making this value explicit in each relevant test would better accord with 
current glibc practice.

> +#ifndef INIT_ARCH_EXT
> +# define INIT_ARCH_EXT
> +# define CHECK_ARCH_EXT
> +#endif

Again it's worth considering how to avoid this pattern.  Maybe a separate 
math-tests-arch.h header, with the sysdeps/generic version having a 
comment explaining the semantics of the macros and defining them to empty 
(and the x86_64 version including the generic one when not doing vector 
tests)?

> +#ifndef VEC_PREFIX
> +# define VEC_PREFIX
> +#endif

So far we have two ways of distinguishing (in libm-test-ulps) tests for 
variants of functions: suffixes (for rounding modes) and type names such 
as "double" and "ildoubl" (for the type and for whether the inline 
variants are being tested).  I don't think adding a third way is a good 
idea.  I suggest using suffixes (until we can unify things and get down to 
a single way).

> +# define INIT_ARCH_EXT \
> +    __init_cpu_features (); \
> +    avx2_usable = __cpu_features.feature[index_AVX2_Usable] \
> + & bit_AVX2_Usable;
> +
> +# define CHECK_ARCH_EXT \
> +  if (!avx2_usable) return;

Any macro expanding to statements should expand to a

  do
    {
      ...;
    }
  while (0)

block unless what it does (e.g. declaring variables to be used outside its 
own expansion) is unsuitable for such a block.

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