]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Sanitize fails for SP FPU on Arm
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 23 Sep 2022 17:08:30 +0000 (19:08 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 20 Oct 2022 19:02:10 +0000 (21:02 +0200)
This patch stops reporting fails for Arm targets with single
precision floating point unit for types wider than 32 bits (the width
of float on arm-none-eabi).

As reported in PR102017, fenv is reported as supported in recent
versions of newlib. At the same time, for some Arm targets, the
implementation in libgcc does not support exceptions and thus, the
test fails with a call to abort().

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_fenv_exceptions_double): New.
(check_effective_target_fenv_exceptions_long_double): New.
* gcc.dg/c2x-float-7.c: Split into 3 tests...
* gcc.dg/c2x-float-7a.c: Float part of c2x-float-7.c.
* gcc.dg/c2x-float-7b.c: Double part of c2x-float-7.c.
* gcc.dg/c2x-float-7c.c: Long double part of c2x-float-7.c.
* gcc.dg/pr95115.c: Switch to fenv_exceptions_double.
* gcc.dg/torture/float32x-nan-floath.c: Likewise.
* gcc.dg/torture/float32x-nan.c: Likewise.
* gcc.dg/torture/float64-nan-floath.c: Likewise.
* gcc.dg/torture/float64-nan.c: Likewise.
* gcc.dg/torture/inf-compare-1.c: Likewise.
* gcc.dg/torture/inf-compare-2.c: Likewise.
* gcc.dg/torture/inf-compare-3.c: Likewise.
* gcc.dg/torture/inf-compare-4.c: Likewise.
* gcc.dg/torture/inf-compare-5.c: Likewise.
* gcc.dg/torture/inf-compare-6.c: Likewise.
* gcc.dg/torture/inf-compare-7.c: Likewise.
* gcc.dg/torture/inf-compare-8.c: Likewise.
* gcc.dg/torture/pr52451.c: Likewise.
* gcc.dg/torture/pr82692.c: Likewise.
* gcc.dg/torture/inf-compare-1-float.c: New test.
* gcc.dg/torture/inf-compare-2-float.c: New test.
* gcc.dg/torture/inf-compare-3-float.c: New test.
* gcc.dg/torture/inf-compare-4-float.c: New test.
* gcc.dg/torture/inf-compare-5-float.c: New test.
* gcc.dg/torture/inf-compare-6-float.c: New test.
* gcc.dg/torture/inf-compare-7-float.c: New test.
* gcc.dg/torture/inf-compare-8-float.c: New test.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
28 files changed:
gcc/testsuite/gcc.dg/c2x-float-7.c [deleted file]
gcc/testsuite/gcc.dg/c2x-float-7a.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-float-7b.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-float-7c.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr95115.c
gcc/testsuite/gcc.dg/torture/float32x-nan-floath.c
gcc/testsuite/gcc.dg/torture/float32x-nan.c
gcc/testsuite/gcc.dg/torture/float64-nan-floath.c
gcc/testsuite/gcc.dg/torture/float64-nan.c
gcc/testsuite/gcc.dg/torture/inf-compare-1-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-1.c
gcc/testsuite/gcc.dg/torture/inf-compare-2-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-2.c
gcc/testsuite/gcc.dg/torture/inf-compare-3-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-3.c
gcc/testsuite/gcc.dg/torture/inf-compare-4-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-4.c
gcc/testsuite/gcc.dg/torture/inf-compare-5-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-5.c
gcc/testsuite/gcc.dg/torture/inf-compare-6-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-6.c
gcc/testsuite/gcc.dg/torture/inf-compare-7-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-7.c
gcc/testsuite/gcc.dg/torture/inf-compare-8-float.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/inf-compare-8.c
gcc/testsuite/gcc.dg/torture/pr52451.c
gcc/testsuite/gcc.dg/torture/pr82692.c
gcc/testsuite/lib/target-supports.exp

