public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/N] [x86_64] Vectorized math functions
@ 2014-11-20 17:40 Andrew Senkevich
  2014-11-21 17:55 ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-11-20 17:40 UTC (permalink / raw)
  To: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 4956 bytes --]

Hi,

this is addition of several macros: for condition in tests for vector
functions, for forming name of tested function, for runtime
architecture check.

ChangeLog

2014-11-20  Andrew Senkevich  <andrew.n.senkevich@gmail.com>

        * math/libm-test.inc (TEST_MATHVEC, VEC_PREFIX, INIT_ARCH_EXT,
        CHECK_ARCH_EXT, STR_CONCAT, STR_CON3): New macros. START refactored.
        * sysdeps/x86_64/fpu/math-tests.h: New file.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index df11343..94931e2 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -678,13 +678,17 @@ test_exceptions (const char *test_name, int exception)
   feclearexcept (FE_ALL_EXCEPT);
 }

+#ifndef TEST_MATHVEC
+# define TEST_MATHVEC 0
+#endif
+
 /* Test whether errno for TEST_NAME, set to ERRNO_VALUE, has value
    EXPECTED_VALUE (description EXPECTED_NAME).  */
 static void
 test_single_errno (const char *test_name, int errno_value,
    int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,13 +1694,27 @@ struct test_fFF_11_data
        (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected); \
   ROUND_RESTORE_ ## ROUNDING_MODE

+#ifndef INIT_ARCH_EXT
+# define INIT_ARCH_EXT
+# define CHECK_ARCH_EXT
+#endif
+
+#ifndef VEC_PREFIX
+# define VEC_PREFIX
+#endif
+
 #ifndef FUNC_TEST
 # define FUNC_TEST FUNC
 #endif

+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT) \
-  const char *this_func = #FUNC; \
+#define START(FUNC, SUFF, EXACT) \
+  CHECK_ARCH_EXT \
+  if (TEST_MATHVEC) return; \
+  const char *this_func = STR_CON3 (VEC_PREFIX, FUNC, SUFF); \
   init_max_error (this_func, EXACT)
 #define END \
   print_max_error (this_func)
@@ -1709,28 +1727,28 @@ struct test_fFF_11_data
     { \
       do \
  { \
-  START (FUNC, EXACT); \
+  START (FUNC,, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _downward, EXACT); \
+  START (FUNC, _downward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _towardzero, EXACT); \
+  START (FUNC, _towardzero, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _upward, EXACT); \
+  START (FUNC, _upward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
@@ -6038,7 +6056,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7552,7 +7570,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9378,7 +9396,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9828,6 +9846,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);

+  INIT_ARCH_EXT
+
   check_ulp ();

   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/sysdeps/x86_64/fpu/math-tests.h b/sysdeps/x86_64/fpu/math-tests.h
new file mode 100644
index 0000000..466b97b
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests.h
@@ -0,0 +1,34 @@
+/* Configuration for math tests.  x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  static int avx2_usable; /* Set to 1 if AVX2 supported */
+
+# 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;
+
+#endif
+
+#include_next <math-tests.h>


Attached the same.


--
WBR,
Andrew

[-- Attachment #2: libmvec_2_of_N.patch --]
[-- Type: application/octet-stream, Size: 4714 bytes --]

diff --git a/math/libm-test.inc b/math/libm-test.inc
index df11343..94931e2 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -678,13 +678,17 @@ test_exceptions (const char *test_name, int exception)
   feclearexcept (FE_ALL_EXCEPT);
 }
 
+#ifndef TEST_MATHVEC
+# define TEST_MATHVEC 0
+#endif
+
 /* Test whether errno for TEST_NAME, set to ERRNO_VALUE, has value
    EXPECTED_VALUE (description EXPECTED_NAME).  */
 static void
 test_single_errno (const char *test_name, int errno_value,
 		   int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,13 +1694,27 @@ struct test_fFF_11_data
 		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 
+#ifndef INIT_ARCH_EXT
+# define INIT_ARCH_EXT
+# define CHECK_ARCH_EXT
+#endif
+
+#ifndef VEC_PREFIX 
+# define VEC_PREFIX
+#endif
+
 #ifndef FUNC_TEST
 # define FUNC_TEST FUNC
 #endif
 
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT)			\
-  const char *this_func = #FUNC;		\
+#define START(FUNC, SUFF, EXACT)				\
+  CHECK_ARCH_EXT						\
+  if (TEST_MATHVEC) return;					\
+  const char *this_func = STR_CON3 (VEC_PREFIX, FUNC, SUFF);	\
   init_max_error (this_func, EXACT)
 #define END					\
   print_max_error (this_func)
@@ -1709,28 +1727,28 @@ struct test_fFF_11_data
     {									\
       do								\
 	{								\
-	  START (FUNC, EXACT);						\
+	  START (FUNC,, EXACT);						\
 	  LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__);			\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _downward, EXACT);				\
+	  START (FUNC, _downward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _towardzero, EXACT);				\
+	  START (FUNC, _towardzero, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _upward, EXACT);				\
+	  START (FUNC, _upward, EXACT);					\
 	  LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__);		\
 	  END_MACRO;							\
 	}								\
