111
|
1 /* { dg-do run } */
|
|
2 /* { dg-add-options ieee } */
|
|
3 /* { dg-require-effective-target fenv_exceptions } */
|
|
4
|
|
5 #include <fenv.h>
|
|
6
|
|
7 #define TEST_C_NOEX(CMP, S) \
|
|
8 r = nan##S CMP arg##S; \
|
|
9 if (fetestexcept (FE_INVALID)) \
|
|
10 __builtin_abort ()
|
|
11
|
|
12 #define TEST_B_NOEX(FN, S) \
|
|
13 r = __builtin_##FN (nan##S, arg##S); \
|
|
14 if (fetestexcept (FE_INVALID)) \
|
|
15 __builtin_abort ()
|
|
16
|
|
17 #define TEST_C_EX(CMP, S) \
|
|
18 r = nan##S CMP arg##S; \
|
|
19 if (!fetestexcept (FE_INVALID)) \
|
|
20 __builtin_abort (); \
|
|
21 feclearexcept (FE_INVALID)
|
|
22
|
|
23 #define TEST(TYPE, S) \
|
|
24 volatile TYPE nan##S = __builtin_nan##S (""); \
|
|
25 volatile TYPE arg##S = 1.0##S; \
|
|
26 \
|
|
27 TEST_C_NOEX (==, S); \
|
|
28 TEST_C_NOEX (!=, S); \
|
|
29 \
|
|
30 TEST_B_NOEX (isgreater, S); \
|
|
31 TEST_B_NOEX (isless, S); \
|
|
32 TEST_B_NOEX (isgreaterequal, S); \
|
|
33 TEST_B_NOEX (islessequal, S); \
|
|
34 \
|
|
35 TEST_B_NOEX (islessgreater, S); \
|
|
36 TEST_B_NOEX (isunordered, S); \
|
|
37 \
|
|
38 TEST_C_EX (>, S); \
|
|
39 TEST_C_EX (<, S); \
|
|
40 TEST_C_EX (>=, S); \
|
|
41 TEST_C_EX (<=, S)
|
|
42
|
|
43 int
|
|
44 main (void)
|
|
45 {
|
|
46 volatile int r;
|
|
47
|
|
48 feclearexcept (FE_INVALID);
|
|
49
|
|
50 TEST (float, f);
|
|
51 TEST (double, );
|
131
|
52 #if !defined(__hppa__) || !defined(__hpux__)
|
|
53 /* Long double on hppa*-hpux* is implemented in software and the routines
|
|
54 in fenv.h do not support it. */
|
111
|
55 TEST (long double, l);
|
131
|
56 #endif
|
111
|
57
|
|
58 return 0;
|
|
59 }
|