111
|
1 /* { dg-do compile } */
|
131
|
2 /* { dg-require-effective-target bswap } */
|
111
|
3 /* { dg-require-effective-target stdint_types } */
|
|
4 /* { dg-options "-O2 -fdump-tree-bswap" } */
|
|
5 /* { dg-additional-options "-mzarch" { target s390*-*-* } } */
|
|
6
|
|
7 #include <stdint.h>
|
|
8
|
|
9 /* A variant via unsigned short. */
|
|
10
|
|
11 uint64_t
|
|
12 swap64_c (uint64_t x)
|
|
13 {
|
|
14 uint16_t a0 = x >> 48;
|
|
15 uint16_t a1 = x >> 32;
|
|
16 uint16_t a2 = x >> 16;
|
|
17 uint16_t a3 = x;
|
|
18
|
|
19 return ((uint64_t) (((a0 >> 8) & 0xff) | ((a0 << 8) & 0xff00)))
|
|
20 | ((uint64_t) (((a1 >> 8) & 0xff) | ((a1 << 8) & 0xff00)) << 16)
|
|
21 | ((uint64_t) (((a2 >> 8) & 0xff) | ((a2 << 8) & 0xff00)) << 32)
|
|
22 | ((uint64_t) (((a3 >> 8) & 0xff) | ((a3 << 8) & 0xff00)) << 48);
|
|
23 }
|
|
24
|
|
25
|
|
26 /* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 1 "bswap" } } */
|