| 1 |
/* PR tree-optimization/86723 */ |
| 2 |
/* { dg-do run { target { ilp32 || lp64 } } } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
|
| 5 |
__attribute__((noipa)) int |
| 6 |
foo (unsigned long long value) |
| 7 |
{ |
| 8 |
return (((value & 0x00000000000000ffull) << 56) |
| 9 |
| ((value & 0x000000000000ff00ull) << 40) |
| 10 |
| ((value & 0x0000000000ff0000ull) << 24) |
| 11 |
| ((value & 0x00000000ff000000ull) << 8) |
| 12 |
| ((value & 0x000000ff00000000ull) >> 8) |
| 13 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 14 |
| ((value & 0x00ff000000000000ull) >> 40) |
| 15 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 16 |
} |
| 17 |
|
| 18 |
__attribute__((noipa)) int |
| 19 |
bar (unsigned long long value) |
| 20 |
{ |
| 21 |
return (((value & 0x000000ff00000000ull) >> 8) |
| 22 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 23 |
| ((value & 0x00ff000000000000ull) >> 40) |
| 24 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 25 |
} |
| 26 |
|
| 27 |
__attribute__((noipa)) unsigned long long |
| 28 |
baz (unsigned long long value) |
| 29 |
{ |
| 30 |
return (((value & 0x00000000000000ffull) << 56) |
| 31 |
| ((value & 0x000000000000ff00ull) << 40) |
| 32 |
| ((value & 0x00000000ff000000ull) << 8) |
| 33 |
| ((value & 0x000000ff00000000ull) >> 8) |
| 34 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 35 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 36 |
} |
| 37 |
|
| 38 |
__attribute__((noipa)) unsigned int |
| 39 |
qux (unsigned int value) |
| 40 |
{ |
| 41 |
return (((value & 0x000000ff) << 24) |
| 42 |
| ((value & 0x00ff0000) >> 8) |
| 43 |
| ((value & 0xff000000) >> 24)); |
| 44 |
} |
| 45 |
|
| 46 |
__attribute__((noipa)) unsigned int |
| 47 |
corge (unsigned int value) |
| 48 |
{ |
| 49 |
return (((value & 0x000000ff) << 24) |
| 50 |
| ((value & 0xff000000) >> 24)); |
| 51 |
} |
| 52 |
|
| 53 |
int |
| 54 |
main () |
| 55 |
{ |
| 56 |
if (foo (0x0102030405060708ull) != 0x04030201 |
| 57 |
|| bar (0x0102030405060708ull) != 0x04030201 |
| 58 |
|| baz (0x0102030405060708ull) != 0x0807000504030001ull |
| 59 |
|| qux (0x01020304) != 0x04000201 |
| 60 |
|| corge (0x01020304) != 0x04000001) |
| 61 |
__builtin_abort (); |
| 62 |
return 0; |
| 63 |
} |