@@ -6038,7 +6056,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7552,7 +7570,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9378,7 +9396,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9828,6 +9846,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);
 
+  INIT_ARCH_EXT
+
   check_ulp ();
 
   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/sysdeps/x86_64/fpu/math-tests.h b/sysdeps/x86_64/fpu/math-tests.h
new file mode 100644
index 0000000..466b97b
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests.h
@@ -0,0 +1,34 @@
+/* Configuration for math tests.  x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  static int avx2_usable;	/* Set to 1 if AVX2 supported */
+
+# 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;
+
+#endif
+
+#include_next <math-tests.h>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-20 17:40 [PATCH 2/N] [x86_64] Vectorized math functions Andrew Senkevich
@ 2014-11-21 17:55 ` Joseph Myers
  2014-11-24 18:05   ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-11-21 17:55 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-21 17:55 ` Joseph Myers
@ 2014-11-24 18:05   ` Andrew Senkevich
  2014-11-26 13:12     ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-11-24 18:05 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 8840 bytes --]

2014-11-21 20:55 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> 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.

Fixed.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..4958385 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>

 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
    int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
        (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected); \
   ROUND_RESTORE_ ## ROUNDING_MODE

+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT) \
-  const char *this_func = #FUNC; \
+#define START(FUNC, SUFF, EXACT) \
+  CHECK_ARCH_EXT \
+  if (TEST_MATHVEC) return; \
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF); \
   init_max_error (this_func, EXACT)
 #define END \
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     { \
       do \
  { \
-  START (FUNC, EXACT); \
+  START (FUNC,, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _downward, EXACT); \
+  START (FUNC, _downward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _towardzero, EXACT); \
+  START (FUNC, _towardzero, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _upward, EXACT); \
+  START (FUNC, _upward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h
b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..c005fad
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,21 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Macros used for architecture check in math tests runtime. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT
diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h
b/sysdeps/x86_64/fpu/math-tests-arch.h
new file mode 100644
index 0000000..dfd8221
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests-arch.h
@@ -0,0 +1,43 @@
+/* Runtime architecture check for math tests. x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  /* Set to 1 if AVX2 supported. */
+  static int avx2_usable;
+
+# define INIT_ARCH_EXT \
+  do \
+    { \
+      __init_cpu_features (); \
+      avx2_usable = __cpu_features.feature[index_AVX2_Usable] \
+    & bit_AVX2_Usable; \
+    } \
+  while(0);
+
+# define CHECK_ARCH_EXT \
+  do \
+    { \
+      if (!avx2_usable) return; \
+    } \
+  while(0);
+
+#else
+# include <sysdeps/generic/math-tests-arch.h>
+#endif


--
WBR,
Andrew

[-- Attachment #2: libmvec_2_of_N_v2.patch --]
[-- Type: application/octet-stream, Size: 7501 bytes --]

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..4958385 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>
 
 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
 		   int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
 		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 
+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT)			\
-  const char *this_func = #FUNC;		\
+#define START(FUNC, SUFF, EXACT)				\
+  CHECK_ARCH_EXT						\
+  if (TEST_MATHVEC) return;					\
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF);	\
   init_max_error (this_func, EXACT)
 #define END					\
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     {									\
       do								\
 	{								\
-	  START (FUNC, EXACT);						\
+	  START (FUNC,, EXACT);						\
 	  LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__);			\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _downward, EXACT);				\
+	  START (FUNC, _downward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _towardzero, EXACT);				\
+	  START (FUNC, _towardzero, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _upward, EXACT);				\
+	  START (FUNC, _upward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__);		\
 	  END_MACRO;							\
 	}								\
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..c005fad
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,21 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Macros used for architecture check in math tests runtime. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT
diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h b/sysdeps/x86_64/fpu/math-tests-arch.h
new file mode 100644
index 0000000..dfd8221
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests-arch.h
@@ -0,0 +1,43 @@
+/* Runtime architecture check for math tests. x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  /* Set to 1 if AVX2 supported. */
+  static int avx2_usable;
+
+# define INIT_ARCH_EXT 						\
+  do								\
+    {								\
+      __init_cpu_features ();					\
+      avx2_usable = __cpu_features.feature[index_AVX2_Usable]	\
+		    & bit_AVX2_Usable;				\
+    }								\
+  while(0);
+ 
+# define CHECK_ARCH_EXT						\
+  do								\
+    {								\
+      if (!avx2_usable) return;					\
+    }								\
+  while(0);
+
+#else 
+# include <sysdeps/generic/math-tests-arch.h>
+#endif

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-24 18:05   ` Andrew Senkevich
@ 2014-11-26 13:12     ` Joseph Myers
  2014-11-26 16:03       ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-11-26 13:12 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

On Mon, 24 Nov 2014, Andrew Senkevich wrote:

> +#define START(FUNC, SUFF, EXACT) \
> +  CHECK_ARCH_EXT \
> +  if (TEST_MATHVEC) return; \

With a proper definition of CHECK_ARCH_EXT (one that always acts like a 
statement without the trailing ';'), the call should be followed by ';'.

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

And the definitions here should not have the trailing semicolon, because 
that will be provided by the caller.  Also note there should be a space 
between "while" and "(0)".

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-26 13:12     ` Joseph Myers
@ 2014-11-26 16:03       ` Andrew Senkevich
  2014-11-26 16:26         ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-11-26 16:03 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 9129 bytes --]

2014-11-26 16:12 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Mon, 24 Nov 2014, Andrew Senkevich wrote:
>
>> +#define START(FUNC, SUFF, EXACT) \
>> +  CHECK_ARCH_EXT \
>> +  if (TEST_MATHVEC) return; \
>
> With a proper definition of CHECK_ARCH_EXT (one that always acts like a
> statement without the trailing ';'), the call should be followed by ';'.
>
>> +# define INIT_ARCH_EXT \
>> +  do \
>> +    { \
>> +      __init_cpu_features (); \
>> +      avx2_usable = __cpu_features.feature[index_AVX2_Usable] \
>> +    & bit_AVX2_Usable; \
>> +    } \
>> +  while(0);
>> +
>> +# define CHECK_ARCH_EXT \
>> +  do \
>> +    { \
>> +      if (!avx2_usable) return; \
>> +    } \
>> +  while(0);
>
> And the definitions here should not have the trailing semicolon, because
> that will be provided by the caller.  Also note there should be a space
> between "while" and "(0)".

Fixed, and also added call of INIT_ARCH_EXT in libm-test.c (will be
removed from patch 6).

ChangeLog

2014-11-26  Andrew Senkevich  <andrew.n.senkevich@gmail.com>

        * sysdeps/generic/math-tests-arch.h (INIT_ARCH_EXT, CHECK_ARCH_EXT):
        New empty defined macros.
        * sysdeps/x86_64/fpu/math-tests-arch.h (INIT_ARCH_EXT,CHECK_ARCH_EXT):
        Platform-specific definitions.
        * math/libm-test.inc (TEST_MATHVEC, VEC_SUFF, INIT_ARCH_EXT,
        STR_CONCAT, STR_CON3): New macros. START refactored.
        * math/test-double.c: Added TEST_MATHVEC definition.
        * math/test-float.c: Likewise.
        * math/test-idouble.c: Likewise.
        * math/test-ifloat.c: Likewise.
        * math/test-ildoubl.c: Likewise.
        * math/test-ldouble.c: Likewise.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..bcedc1e 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>

 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
    int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
        (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected); \
   ROUND_RESTORE_ ## ROUNDING_MODE

+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT) \
-  const char *this_func = #FUNC; \
+#define START(FUNC, SUFF, EXACT) \
+  CHECK_ARCH_EXT; \
+  if (TEST_MATHVEC) return; \
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF); \
   init_max_error (this_func, EXACT)
 #define END \
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     { \
       do \
  { \
-  START (FUNC, EXACT); \
+  START (FUNC,, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _downward, EXACT); \
+  START (FUNC, _downward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _towardzero, EXACT); \
+  START (FUNC, _towardzero, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _upward, EXACT); \
+  START (FUNC, _upward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9824,6 +9834,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);

+  INIT_ARCH_EXT;
+
   check_ulp ();

   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h
b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..c005fad
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,21 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Macros used for architecture check in math tests runtime. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT
diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h
b/sysdeps/x86_64/fpu/math-tests-arch.h
new file mode 100644
index 0000000..4c2f372
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests-arch.h
@@ -0,0 +1,43 @@
+/* Runtime architecture check for math tests. x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  /* Set to 1 if AVX2 supported. */
+  static int avx2_usable;
+
+# define INIT_ARCH_EXT \
+  do \
+    { \
+      __init_cpu_features (); \
+      avx2_usable = __cpu_features.feature[index_AVX2_Usable] \
+    & bit_AVX2_Usable; \
+    } \
+  while (0)
+
+# define CHECK_ARCH_EXT \
+  do \
+    { \
+      if (!avx2_usable) return; \
+    } \
+  while (0)
+
+#else
+# include <sysdeps/generic/math-tests-arch.h>
+#endif

Is it OK for commit?


--
WBR,
Andrew

[-- Attachment #2: libmvec_2_of_N_v3.patch --]
[-- Type: application/octet-stream, Size: 7701 bytes --]

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..bcedc1e 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>
 
 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
 		   int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
 		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 
+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT)			\
-  const char *this_func = #FUNC;		\
+#define START(FUNC, SUFF, EXACT)				\
+  CHECK_ARCH_EXT;						\
+  if (TEST_MATHVEC) return;					\
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF);	\
   init_max_error (this_func, EXACT)
 #define END					\
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     {									\
       do								\
 	{								\
-	  START (FUNC, EXACT);						\
+	  START (FUNC,, EXACT);						\
 	  LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__);			\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _downward, EXACT);				\
+	  START (FUNC, _downward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _towardzero, EXACT);				\
+	  START (FUNC, _towardzero, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _upward, EXACT);				\
+	  START (FUNC, _upward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__);		\
 	  END_MACRO;							\
 	}								\
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9824,6 +9834,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);
 
+  INIT_ARCH_EXT;
+
   check_ulp ();
 
   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..c005fad
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,21 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Macros used for architecture check in math tests runtime. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT
diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h b/sysdeps/x86_64/fpu/math-tests-arch.h
new file mode 100644
index 0000000..4c2f372
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math-tests-arch.h
@@ -0,0 +1,43 @@
+/* Runtime architecture check for math tests. x86_64 version.
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef REQUIRE_AVX2
+# include <init-arch.h>
+
+  /* Set to 1 if AVX2 supported. */
+  static int avx2_usable;
+
+# define INIT_ARCH_EXT 						\
+  do								\
+    {								\
+      __init_cpu_features ();					\
+      avx2_usable = __cpu_features.feature[index_AVX2_Usable]	\
+		    & bit_AVX2_Usable;				\
+    }								\
+  while (0)
+ 
+# define CHECK_ARCH_EXT						\
+  do								\
+    {								\
+      if (!avx2_usable) return;					\
+    }								\
+  while (0)
+
+#else 
+# include <sysdeps/generic/math-tests-arch.h>
+#endif

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-26 16:03       ` Andrew Senkevich
@ 2014-11-26 16:26         ` Joseph Myers
  2014-12-02 16:09           ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-11-26 16:26 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

On Wed, 26 Nov 2014, Andrew Senkevich wrote:

> +/* Macros used for architecture check in math tests runtime. */
> +#define INIT_ARCH_EXT
> +#define CHECK_ARCH_EXT

I think the comments in the generic file need to say more about the 
semantics of these macros (in particular, that CHECK_ARCH_EXT should 
return if it determines, possibly using data set up by INIT_ARCH_EXT, that 
the test is running on hardware not supported by the function 
implementations to be tested).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-11-26 16:26         ` Joseph Myers
@ 2014-12-02 16:09           ` Andrew Senkevich
  2014-12-02 22:41             ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-12-02 16:09 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 7170 bytes --]

2014-11-26 19:26 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Wed, 26 Nov 2014, Andrew Senkevich wrote:
>
>> +/* Macros used for architecture check in math tests runtime. */
>> +#define INIT_ARCH_EXT
>> +#define CHECK_ARCH_EXT
>
> I think the comments in the generic file need to say more about the
> semantics of these macros (in particular, that CHECK_ARCH_EXT should
> return if it determines, possibly using data set up by INIT_ARCH_EXT, that
> the test is running on hardware not supported by the function
> implementations to be tested).

Comments added.

ChangeLog

        * math/libm-test.inc: START refactored.
        * math/test-double.c (TEST_MATHVEC): Add define.
        * math/test-float.c: Likewise.
        * math/test-idouble.c: Likewise.
        * math/test-ifloat.c: Likewise.
        * math/test-ildoubl.c: Likewise.
        * math/test-ldouble.c: Likewise.
        * sysdeps/generic/math-tests-arch.h (INIT_ARCH_EXT, CHECK_ARCH_EXT):
        New helper macros for runtime architecture check.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..bcedc1e 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>

 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
    int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
        (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected); \
   ROUND_RESTORE_ ## ROUNDING_MODE

+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT) \
-  const char *this_func = #FUNC; \
+#define START(FUNC, SUFF, EXACT) \
+  CHECK_ARCH_EXT; \
+  if (TEST_MATHVEC) return; \
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF); \
   init_max_error (this_func, EXACT)
 #define END \
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     { \
       do \
  { \
-  START (FUNC, EXACT); \
+  START (FUNC,, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _downward, EXACT); \
+  START (FUNC, _downward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _towardzero, EXACT); \
+  START (FUNC, _towardzero, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__); \
   END_MACRO; \
  } \
       while (0); \
       do \
  { \
-  START (FUNC ## _upward, EXACT); \
+  START (FUNC, _upward, EXACT); \
   LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__); \
   END_MACRO; \
  } \
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9824,6 +9834,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);

+  INIT_ARCH_EXT;
+
   check_ulp ();

   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1

 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0

 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h
b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..770ee27
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,24 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* These macros used for architecture check in math tests runtime.
+   INIT_ARCH_EXT should set up for example some global variable which is
+   checked by CHECK_ARCH_EXT which produces return from individual test to
+   prevent run on hardware not supported by tested function implementation. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT

Is it OK for trunk?


--
WBR,
Andrew

[-- Attachment #2: libmvec_2_of_N_v4.patch --]
[-- Type: application/octet-stream, Size: 6320 bytes --]

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5d2ed1a..bcedc1e 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -126,6 +126,7 @@
 #include <argp.h>
 #include <tininess.h>
 #include <math-tests.h>
+#include <math-tests-arch.h>
 
 /* Structure for ulp data for a function, or the real or imaginary
    part of a function.  */
@@ -684,7 +685,7 @@ static void
 test_single_errno (const char *test_name, int errno_value,
 		   int expected_value, const char *expected_name)
 {
-#ifndef TEST_INLINE
+#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -1690,9 +1691,18 @@ struct test_fFF_11_data
 		       (ARRAY)[i].RM_##ROUNDING_MODE.extra2_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
 
+#if !TEST_MATHVEC
+# define VEC_SUFF
+#endif
+
+#define STR_CONCAT(a, b, c) __STRING (a##b##c)
+#define STR_CON3(a, b, c) STR_CONCAT (a, b, c)
+
 /* Start and end the tests for a given function.  */
-#define START(FUNC, EXACT)			\
-  const char *this_func = #FUNC;		\
+#define START(FUNC, SUFF, EXACT)				\
+  CHECK_ARCH_EXT;						\
+  if (TEST_MATHVEC) return;					\
+  const char *this_func = STR_CON3 (FUNC, SUFF, VEC_SUFF);	\
   init_max_error (this_func, EXACT)
 #define END					\
   print_max_error (this_func)
@@ -1705,28 +1715,28 @@ struct test_fFF_11_data
     {									\
       do								\
 	{								\
-	  START (FUNC, EXACT);						\
+	  START (FUNC,, EXACT);						\
 	  LOOP_MACRO (FUNC, ARRAY, , ## __VA_ARGS__);			\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _downward, EXACT);				\
+	  START (FUNC, _downward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_DOWNWARD, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _towardzero, EXACT);				\
+	  START (FUNC, _towardzero, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_TOWARDZERO, ## __VA_ARGS__);	\
 	  END_MACRO;							\
 	}								\
       while (0);							\
       do								\
 	{								\
-	  START (FUNC ## _upward, EXACT);				\
+	  START (FUNC, _upward, EXACT);				\
 	  LOOP_MACRO (FUNC, ARRAY, FE_UPWARD, ## __VA_ARGS__);		\
 	  END_MACRO;							\
 	}								\
@@ -6034,7 +6044,7 @@ static const struct test_c_c_data cexp_test_data[] =
 static void
 cexp_test (void)
 {
-  START (cexp, 0);
+  START (cexp,, 0);
   RUN_TEST_LOOP_c_c (cexp, cexp_test_data, );
   END_COMPLEX;
 }
@@ -7548,7 +7558,7 @@ static const struct test_if_f_data jn_test_data[] =
 static void
 jn_test (void)
 {
-  START (jn, 0);
+  START (jn,, 0);
   RUN_TEST_LOOP_if_f (jn, jn_test_data, );
   END;
 }
@@ -9374,7 +9384,7 @@ static const struct test_f_f_data tgamma_test_data[] =
 static void
 tgamma_test (void)
 {
-  START (tgamma, 0);
+  START (tgamma,, 0);
   RUN_TEST_LOOP_f_f (tgamma, tgamma_test_data, );
   END;
 }
@@ -9824,6 +9834,8 @@ main (int argc, char **argv)
   initialize ();
   printf (TEST_MSG);
 
+  INIT_ARCH_EXT;
+
   check_ulp ();
 
   /* Keep the tests a wee bit ordered (according to ISO C99).  */
diff --git a/math/test-double.c b/math/test-double.c
index e666197..4aec418 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index cb68a5c..f646f98 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 665f78c..9131055 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 41255e9..61a5684 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define TEST_MATHVEC 0
 #define TEST_INLINE 1
 
 #ifdef __NO_MATH_INLINES
diff --git a/math/test-ildoubl.c b/math/test-ildoubl.c
index 69ad35e..b8f57a7 100644
--- a/math/test-ildoubl.c
+++ b/math/test-ildoubl.c
@@ -27,6 +27,7 @@
 #define PRINTF_NEXPR "Lf"
 #define TEST_INLINE
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 07e4601..4253043 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -26,6 +26,7 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define TEST_MATHVEC 0
 
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
diff --git a/sysdeps/generic/math-tests-arch.h b/sysdeps/generic/math-tests-arch.h
new file mode 100644
index 0000000..770ee27
--- /dev/null
+++ b/sysdeps/generic/math-tests-arch.h
@@ -0,0 +1,24 @@
+/* Runtime architecture check for math tests.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* These macros used for architecture check in math tests runtime.
+   INIT_ARCH_EXT should set up for example some global variable which is
+   checked by CHECK_ARCH_EXT which produces return from individual test to
+   prevent run on hardware not supported by tested function implementation. */
+#define INIT_ARCH_EXT
+#define CHECK_ARCH_EXT

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-02 16:09           ` Andrew Senkevich
@ 2014-12-02 22:41             ` Joseph Myers
  2014-12-29  9:19               ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-12-02 22:41 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

On Tue, 2 Dec 2014, Andrew Senkevich wrote:

> Is it OK for trunk?

OK once the copyright assignment is in.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-02 22:41             ` Joseph Myers
@ 2014-12-29  9:19               ` Andrew Senkevich
  2014-12-30 17:05                 ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-12-29  9:19 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

2014-12-03 1:41 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Tue, 2 Dec 2014, Andrew Senkevich wrote:
>
>> Is it OK for trunk?
>
> OK once the copyright assignment is in.

Hi, Joseph, is it ok for commit with the following ChangeLog?

2014-12-28  Andrew Senkevich  <andrew.senkevich@intel.com>

        * math/libm-test.inc: START refactored.
        * math/test-double.c (TEST_MATHVEC): Add define.
        * math/test-float.c: Likewise.
        * math/test-idouble.c: Likewise.
        * math/test-ifloat.c: Likewise.
        * math/test-ildoubl.c: Likewise.
        * math/test-ldouble.c: Likewise.
        * sysdeps/generic/math-tests-arch.h (INIT_ARCH_EXT, CHECK_ARCH_EXT):
        New helper macros for runtime architecture check.


--
WBR,
Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-29  9:19               ` Andrew Senkevich
@ 2014-12-30 17:05                 ` Joseph Myers
  2014-12-30 17:24                   ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-12-30 17:05 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

On Sun, 28 Dec 2014, Andrew Senkevich wrote:

> 2014-12-03 1:41 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> > On Tue, 2 Dec 2014, Andrew Senkevich wrote:
> >
> >> Is it OK for trunk?
> >
> > OK once the copyright assignment is in.
> 
> Hi, Joseph, is it ok for commit with the following ChangeLog?

I still don't see the assignment in copyright.list.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-30 17:05                 ` Joseph Myers
@ 2014-12-30 17:24                   ` Andrew Senkevich
  2014-12-30 17:34                     ` Joseph Myers
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Senkevich @ 2014-12-30 17:24 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, Melik-Adamyan, Areg

