Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr91323.c

raw
1 /* { dg-do run { xfail powerpc*-*-* } } */
2 /* remove the xfail for powerpc when pr58684 is fixed */
3 /* { dg-add-options ieee } */
4 /* { dg-require-effective-target fenv_exceptions } */
5 /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */
6
7 #include <fenv.h>
8
9 int
10 __attribute__ ((noinline, noclone))
11 f1 (float a, float b)
12 {
13 return __builtin_isless (a, b) || __builtin_isgreater (a, b);
14 }
15
16 int
17 __attribute__ ((noinline, noclone))
18 f2 (float a, float b)
19 {
20 return __builtin_islessgreater (a, b);
21 }
22
23 int
24 __attribute__ ((noinline, noclone))
25 f3 (float a, float b)
26 {
27 return a < b || a > b;
28 }
29
30 int
31 main (void)
32 {
33 volatile int r;
34
35 float nanf = __builtin_nanf ("");
36 float argf = 1.0f;
37
38 feclearexcept (FE_INVALID);
39
40 r = f1 (nanf, argf);
41 if (r != 0 || fetestexcept (FE_INVALID))
42 __builtin_abort ();
43
44 r = f2 (nanf, argf);
45 if (r != 0 || fetestexcept (FE_INVALID))
46 __builtin_abort ();
47
48 r = f3 (nanf, argf);
49 if (r != 0 || !fetestexcept (FE_INVALID))
50 __builtin_abort ();
51
52 return 0;
53 }