| 1 |
/* PR middle-end/45262 */ |
| 2 |
|
| 3 |
/* { dg-require-effective-target int32plus } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
int |
| 8 |
foo (unsigned int x) |
| 9 |
{ |
| 10 |
return ((int) x < 0) || ((int) (-x) < 0); |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
bar (unsigned int x) |
| 15 |
{ |
| 16 |
return x >> 31 || (-x) >> 31; |
| 17 |
} |
| 18 |
|
| 19 |
int |
| 20 |
main (void) |
| 21 |
{ |
| 22 |
if (foo (1) != 1) |
| 23 |
abort (); |
| 24 |
if (foo (0) != 0) |
| 25 |
abort (); |
| 26 |
if (foo (-1) != 1) |
| 27 |
abort (); |
| 28 |
if (bar (1) != 1) |
| 29 |
abort (); |
| 30 |
if (bar (0) != 0) |
| 31 |
abort (); |
| 32 |
if (bar (-1) != 1) |
| 33 |
abort (); |
| 34 |
return 0; |
| 35 |
} |