2014-12-30 20:00 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Sun, 28 Dec 2014, Andrew Senkevich wrote:
>
>> 2014-12-03 1:41 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
>> > On Tue, 2 Dec 2014, Andrew Senkevich wrote:
>> >
>> >> Is it OK for trunk?
>> >
>> > OK once the copyright assignment is in.
>>
>> Hi, Joseph, is it ok for commit with the following ChangeLog?
>
> I still don't see the assignment in copyright.list.

Yes, there are no assignment in copyright.list but agreement between
Intel and FSF was achieved about contribution is possible from anyone
having @intel.com email. But may be FSF hasn't signed to formal
documents right now.

What do you think about it?

I have 17 patches (in format suitable for git am) and I am ready to send them.


--
WBR,
Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-30 17:24                   ` Andrew Senkevich
@ 2014-12-30 17:34                     ` Joseph Myers
  2014-12-30 18:30                       ` Andrew Senkevich
  0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2014-12-30 17:34 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha, Melik-Adamyan, Areg

On Tue, 30 Dec 2014, Andrew Senkevich wrote:

> 2014-12-30 20:00 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> > On Sun, 28 Dec 2014, Andrew Senkevich wrote:
> >
> >> 2014-12-03 1:41 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> >> > On Tue, 2 Dec 2014, Andrew Senkevich wrote:
> >> >
> >> >> Is it OK for trunk?
> >> >
> >> > OK once the copyright assignment is in.
> >>
> >> Hi, Joseph, is it ok for commit with the following ChangeLog?
> >
> > I still don't see the assignment in copyright.list.
> 
> Yes, there are no assignment in copyright.list but agreement between
> Intel and FSF was achieved about contribution is possible from anyone
> having @intel.com email. But may be FSF hasn't signed to formal
> documents right now.
> 
> What do you think about it?

As a GNU maintainer of glibc I need to wait for the assignment to appear 
in copyright.list, or for the FSF to notify the GNU maintainers of glibc 
in some other way.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/N] [x86_64] Vectorized math functions
  2014-12-30 17:34                     ` Joseph Myers