diff --git a/gcc/testsuite/gcc.dg/c2x-float-7.c b/gcc/testsuite/gcc.dg/c2x-float-7.c
deleted file mode 100644 (file)
index 0c90ff2..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Test SNAN macros.  Runtime exceptions test, to verify NaN is
-   signaling.  */
-/* { dg-do run } */
-/* { dg-require-effective-target fenv_exceptions } */
-/* { dg-options "-std=c2x -pedantic-errors -fsignaling-nans" } */
-/* { dg-add-options ieee } */
-
-#include <fenv.h>
-#include <float.h>
-
-/* These should be defined if and only if signaling NaNs are supported
-   for the given types.  If the testsuite gains effective-target
-   support for targets not supporting signaling NaNs, or not
-   supporting them for all types, this test should be made
-   appropriately conditional.  */
-#ifndef FLT_SNAN
-#error "FLT_SNAN undefined"
-#endif
-#ifndef DBL_SNAN
-#error "DBL_SNAN undefined"
-#endif
-#ifndef LDBL_SNAN
-#error "LDBL_SNAN undefined"
-#endif
-
-volatile float f = FLT_SNAN;
-volatile double d = DBL_SNAN;
-volatile long double ld = LDBL_SNAN;
-
-extern void abort (void);
-extern void exit (int);
-
-int
-main (void)
-{
-  feclearexcept (FE_ALL_EXCEPT);
-  f += f;
-  if (!fetestexcept (FE_INVALID))
-    abort ();
-  feclearexcept (FE_ALL_EXCEPT);
-  d += d;
-  if (!fetestexcept (FE_INVALID))
-    abort ();
-  feclearexcept (FE_ALL_EXCEPT);
-  ld += ld;
-  if (!fetestexcept (FE_INVALID))
-    abort ();
-  exit (0);
-}
diff --git a/gcc/testsuite/gcc.dg/c2x-float-7a.c b/gcc/testsuite/gcc.dg/c2x-float-7a.c
new file mode 100644 (file)
index 0000000..129e790
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test SNAN macros.  Runtime exceptions test, to verify NaN is
+   signaling.  */
+/* { dg-do run } */
+/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-options "-std=c2x -pedantic-errors -fsignaling-nans" } */
+/* { dg-add-options ieee } */
+
+#include <fenv.h>
+#include <float.h>
+
+/* This should be defined if and only if signaling NaNs is supported
+   for the given type.  If the testsuite gains effective-target
+   support for targets not supporting signaling NaNs, this test
+   should be made appropriately conditional.  */
+#ifndef FLT_SNAN
+#error "FLT_SNAN undefined"
+#endif
+
+volatile float f = FLT_SNAN;
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+  feclearexcept (FE_ALL_EXCEPT);
+  f += f;
+  if (!fetestexcept (FE_INVALID))
+    abort ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-float-7b.c b/gcc/testsuite/gcc.dg/c2x-float-7b.c
new file mode 100644 (file)
index 0000000..0ae9038
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test SNAN macros.  Runtime exceptions test, to verify NaN is
+   signaling.  */
+/* { dg-do run } */
+/* { dg-require-effective-target fenv_exceptions_double } */
+/* { dg-options "-std=c2x -pedantic-errors -fsignaling-nans" } */
+/* { dg-add-options ieee } */
+
+#include <fenv.h>
+#include <float.h>
+
+/* This should be defined if and only if signaling NaNs is supported
+   for the given type.  If the testsuite gains effective-target
+   support for targets not supporting signaling NaNs, this test
+   should be made appropriately conditional.  */
+#ifndef DBL_SNAN
+#error "DBL_SNAN undefined"
+#endif
+
+volatile double d = DBL_SNAN;
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+  feclearexcept (FE_ALL_EXCEPT);
+  d += d;
+  if (!fetestexcept (FE_INVALID))
+    abort ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-float-7c.c b/gcc/testsuite/gcc.dg/c2x-float-7c.c
new file mode 100644 (file)
index 0000000..038fd55
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test SNAN macros.  Runtime exceptions test, to verify NaN is
+   signaling.  */
+/* { dg-do run } */
+/* { dg-require-effective-target fenv_exceptions_long_double } */
+/* { dg-options "-std=c2x -pedantic-errors -fsignaling-nans" } */
+/* { dg-add-options ieee } */
+
+#include <fenv.h>
+#include <float.h>
+
+/* This should be defined if and only if signaling NaNs is supported
+   for the given type.  If the testsuite gains effective-target
+   support for targets not supporting signaling NaNs, this test
+   should be made appropriately conditional.  */
+#ifndef LDBL_SNAN
+#error "LDBL_SNAN undefined"
+#endif
+
+volatile long double ld = LDBL_SNAN;
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+  feclearexcept (FE_ALL_EXCEPT);
+  ld += ld;
+  if (!fetestexcept (FE_INVALID))
+    abort ();
+  exit (0);
+}
index 46a95dfb6985d31254b6a74e889b53eccf5e6952..69c4f83250ca2213694337265bca5ac2cfa7ab1a 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -ftrapping-math" } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 #include <stdlib.h>
index 0aab4be26cabee1310bcf25fcd6fcef0f15ad879..8d58b41e0697315fac33bb34aaeedd6ffb6952c0 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-add-options float32x } */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target float32x_runtime } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #define WIDTH 32
 #define EXT 1
