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