Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-bswap-7a.c
blob92b48cc41680d5718f11fb78895ca184193f88c9
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 "-O2 -fdump-rtl-combine" } */
6 /* The test is similiar to builtin-bswap-7.c but returns 1/2 instead
7 of 0/1 to prevent GCC from calculating the return value with
8 arithmetic instead of a comparison. This requires the optimization
9 level to be bumped up to -O2 at least for x86_64. */
11 #include <stdint.h>
13 #define BS(X) __builtin_bswap64(X)
15 int foo1 (uint64_t a)
17 if (BS (a) == 0xA00000000)
18 return 1;
19 return 2;
22 int foo2 (uint64_t a)
24 if (BS (a) != 0xA00000000)
25 return 1;
26 return 2;
29 int foo3 (uint64_t a, uint64_t b)
31 if (BS (a) == BS (b))
32 return 1;
33 return 2;
36 int foo4 (uint64_t a, uint64_t b)
38 if (BS (a) != BS (b))
39 return 1;
40 return 2;
43 /* { dg-final { scan-rtl-dump-not "bswapdi" "combine" } } */