index d976d3797323cbafee872e5cdf142032051e43db..46f35a4ca80d5115b867a9ce28ad32476b52c7f1 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-add-options float32x } */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target float32x_runtime } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #define WIDTH 32
 #define EXT 1
index 1f5298bd399c95c1b57787b4354aa9399c729e78..444f234737bfb414f37fc01efb293cfea2df7fd8 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-add-options float64 } */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target float64_runtime } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #define WIDTH 64
 #define EXT 0
index 51a6437fd522ff08e46cb64cd21e1a5ecaf7afb0..11b70edea37319da7be090b41f10ef85808f85f6 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-add-options float64 } */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target float64_runtime } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #define WIDTH 64
 #define EXT 0
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-1-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-1-float.c
new file mode 100644 (file)
index 0000000..6409878
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run { xfail { powerpc*-*-* } } } */
+/* remove the xfail for powerpc when pr58684 is fixed */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x > __builtin_inf ();
+  if (i != 0 || !fetestexcept (FE_INVALID))
+    abort ();
+}
index 70f255e680a96c911abd99b03a22516ea2bff4fe..5e0a2d0c601cd93a51fb43850037963292dafd4d 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run { xfail { powerpc*-*-* } } } */
 /* remove the xfail for powerpc when pr58684 is fixed */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
 
 #include <fenv.h>
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-2-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-2-float.c
new file mode 100644 (file)
index 0000000..3cb7df8
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run { xfail { powerpc*-*-* } } } */
+/* remove the xfail for powerpc when pr58684 is fixed */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x < -__builtin_inf ();
+  if (i != 0 || !fetestexcept (FE_INVALID))
+    abort ();
+}
index 011f992d5a04e29892cd9f04359a217cabfcdfb7..6e396fb6c98ba8ab44ca565afcfc03c5fa45cbf0 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run { xfail { powerpc*-*-* } } } */
 /* remove the xfail for powerpc when pr58684 is fixed */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
 
 #include <fenv.h>
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-3-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-3-float.c
new file mode 100644 (file)
index 0000000..297aa0e
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run { xfail { powerpc*-*-* } } } */
+/* remove the xfail for powerpc when pr58684 is fixed */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x <= __builtin_inf ();
+  if (i != 0 || !fetestexcept (FE_INVALID))
+    abort ();
+}
index de5c478a8d8218685ebae989d7898267da9ffed2..cac8c68f49f84d3058f305ab110db56c852336be 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run { xfail { powerpc*-*-* } } } */
 /* remove the xfail for powerpc when pr58684 is fixed */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
 
 #include <fenv.h>
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-4-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-4-float.c
new file mode 100644 (file)
index 0000000..e719c37
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run { xfail { powerpc*-*-* } } } */
+/* remove the xfail for powerpc when pr58684 is fixed */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x >= -__builtin_inf ();
+  if (i != 0 || !fetestexcept (FE_INVALID))
+    abort ();
+}
index 685562d3a40c1e9ea3cf41138fb16d4ce493077e..43b2b2f04ff8d8478aeb5cf7a382b7b6babdecc2 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do run { xfail { powerpc*-*-* } } } */
 /* remove the xfail for powerpc when pr58684 is fixed */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
 
 #include <fenv.h>
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-5-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-5-float.c
new file mode 100644 (file)
index 0000000..0050644
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x == __builtin_inf ();
+  if (i != 0 || fetestexcept (FE_INVALID))
+    abort ();
+}
index d7f17e7dd2145d0e296bcd806dddd66bfc03987b..37289b4771f8b92e21d4bb4e1baf6ab4b87faf03 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-6-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-6-float.c
new file mode 100644 (file)
index 0000000..46e8758
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x == -__builtin_inf ();
+  if (i != 0 || fetestexcept (FE_INVALID))
+    abort ();
+}
index 2dd862b7ebe9862aa0338753424506205d5559ca..7a8ff01fab26ad5ad16f8d55404f587ccf227631 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-7-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-7-float.c
new file mode 100644 (file)
index 0000000..11d987a
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x != __builtin_inf ();
+  if (i != 1 || fetestexcept (FE_INVALID))
+    abort ();
+}
index 36676b4e79f09fe9e0865e39c6667c0cea5eb746..c0e080b40275d117e58427aa1de246e1febebcce 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 
diff --git a/gcc/testsuite/gcc.dg/torture/inf-compare-8-float.c b/gcc/testsuite/gcc.dg/torture/inf-compare-8-float.c
new file mode 100644 (file)
index 0000000..5510c67
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+extern void abort (void);
+extern void exit (int);
+
+volatile float x = __builtin_nan ("");
+volatile int i;
+
+int
+main (void)
+{
+  i = x != -__builtin_inf ();
+  if (i != 1 || fetestexcept (FE_INVALID))
+    abort ();
+}
index cfda813a0c634a13baaf98f167e15918b2bbe56e..ebc0260bfba42465c0c7d1789e70e1667418efd0 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 
index 3f1580d56ee1a5acd6806f834a2b443cb480079a..aa19c1bc39a59895cef77e67f17fc62a921770b4 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_long_double } */
 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
 
 #include <fenv.h>
