+++ /dev/null
-/* 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);
-}
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* 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);
+}
--- /dev/null
+/* 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);
+}
/* { 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>
/* { 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
/* { 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
/* { 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
/* { 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
--- /dev/null
+/* { 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 ();
+}
/* { 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>
--- /dev/null
+/* { 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 ();
+}
/* { 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>
--- /dev/null
+/* { 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 ();
+}
/* { 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>
--- /dev/null
+/* { 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 ();
+}
/* { 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>
--- /dev/null
+/* { 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 ();
+}
/* { dg-do run } */
/* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
#include <fenv.h>
--- /dev/null
+/* { 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 ();
+}
/* { dg-do run } */
/* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
#include <fenv.h>
--- /dev/null
+/* { 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 ();
+}
/* { dg-do run } */
/* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
#include <fenv.h>
--- /dev/null
+/* { 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 ();
+}
/* { dg-do run } */
/* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
#include <fenv.h>
/* { 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>
/* { dg-do run } */
/* { dg-add-options ieee } */
-/* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target fenv_exceptions_double } */
#include <fenv.h>
} [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 {} {