1 /* { dg-do compile } */
2 /* { dg-require-effective-target bswap } */
3 /* { dg-options "-O2 -fdump-tree-bswap" } */
4 /* { dg-additional-options "-march=z900" { target s390-*-* } } */
5
6 typedef unsigned char u8;
7 typedef unsigned int u32;
8 union __anonunion
9 {
10 u32 value;
11 u8 bytes[4];
12 };
13
14 u32
15 acpi_ut_dword_byte_swap (u32 value)
16 {
17 union __anonunion in;
18 in.value = value;
19 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
20 return ((in.bytes[0] << 24) | (in.bytes[1] << 16)
21 | (in.bytes[2] << 8) | in.bytes[3]);
22 #else
23 return ((in.bytes[3] << 24) | (in.bytes[2] << 16)
24 | (in.bytes[1] << 8) | in.bytes[0]);
25 #endif
26 }
27
28 /* { dg-final { scan-tree-dump "32 bit bswap implementation found at" "bswap" } } */