1 /* { dg-do compile } */
2 /* { dg-options "-O3 -march=z900 -mzarch" } */
3 
4 #include <stdint.h>
5 
6 uint64_t u64;
7 uint32_t u32;
8 uint16_t u16;
9 
10 uint64_t
foo64a(uint64_t a)11 foo64a (uint64_t a)
12 {
13   return __builtin_bswap64 (a);
14 }
15 /* { dg-final { scan-assembler-times "lrvgr\t%r2,%r2" 1 { target lp64 } } } */
16 
17 uint64_t
foo64b()18 foo64b ()
19 {
20   return __builtin_bswap64 (u64);
21 }
22 /* { dg-final { scan-assembler-times "lrvg\t%r2,\[0-9\]+\\(%r\[0-9\]*\\)" 1 { target lp64 } } } */
23 
24 void
foo64c(uint64_t a)25 foo64c (uint64_t a)
26 {
27   u64 = __builtin_bswap64 (a);
28 }
29 /* { dg-final { scan-assembler-times "strvg\t%r2,\[0-9\]+\\(%r\[0-9\]*\\)" 1 { target lp64 } } } */
30 
31 
32 
33 uint32_t
foo32a(uint32_t a)34 foo32a (uint32_t a)
35 {
36   return __builtin_bswap32 (a);
37 }
38 /* { dg-final { scan-assembler-times "lrvr\t%r2,%r2" 1 } } */
39 
40 uint32_t
foo32b()41 foo32b ()
42 {
43   return __builtin_bswap32 (u32);
44 }
45 /* { dg-final { scan-assembler-times "lrv\t%r2,\[0-9\]+\\(%r\[0-9\]*\\)" 1 } } */
46 
47 void
foo32c(uint32_t a)48 foo32c (uint32_t a)
49 {
50   u32 = __builtin_bswap32 (a);
51 }
52 /* { dg-final { scan-assembler-times "strv\t%r2,\[0-9\]+\\(%r\[0-9\]*\\)" 1 } } */
53