PR target/83368
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-bswap-6.c
blob152b7a6b9a9a4fb954602cd55adf8c06357df097
1 /* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* rs6000-*-* x86_64-*-* s390*-*-* } } */
2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-options "-O -fdump-rtl-combine" } */
5 /* The branch cost setting prevents the return value from being
6 calculated with arithmetic instead of doing a compare. */
7 /* { dg-additional-options "-march=z900 -mbranch-cost=0" { target s390*-*-* } } */
9 #include <stdint.h>
11 #define BS(X) __builtin_bswap32(X)
13 int foo1 (uint32_t a)
15 if (BS (a) == 0xA0000)
16 return 1;
17 return 0;
20 int foo2 (uint32_t a)
22 if (BS (a) != 0xA0000)
23 return 1;
24 return 0;
27 int foo3 (uint32_t a, uint32_t b)
29 if (BS (a) == BS (b))
30 return 1;
31 return 0;
34 int foo4 (uint32_t a, uint32_t b)
36 if (BS (a) != BS (b))
37 return 1;
38 return 0;
41 /* { dg-final { scan-rtl-dump-not "bswapsi" "combine" } } */