2007-02-09 Zdenek Dvorak <dvorakz@suse.cz>
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-compare-3.c
blob011bf47bd6e28f43720e6c8cc551a9af1c4392ef
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-cleanup_cfg1" } */
4 #include <limits.h>
6 void this_comparison_is_false (void);
7 void this_comparison_is_true (void);
8 void this_comparison_is_not_decidable (void);
10 void bla1eq (int var)
12 if (var + 10 == INT_MIN + 9)
13 this_comparison_is_false ();
16 void bla2eq (int var)
18 if (var + 10 == INT_MIN + 10)
19 this_comparison_is_not_decidable ();
22 void bla3eq (int var)
24 if (var - 10 == INT_MAX - 9)
25 this_comparison_is_false ();
28 void bla4eq (int var)
30 if (var - 10 == INT_MAX - 10)
31 this_comparison_is_not_decidable ();
34 void bla1ne (int var)
36 if (var + 10 != INT_MIN + 9)
37 this_comparison_is_true ();
40 void bla2ne (int var)
42 if (var + 10 != INT_MIN + 10)
43 this_comparison_is_not_decidable ();
46 void bla3ne (int var)
48 if (var - 10 != INT_MAX - 9)
49 this_comparison_is_true ();
52 void bla4ne (int var)
54 if (var - 10 != INT_MAX - 10)
55 this_comparison_is_not_decidable ();
58 void bla1lt (int var)
60 if (var + 10 < INT_MIN + 10)
61 this_comparison_is_false ();
64 void bla2lt (int var)
66 if (var + 10 < INT_MIN + 11)
67 this_comparison_is_not_decidable ();
70 void bla3lt (int var)
72 if (var - 10 < INT_MAX - 9)
73 this_comparison_is_true ();
76 void bla4lt (int var)
78 if (var - 10 < INT_MAX - 10)
79 this_comparison_is_not_decidable ();
82 void bla1le (int var)
84 if (var + 10 <= INT_MIN + 9)
85 this_comparison_is_false ();
88 void bla2le (int var)
90 if (var + 10 <= INT_MIN + 10)
91 this_comparison_is_not_decidable ();
94 void bla3le (int var)
96 if (var - 10 <= INT_MAX - 10)
97 this_comparison_is_true ();
100 void bla4le (int var)
102 if (var - 10 <= INT_MAX - 11)
103 this_comparison_is_not_decidable ();
106 void bla1gt (int var)
108 if (var + 10 > INT_MIN + 9)
109 this_comparison_is_true ();
112 void bla2gt (int var)
114 if (var + 10 > INT_MIN + 10)
115 this_comparison_is_not_decidable ();
118 void bla3gt (int var)
120 if (var - 10 > INT_MAX - 10)
121 this_comparison_is_false ();
124 void bla4gt (int var)
126 if (var - 10 > INT_MAX - 11)
127 this_comparison_is_not_decidable ();
130 void bla1ge (int var)
132 if (var + 10 >= INT_MIN + 10)
133 this_comparison_is_true ();
136 void bla2ge (int var)
138 if (var + 10 >= INT_MIN + 11)
139 this_comparison_is_not_decidable ();
142 void bla3ge (int var)
144 if (var - 11 >= INT_MAX - 10)
145 this_comparison_is_false ();
148 void bla4ge (int var)
150 if (var - 10 >= INT_MAX - 10)
151 this_comparison_is_not_decidable ();
154 /* { dg-final { scan-tree-dump-times "this_comparison_is_false" 0 "cleanup_cfg1" } } */
155 /* { dg-final { scan-tree-dump-times "this_comparison_is_true" 6 "cleanup_cfg1" } } */
156 /* { dg-final { scan-tree-dump-times "this_comparison_is_not_decidable" 12 "cleanup_cfg1" } } */
157 /* { dg-final { scan-tree-dump-times "if " 12 "cleanup_cfg1" } } */
159 /* { dg-final { cleanup-tree-dump "cleanup_cfg1" } } */