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" } */
4
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*-*-* } } */
8
9#include <stdint.h>
10
11#define BS(X) __builtin_bswap32(X)
12
13int foo1 (uint32_t a)
14{
15  if (BS (a) == 0xA0000)
16    return 1;
17  return 0;
18}
19
20int foo2 (uint32_t a)
21{
22  if (BS (a) != 0xA0000)
23    return 1;
24  return 0;
25}
26
27int foo3 (uint32_t a, uint32_t b)
28{
29  if (BS (a) == BS (b))
30    return 1;
31  return 0;
32}
33
34int foo4 (uint32_t a, uint32_t b)
35{
36  if (BS (a) != BS (b))
37    return 1;
38  return 0;
39}
40
41/* { dg-final { scan-rtl-dump-not "bswapsi" "combine" } } */
42/* { dg-final { cleanup-rtl-dump "combine" } } */
43