PR target/83368
[official-gcc.git] / gcc / testsuite / c-c++-common / pr57371-4.c
blobf43f7c22419a56661ebcb284fa648f478be1833f
1 /* { dg-do compile } */
2 /* { dg-options "-O -fsignaling-nans -fdump-tree-original" } */
4 /* We can not get rid of comparison in tests below because of
5 pending NaN exceptions.
7 TODO: avoid under -fno-trapping-math. */
9 #define QNAN __builtin_nanf ("0")
10 #define SNAN __builtin_nansf ("0")
12 void nonfinite(unsigned short x) {
14 volatile int nonfinite_1;
15 nonfinite_1 = (float) x > QNAN;
16 /* { dg-final { scan-tree-dump "nonfinite_1 = \\(float\\)" "original" } } */
20 volatile int nonfinite_2;
21 nonfinite_2 = (float) x >= QNAN;
22 /* { dg-final { scan-tree-dump "nonfinite_2 = \\(float\\)" "original" } } */
26 volatile int nonfinite_3;
27 nonfinite_3 = (float) x < QNAN;
28 /* { dg-final { scan-tree-dump "nonfinite_3 = \\(float\\)" "original" } } */
32 volatile int nonfinite_4;
33 nonfinite_4 = (float) x <= QNAN;
34 /* { dg-final { scan-tree-dump "nonfinite_4 = \\(float\\)" "original" } } */
38 volatile int nonfinite_5;
39 nonfinite_5 = (float) x > SNAN;
40 /* { dg-final { scan-tree-dump "nonfinite_5 = \\(float\\)" "original" } } */
44 volatile int nonfinite_6;
45 nonfinite_6 = (float) x >= SNAN;
46 /* { dg-final { scan-tree-dump "nonfinite_6 = \\(float\\)" "original" } } */
50 volatile int nonfinite_7;
51 nonfinite_7 = (float) x < SNAN;
52 /* { dg-final { scan-tree-dump "nonfinite_7 = \\(float\\)" "original" } } */
56 volatile int nonfinite_8;
57 nonfinite_8 = (float) x <= SNAN;
58 /* { dg-final { scan-tree-dump "nonfinite_8 = \\(float\\)" "original" } } */
62 volatile int nonfinite_9;
63 nonfinite_9 = (float) x == SNAN;
64 /* { dg-final { scan-tree-dump "nonfinite_9 = \\(float\\)" "original" } } */
68 volatile int nonfinite_10;
69 nonfinite_10 = (float) x != SNAN;
70 /* { dg-final { scan-tree-dump "nonfinite_10 = \\(float\\)" "original" } } */
74 volatile int nonfinite_11;
75 nonfinite_11 = (float) x == QNAN;
76 /* { dg-final { scan-tree-dump "nonfinite_11 = 0" "original" } } */
80 volatile int nonfinite_12;
81 nonfinite_12 = (float) x != QNAN;
82 /* { dg-final { scan-tree-dump "nonfinite_12 = 1" "original" } } */