| 1 |
/* We used to simplify these incorrectly. */ |
| 2 |
__attribute__((noipa)) |
| 3 |
long long |
| 4 |
foo (unsigned int x) |
| 5 |
{ |
| 6 |
int y = x; |
| 7 |
y = ~y; |
| 8 |
return ((long long) x) & y; |
| 9 |
} |
| 10 |
|
| 11 |
__attribute__((noipa)) |
| 12 |
long long |
| 13 |
foo_v (volatile unsigned int x) |
| 14 |
{ |
| 15 |
volatile int y = x; |
| 16 |
y = ~y; |
| 17 |
return ((long long) x) & y; |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__((noipa)) |
| 21 |
long long |
| 22 |
bar (unsigned int x) |
| 23 |
{ |
| 24 |
int y = x; |
| 25 |
y = ~y; |
| 26 |
return ((long long) x) ^ y; |
| 27 |
} |
| 28 |
|
| 29 |
__attribute__((noipa)) |
| 30 |
long long |
| 31 |
bar_v (volatile unsigned int x) |
| 32 |
{ |
| 33 |
volatile int y = x; |
| 34 |
y = ~y; |
| 35 |
return ((long long) x) ^ y; |
| 36 |
} |
| 37 |
|
| 38 |
__attribute__((noipa)) |
| 39 |
long long |
| 40 |
baz (unsigned int x) |
| 41 |
{ |
| 42 |
int y = x; |
| 43 |
y = ~y; |
| 44 |
return y ^ ((long long) x); |
| 45 |
} |
| 46 |
|
| 47 |
__attribute__((noipa)) |
| 48 |
long long |
| 49 |
baz_v (volatile unsigned int x) |
| 50 |
{ |
| 51 |
volatile int y = x; |
| 52 |
y = ~y; |
| 53 |
return y ^ ((long long) x); |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
int main() |
| 58 |
{ |
| 59 |
for(int t = -1; t <= 1; t++) |
| 60 |
{ |
| 61 |
if (foo(t) != foo_v(t)) |
| 62 |
__builtin_abort (); |
| 63 |
if (bar(t) != bar_v(t)) |
| 64 |
__builtin_abort (); |
| 65 |
if (baz(t) != baz_v(t)) |
| 66 |
__builtin_abort (); |
| 67 |
} |
| 68 |
} |