gcc/testsuite/gcc.dg/tree-ssa/pr96239.c
raw| 1 | /* PR tree-optimization/96239 */ |
| 2 | /* { dg-do compile { target { ilp32 || lp64 } } } */ |
| 3 | /* { dg-options "-O3 -fdump-tree-optimized" } */ |
| 4 | /* { dg-final { scan-tree-dump " r>> 8;" "optimized" { target bswap } } } */ |
| 5 | |
| 6 | union U { unsigned char c[2]; unsigned short s; }; |
| 7 | |
| 8 | unsigned short |
| 9 | foo (unsigned short x) |
| 10 | { |
| 11 | union U u; |
| 12 | u.s = x; |
| 13 | unsigned char v = u.c[0]; |
| 14 | unsigned char w = u.c[1]; |
| 15 | u.c[0] = w; |
| 16 | u.c[1] = v; |
| 17 | return u.s; |
| 18 | } |