1 /* { dg-do compile } */
2 /* { dg-require-effective-target bswap32 } */
3 /* { dg-require-effective-target stdint_types } */
4 /* { dg-options "-O2 -fdump-tree-bswap" } */
5 /* { dg-additional-options "-march=z900" { target s390-*-* } } */
9 #define __const_swab32(x) ((uint32_t)( \
10 (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
11 (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
12 (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
13 (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
15 /* This byte swap implementation is used by the Linux kernel and the
19 swap32_a (uint32_t in
)
21 return __const_swab32 (in
);
24 /* The OpenSSH byte swap implementation. */
26 swap32_b (uint32_t in
)
30 a
= (in
<< 16) | (in
>> 16);
31 a
= ((a
& 0x00ff00ff) << 8) | ((a
& 0xff00ff00) >> 8);
36 /* This variant is currently used by libgcc. The difference is that
37 the bswap source and destination have a signed integer type which
38 requires a slightly higher search depth in order to dive through
41 typedef int SItype
__attribute__ ((mode (SI
)));
46 return ((((u
) & 0xff000000) >> 24)
47 | (((u
) & 0x00ff0000) >> 8)
48 | (((u
) & 0x0000ff00) << 8)
49 | (((u
) & 0x000000ff) << 24));
52 /* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 3 "bswap" } } */
53 /* { dg-final { cleanup-tree-dump "bswap" } } */