| 1 |
/* PR rtl-optimization/63843 */ |
| 2 |
|
| 3 |
static inline __attribute__ ((always_inline)) |
| 4 |
unsigned short foo (unsigned short v) |
| 5 |
{ |
| 6 |
return (v << 8) | (v >> 8); |
| 7 |
} |
| 8 |
|
| 9 |
unsigned short __attribute__ ((noinline, noclone, hot)) |
| 10 |
bar (unsigned char *x) |
| 11 |
{ |
| 12 |
unsigned int a; |
| 13 |
unsigned short b; |
| 14 |
__builtin_memcpy (&a, &x[0], sizeof (a)); |
| 15 |
a ^= 0x80808080U; |
| 16 |
__builtin_memcpy (&x[0], &a, sizeof (a)); |
| 17 |
__builtin_memcpy (&b, &x[2], sizeof (b)); |
| 18 |
return foo (b); |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
main () |
| 23 |
{ |
| 24 |
unsigned char x[8] = { 0x01, 0x01, 0x01, 0x01 }; |
| 25 |
if (__CHAR_BIT__ == 8 |
| 26 |
&& sizeof (short) == 2 |
| 27 |
&& sizeof (int) == 4 |
| 28 |
&& bar (x) != 0x8181U) |
| 29 |
__builtin_abort (); |
| 30 |
return 0; |
| 31 |
} |