index 254ace15adac6f72b2b6595627db178a25b80319..88a30b9182703844adb59ecfb2833ed31661c12d 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
 
 #include <fenv.h>
 
index 8d45bc2427f34c6f1c5e8071d940d481b9047b2f..8b5995a2f414e6f0a2f66f2c52f289e5b53c3f4e 100644 (file)
@@ -10852,6 +10852,80 @@ proc check_effective_target_fenv_exceptions_dfp {} {
     } [add_options_for_ieee "-std=gnu99"]]
 }
 
+# Return 1 if <fenv.h> is available with all the standard IEEE
+# exceptions and floating-point exceptions are raised by arithmetic
+# operations.  (If the target requires special options for "inexact"
+# exceptions, those need to be specified in the testcases.)
+
+proc check_effective_target_fenv_exceptions_double {} {
+    return [check_runtime fenv_exceptions_double {
+       #include <fenv.h>
+       #include <stdlib.h>
+       #ifndef FE_DIVBYZERO
+       # error Missing FE_DIVBYZERO
+       #endif
+       #ifndef FE_INEXACT
+       # error Missing FE_INEXACT
+       #endif
+       #ifndef FE_INVALID
+       # error Missing FE_INVALID
+       #endif
+       #ifndef FE_OVERFLOW
+       # error Missing FE_OVERFLOW
+       #endif
+       #ifndef FE_UNDERFLOW
+       # error Missing FE_UNDERFLOW
+       #endif
+       volatile double a = 0.0f, r;
+       int
+       main (void)
+       {
+         r = a / a;
+         if (fetestexcept (FE_INVALID))
+           exit (0);
+         else
+           abort ();
+       }
+    } [add_options_for_ieee "-std=gnu99"]]
+}
+
+# Return 1 if <fenv.h> is available with all the standard IEEE
+# exceptions and floating-point exceptions are raised by arithmetic
+# operations.  (If the target requires special options for "inexact"
+# exceptions, those need to be specified in the testcases.)
+
+proc check_effective_target_fenv_exceptions_long_double {} {
+    return [check_runtime fenv_exceptions_long_double {
+       #include <fenv.h>
+       #include <stdlib.h>
+       #ifndef FE_DIVBYZERO
+       # error Missing FE_DIVBYZERO
+       #endif
+       #ifndef FE_INEXACT
+       # error Missing FE_INEXACT
+       #endif
+       #ifndef FE_INVALID
+       # error Missing FE_INVALID
+       #endif
+       #ifndef FE_OVERFLOW
+       # error Missing FE_OVERFLOW
+       #endif
+       #ifndef FE_UNDERFLOW
+       # error Missing FE_UNDERFLOW
+       #endif
+       volatile long double a = 0.0f, r;
+       int
+       main (void)
+       {
+         r = a / a;
+         if (fetestexcept (FE_INVALID))
+           exit (0);
+         else
+           abort ();
+       }
+    } [add_options_for_ieee "-std=gnu99"]]
+}
+
 # Return 1 if -fexceptions is supported.
 
 proc check_effective_target_exceptions {} {