@ 2014-12-30 18:30                       ` Andrew Senkevich
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Senkevich @ 2014-12-30 18:30 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, Melik-Adamyan, Areg

2014-12-30 20:24 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
> On Tue, 30 Dec 2014, Andrew Senkevich wrote:
>
>> 2014-12-30 20:00 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
>> > On Sun, 28 Dec 2014, Andrew Senkevich wrote:
>> >
>> >> 2014-12-03 1:41 GMT+03:00 Joseph Myers <joseph@codesourcery.com>:
>> >> > On Tue, 2 Dec 2014, Andrew Senkevich wrote:
>> >> >
>> >> >> Is it OK for trunk?
>> >> >
>> >> > OK once the copyright assignment is in.
>> >>
>> >> Hi, Joseph, is it ok for commit with the following ChangeLog?
>> >
>> > I still don't see the assignment in copyright.list.
>>
>> Yes, there are no assignment in copyright.list but agreement between
>> Intel and FSF was achieved about contribution is possible from anyone
>> having @intel.com email. But may be FSF hasn't signed to formal
>> documents right now.
>>
>> What do you think about it?
>
> As a GNU maintainer of glibc I need to wait for the assignment to appear
> in copyright.list, or for the FSF to notify the GNU maintainers of glibc
> in some other way.

Clear. I hope it will be confirmed before commits closing... Will
check for it after several days...


--
WBR,
Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-12-30 17:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 17:40 [PATCH 2/N] [x86_64] Vectorized math functions Andrew Senkevich
2014-11-21 17:55 ` Joseph Myers
2014-11-24 18:05   ` Andrew Senkevich
2014-11-26 13:12     ` Joseph Myers
2014-11-26 16:03       ` Andrew Senkevich
2014-11-26 16:26         ` Joseph Myers
2014-12-02 16:09           ` Andrew Senkevich
2014-12-02 22:41             ` Joseph Myers
2014-12-29  9:19               ` Andrew Senkevich
2014-12-30 17:05                 ` Joseph Myers
2014-12-30 17:24                   ` Andrew Senkevich
2014-12-30 17:34                     ` Joseph Myers
2014-12-30 18:30                       ` Andrew Senkevich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).