1 /* { dg-do compile { target arm*-*-* alpha*-*-* ia64*-*-* i?86-*-* x86_64-*-* s390x-*-* powerpc*-*-* rs6000-*-* } } */
2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-options "-O -fdump-rtl-combine" } */
5
6 /* The branch cost setting prevents the return value from being
7 calculated with arithmetic instead of doing a compare. */
8 /* { dg-additional-options "-mbranch-cost=0" { target branch_cost } } */
9
10 #include <stdint.h>
11
12 #define BS(X) __builtin_bswap64(X)
13
foo1(uint64_t a)14 int foo1 (uint64_t a)
15 {
16 if (BS (a) == 0xA00000000)
17 return 1;
18 return 0;
19 }
20
foo2(uint64_t a)21 int foo2 (uint64_t a)
22 {
23 if (BS (a) != 0xA00000000)
24 return 1;
25 return 0;
26 }
27
foo3(uint64_t a,uint64_t b)28 int foo3 (uint64_t a, uint64_t b)
29 {
30 if (BS (a) == BS (b))
31 return 1;
32 return 0;
33 }
34
foo4(uint64_t a,uint64_t b)35 int foo4 (uint64_t a, uint64_t b)
36 {
37 if (BS (a) != BS (b))
38 return 1;
39 return 0;
40 }
41
42 /* { dg-final { scan-rtl-dump-not "bswapdi" "combine" } } */
43