Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.c

raw
1 /* Copyright (C) 2004 Free Software Foundation.
2
3 Test for composite comparison always true/false optimization.
4
5 Written by Paolo Bonzini, 26th May 2004. */
6
7 extern void link_error0 ();
8 extern void link_error1 ();
9
10 void
11 test1 (float x, float y)
12 {
13 if ((x==y) && (x!=y))
14 link_error0();
15 }
16
17 void
18 test2 (float x, float y)
19 {
20 if ((x<y) && (x>y))
21 link_error0();
22 }
23
24 void
25 test3 (float x, float y)
26 {
27 if ((x<y) && (y<x))
28 link_error0();
29 }
30
31 void
32 test4 (float x, float y)
33 {
34 if ((x==y) || (x!=y))
35 {
36 }
37 else
38 link_error1 ();
39 }
40
41 void
42 test5 (float x, float y)
43 {
44 if (__builtin_isunordered (x, y) || (x>=y) || (x<y))
45 {
46 }
47 else
48 link_error1 ();
49 }
50
51 void
52 test6 (float x, float y)
53 {
54 if (__builtin_isunordered (y, x) || (x<=y) || (y<x))
55 {
56 }
57 else
58 link_error1 ();
59 }
60
61 void
62 test7 (float x, float y)
63 {
64 if (__builtin_isunordered (x, y) || !__builtin_isunordered (x, y))
65 {
66 }
67 else
68 link_error1 ();
69 }
70
71 void
72 all_tests (float x, float y)
73 {
74 test1 (x, y);
75 test2 (x, y);
76 test3 (x, y);
77 test4 (x, y);
78 test5 (x, y);
79 test6 (x, y);
80 test7 (x, y);
81 }
82
83 int
84 main ()
85 {
86 all_tests (0, 0);
87 all_tests (1, 2);
88 all_tests (4, 3);
89
90 return 0;
91 }
92
93 #ifndef __OPTIMIZE__
94 void link_error0() {}
95 void link_error1() {}
96 #endif /* ! __OPTIMIZE__ */
97