]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add exception information to math-tests.h and use it in libm-test.inc.
authorJoseph Myers <joseph@codesourcery.com>
Tue, 11 Jun 2013 15:44:31 +0000 (15:44 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 11 Jun 2013 15:44:31 +0000 (15:44 +0000)
ChangeLog
math/libm-test.inc
ports/ChangeLog.arm
ports/sysdeps/arm/math-tests.h
sysdeps/generic/math-tests.h

index 3a451b4efc84b72ccabd048506d50e54dc63c55b..af730b1fa565f8fb0e9e7f1b2052ef1f57f08637 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-06-11  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/generic/math-tests.h (EXCEPTION_TESTS_float): New macro.
+       (EXCEPTION_TESTS_double): Likewise.
+       (EXCEPTION_TESTS_long_double): Likewise.
+       (EXCEPTION_TESTS): Likewise.
+       * math/libm-test.inc (test_exceptions): Only test exceptions if
+       EXCEPTION_TESTS (FLOAT).
+
 2013-06-11  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * benchtests/Makefile (string-bench): Add strcpy_chk and
index ed050cb9edd2630eeee41fff0ffaddba298e909e..088bf5123e5d961ef993be046a479c3e741a4d6e 100644 (file)
@@ -591,33 +591,37 @@ test_single_exception (const char *test_name,
 static void
 test_exceptions (const char *test_name, int exception)
 {
-  ++noExcTests;
+  if (EXCEPTION_TESTS (FLOAT))
+    {
+      ++noExcTests;
 #ifdef FE_DIVBYZERO
-  if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
-    test_single_exception (test_name, exception,
-                          DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
-                          "Divide by zero");
+      if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
+       test_single_exception (test_name, exception,
+                              DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
+                              "Divide by zero");
 #endif
 #ifdef FE_INVALID
-  if ((exception & INVALID_EXCEPTION_OK) == 0)
-    test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
-                        "Invalid operation");
+      if ((exception & INVALID_EXCEPTION_OK) == 0)
+       test_single_exception (test_name, exception,
+                              INVALID_EXCEPTION, FE_INVALID,
+                              "Invalid operation");
 #endif
 #ifdef FE_OVERFLOW
-  if ((exception & OVERFLOW_EXCEPTION_OK) == 0)
-    test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
-                          FE_OVERFLOW, "Overflow");
+      if ((exception & OVERFLOW_EXCEPTION_OK) == 0)
+       test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
+                              FE_OVERFLOW, "Overflow");
 #endif
 #ifdef FE_UNDERFLOW
-  if ((exception & UNDERFLOW_EXCEPTION_OK) == 0)
-    test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
-                          FE_UNDERFLOW, "Underflow");
+      if ((exception & UNDERFLOW_EXCEPTION_OK) == 0)
+       test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
+                              FE_UNDERFLOW, "Underflow");
 #endif
 #ifdef FE_INEXACT
-  if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0)
-    test_single_exception (test_name, exception, INEXACT_EXCEPTION,
-                          FE_INEXACT, "Inexact");
+      if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0)
+       test_single_exception (test_name, exception, INEXACT_EXCEPTION,
+                              FE_INEXACT, "Inexact");
 #endif
+    }
   feclearexcept (FE_ALL_EXCEPT);
 }
 
index 6b0310b01347a4530dbb1a9ef60c5eb153b83c64..28ebfdf5ba5ab3a0e5459c0e721c59be3dd44908 100644 (file)
@@ -1,3 +1,10 @@
+2013-06-11  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/arm/math-tests.h [__SOFTFP__] (EXCEPTION_TESTS_float):
+       Define to 0.
+       [__SOFTFP__] (EXCEPTION_TESTS_double): Likewise.
+       [__SOFTFP__] (EXCEPTION_TESTS_long_double): Likewise.
+
 2013-06-10  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/arm/math-tests.h: New file.
index 6b8e089d59674f2065d411e8112683ebcd60329b..6fd17edca25317dc97b3b88e9795539a0c04ce68 100644 (file)
 
 /* On systems with VFP support, but where glibc is built for
    soft-float, the libgcc functions used in libc and libm do not
-   support rounding modes, although fesetround succeeds.  */
+   support rounding modes, although fesetround succeeds, and do not
+   support exceptions.  */
 #ifdef __SOFTFP__
 # define ROUNDING_TESTS_float(MODE)    ((MODE) == FE_TONEAREST)
 # define ROUNDING_TESTS_double(MODE)   ((MODE) == FE_TONEAREST)
 # define ROUNDING_TESTS_long_double(MODE)      ((MODE) == FE_TONEAREST)
+# define EXCEPTION_TESTS_float 0
+# define EXCEPTION_TESTS_double        0
+# define EXCEPTION_TESTS_long_double   0
 #endif
 
 #include_next <math-tests.h>
index b1e9fd72a7088d9d9b15babe3a3dc86f065a88e3..89b2260d0f279332411db0d30ae46cc1c0a38b5d 100644 (file)
   (sizeof (TYPE) == sizeof (float) ? ROUNDING_TESTS_float (MODE)       \
    : sizeof (TYPE) == sizeof (double) ? ROUNDING_TESTS_double (MODE)   \
    : ROUNDING_TESTS_long_double (MODE))
+
+/* Indicate whether to run tests of floating-point exceptions for a
+   given floating-point type, given that the exception macros are
+   defined.  All are run unless overridden.  */
+#ifndef EXCEPTION_TESTS_float
+# define EXCEPTION_TESTS_float 1
+#endif
+#ifndef EXCEPTION_TESTS_double
+# define EXCEPTION_TESTS_double        1
+#endif
+#ifndef EXCEPTION_TESTS_long_double
+# define EXCEPTION_TESTS_long_double   1
+#endif
+
+#define EXCEPTION_TESTS(TYPE)                                  \
+  (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float     \
+   : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \
+   : EXCEPTION_TESTS_long_double)