Reverting merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-43.c
blob85d96b6cb0c45a1e857eef3614feb9ac00e533cf
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-trapping-math -fno-finite-math-only -fdump-tree-gimple -fdump-tree-optimized" } */
4 extern void f(int);
5 extern void link_error ();
7 extern float x;
8 extern double y;
9 extern long double z;
11 int
12 main ()
14 double nan = __builtin_nan ("");
15 #ifndef __SPU__
16 /* The SPU single-precision floating point format does not support NANs. */
17 float nanf = __builtin_nanf ("");
18 #endif
19 long double nanl = __builtin_nanl ("");
21 if (!__builtin_isnan (nan))
22 link_error ();
23 #ifndef __SPU__
24 if (!__builtin_isnan (nanf))
25 link_error ();
26 if (!__builtin_isnanf (nanf))
27 link_error ();
28 #endif
29 if (!__builtin_isnan (nanl))
30 link_error ();
31 if (!__builtin_isnanl (nanl))
32 link_error ();
34 if (__builtin_isnan (4.0))
35 link_error ();
36 if (__builtin_isnan (4.0))
37 link_error ();
38 if (__builtin_isnanf (4.0))
39 link_error ();
40 if (__builtin_isnan (4.0))
41 link_error ();
42 if (__builtin_isnanl (4.0))
43 link_error ();
45 f (__builtin_isnan (x));
46 f (__builtin_isnan (y));
47 f (__builtin_isnanf (y));
48 f (__builtin_isnan (z));
49 f (__builtin_isnanl (z));
53 /* Check that all instances of __builtin_isnan were folded. */
54 /* { dg-final { scan-tree-dump-times "isnan" 0 "gimple" } } */
55 /* { dg-final { cleanup-tree-dump "gimple" } } */
57 /* Check that all instances of link_error were subject to DCE. */
58 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
59 /* { dg-final { cleanup-tree-dump "optimized" } } */