| 1 |
/* PR tree-optimization/86723 */ |
| 2 |
/* { dg-do compile { target lp64 } } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-times "\tbswap\t" 5 } } */ |
| 5 |
|
| 6 |
int |
| 7 |
foo (unsigned long long value) |
| 8 |
{ |
| 9 |
return (((value & 0x00000000000000ffull) << 56) |
| 10 |
| ((value & 0x000000000000ff00ull) << 40) |
| 11 |
| ((value & 0x0000000000ff0000ull) << 24) |
| 12 |
| ((value & 0x00000000ff000000ull) << 8) |
| 13 |
| ((value & 0x000000ff00000000ull) >> 8) |
| 14 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 15 |
| ((value & 0x00ff000000000000ull) >> 40) |
| 16 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 17 |
} |
| 18 |
|
| 19 |
int |
| 20 |
bar (unsigned long long value) |
| 21 |
{ |
| 22 |
return (((value & 0x000000ff00000000ull) >> 8) |
| 23 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 24 |
| ((value & 0x00ff000000000000ull) >> 40) |
| 25 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 26 |
} |
| 27 |
|
| 28 |
unsigned long long |
| 29 |
baz (unsigned long long value) |
| 30 |
{ |
| 31 |
return (((value & 0x00000000000000ffull) << 56) |
| 32 |
| ((value & 0x000000000000ff00ull) << 40) |
| 33 |
| ((value & 0x00000000ff000000ull) << 8) |
| 34 |
| ((value & 0x000000ff00000000ull) >> 8) |
| 35 |
| ((value & 0x0000ff0000000000ull) >> 24) |
| 36 |
| ((value & 0xff00000000000000ull) >> 56)); |
| 37 |
} |
| 38 |
|
| 39 |
unsigned int |
| 40 |
qux (unsigned int value) |
| 41 |
{ |
| 42 |
return (((value & 0x000000ff) << 24) |
| 43 |
| ((value & 0x00ff0000) >> 8) |
| 44 |
| ((value & 0xff000000) >> 24)); |
| 45 |
} |
| 46 |
|
| 47 |
unsigned int |
| 48 |
corge (unsigned int value) |
| 49 |
{ |
| 50 |
return (((value & 0x000000ff) << 24) |
| 51 |
| ((value & 0xff000000) >> 24)); |
| 52 |
} |