1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-optimized -fwrapv" } */
3
4 #include <limits.h>
5 #include <stdbool.h>
6
test1(unsigned a,unsigned b)7 bool __attribute__ ((noipa)) test1 (unsigned a, unsigned b)
8 {
9 return (b == 0) | (a < b);
10 }
11
test2(int a,int b)12 bool __attribute__ ((noipa)) test2 (int a, int b)
13 {
14 return (b == INT_MIN) | (a < b);
15 }
16
test3(unsigned a,unsigned b)17 bool __attribute__ ((noipa)) test3 (unsigned a, unsigned b)
18 {
19 return (b != 0) & (a >= b);
20 }
21
test4(int a,int b)22 bool __attribute__ ((noipa)) test4 (int a, int b)
23 {
24 return (b != INT_MIN) & (a >= b);
25 }
26
main()27 int main()
28 {
29 if (!test1 (1, 0) || !test1 (1, 2) || test1 (2, 1) ||
30 !test2 (1, INT_MIN) || !test2 (1, 2) || test2 (2, 1) ||
31 test3 (1, 0) || test3 (1, 2) || !test3 (2, 1) ||
32 test4 (1, INT_MIN) || test4 (1, 2) || !test4 (2, 1)) {
33 __builtin_abort();
34 }
35
36 return 0;
37 }
38
39 /* { dg-final { scan-tree-dump-times "\\+ 4294967295;" 2 "optimized" } } */
40 /* { dg-final { scan-tree-dump-times "\\+ -1;" 2 "optimized" } } */
41