1 /* Check that the bswap32 pattern is generated as swap.b and swap.w
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-final { scan-assembler-times "swap.w" 7 } } */
6 /* { dg-final { scan-assembler-times "swap.b" 16 } } */
7 /* { dg-final { scan-assembler-times "extu.w" 2 } } */
8 /* { dg-final { scan-assembler-times "mov" 1 } } */
9 /* { dg-final { scan-assembler-not "{shll8|shlr8|shld|shad}" } } */
16 return __builtin_bswap32 (a
);
20 test_func_01 (unsigned int a
)
24 return __builtin_bswap32 (a
);
32 return (((a
>> 0) & 0xFF) << 24)
33 | (((a
>> 8) & 0xFF) << 16)
34 | (((a
>> 16) & 0xFF) << 8)
35 | (((a
>> 24) & 0xFF) << 0);
39 test_func_03 (unsigned int a
)
43 return (((a
>> 0) & 0xFF) << 24)
44 | (((a
>> 8) & 0xFF) << 16)
45 | (((a
>> 16) & 0xFF) << 8)
46 | (((a
>> 24) & 0xFF) << 0);
54 return __builtin_bswap32 (a
) >> 16;
58 test_func_05 (unsigned short a
)
62 return __builtin_bswap32 (a
) >> 16;
66 test_func_06 (long long a
)
70 return __builtin_bswap64 (a
);
74 test_func_07 (long long a
)
79 return __builtin_bswap64 (a
) >> 32;