about summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
authorAndrew Senkevich <andrew.n.senkevich@gmail.com>2015-05-14 17:11:50 +0300
committerAndrew Senkevich <andrew.n.senkevich@gmail.com>2015-05-14 18:07:06 +0300
commita6cdcd75dca8d57aaf1d7f8952bac374da7adc91 (patch)
tree5a0dfd8afec3a274d559b54a10c16b2dfd646bc3 /math
parentee9716019d04ad3f3024670a48cddf4e807ced34 (diff)
downloadglibc-a6cdcd75dca8d57aaf1d7f8952bac374da7adc91.tar.gz
glibc-a6cdcd75dca8d57aaf1d7f8952bac374da7adc91.tar.xz
glibc-a6cdcd75dca8d57aaf1d7f8952bac374da7adc91.zip
Refactoring of START for conditions in individual tests
and addition of macros used for runtime architecture check.

2015-05-14  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.
Diffstat (limited to 'math')
-rw-r--r--math/libm-test.inc32
-rw-r--r--math/test-double.c1
-rw-r--r--math/test-float.c1
-rw-r--r--math/test-idouble.c1
-rw-r--r--math/test-ifloat.c1
-rw-r--r--math/test-ildoubl.c1
-rw-r--r--math/test-ldouble.c1
7 files changed, 28 insertions, 10 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 127260b4bf..82f1b759be 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.  */
@@ -685,7 +686,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))
@@ -1691,9 +1692,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)
@@ -1706,28 +1716,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;							\
 	}								\
@@ -6025,7 +6035,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;
 }
@@ -7544,7 +7554,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;
 }
@@ -9517,7 +9527,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;
 }
@@ -9967,6 +9977,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 cbb81f980c..6c1c11c923 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 c54dd3ccd5..07dc8eacd6 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 b23bd216e8..bb73f9c7c2 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 57a7a7716f..74e8e4b1b8 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 c38a109a58..f90a9baff0 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 20bf0a16cf..97effb69e1 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