1 /* { dg-do compile } */
2 /* { dg-options "-O -fsignaling-nans -fdump-tree-original" } */
3 
4 /* We can not get rid of comparison in tests below because of
5    pending NaN exceptions.
6 
7    TODO: avoid under -fno-trapping-math.  */
8 
9 #define QNAN __builtin_nanf ("0")
10 #define SNAN __builtin_nansf ("0")
11 
nonfinite(unsigned short x)12 void nonfinite(unsigned short x) {
13   {
14     volatile int nonfinite_1;
15     nonfinite_1 = (float) x > QNAN;
16     /* { dg-final { scan-tree-dump "nonfinite_1 = \\(float\\)" "original" } } */
17   }
18 
19   {
20     volatile int nonfinite_2;
21     nonfinite_2 = (float) x >= QNAN;
22     /* { dg-final { scan-tree-dump "nonfinite_2 = \\(float\\)" "original" } } */
23   }
24 
25   {
26     volatile int nonfinite_3;
27     nonfinite_3 = (float) x < QNAN;
28     /* { dg-final { scan-tree-dump "nonfinite_3 = \\(float\\)" "original" } } */
29   }
30 
31   {
32     volatile int nonfinite_4;
33     nonfinite_4 = (float) x <= QNAN;
34     /* { dg-final { scan-tree-dump "nonfinite_4 = \\(float\\)" "original" } } */
35   }
36 
37   {
38     volatile int nonfinite_5;
39     nonfinite_5 = (float) x > SNAN;
40     /* { dg-final { scan-tree-dump "nonfinite_5 = \\(float\\)" "original" } } */
41   }
42 
43   {
44     volatile int nonfinite_6;
45     nonfinite_6 = (float) x >= SNAN;
46     /* { dg-final { scan-tree-dump "nonfinite_6 = \\(float\\)" "original" } } */
47   }
48 
49   {
50     volatile int nonfinite_7;
51     nonfinite_7 = (float) x < SNAN;
52     /* { dg-final { scan-tree-dump "nonfinite_7 = \\(float\\)" "original" } } */
53   }
54 
55   {
56     volatile int nonfinite_8;
57     nonfinite_8 = (float) x <= SNAN;
58     /* { dg-final { scan-tree-dump "nonfinite_8 = \\(float\\)" "original" } } */
59   }
60 
61   {
62     volatile int nonfinite_9;
63     nonfinite_9 = (float) x == SNAN;
64     /* { dg-final { scan-tree-dump "nonfinite_9 = \\(float\\)" "original" } } */
65   }
66 
67   {
68     volatile int nonfinite_10;
69     nonfinite_10 = (float) x != SNAN;
70     /* { dg-final { scan-tree-dump "nonfinite_10 = \\(float\\)" "original" } } */
71   }
72 
73   {
74     volatile int nonfinite_11;
75     nonfinite_11 = (float) x == QNAN;
76     /* { dg-final { scan-tree-dump "nonfinite_11 = 0" "original" } } */
77   }
78 
79   {
80     volatile int nonfinite_12;
81     nonfinite_12 = (float) x != QNAN;
82     /* { dg-final { scan-tree-dump "nonfinite_12 = 1" "original" } } */
83   }
84 }
85