Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-eqbswap-1.c
blobed9820b0f909ec65628de32875e056203d40ab2b
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 int test1(int x, int y)
6 #if __SIZEOF_INT__ == 4
7 return __builtin_bswap32(x) == __builtin_bswap32(y);
8 #else
9 return x == y;
10 #endif
13 int test2(int x, int y)
15 #if __SIZEOF_INT__ == 4
16 return __builtin_bswap32(x) != __builtin_bswap32(y);
17 #else
18 return x != y;
19 #endif
22 int test3(int x)
24 #if __SIZEOF_INT__ == 4
25 return __builtin_bswap32(x) == 12345;
26 #else
27 return x;
28 #endif
31 int test4(int x)
33 #if __SIZEOF_INT__ == 4
34 return __builtin_bswap32(x) != 12345;
35 #else
36 return x;
37 #endif
40 int test1ll(long long x, long long y)
42 #if __SIZEOF_LONG_LONG__ == 8
43 return __builtin_bswap64(x) == __builtin_bswap64(y);
44 #else
45 return x == y;
46 #endif
49 int test2ll(long long x, long long y)
51 #if __SIZEOF_LONG_LONG__ == 8
52 return __builtin_bswap64(x) != __builtin_bswap64(y);
53 #else
54 return x != y;
55 #endif
58 int test3ll(long long x)
60 #if __SIZEOF_LONG_LONG__ == 8
61 return __builtin_bswap64(x) == 12345;
62 #else
63 return (int)x;
64 #endif
67 int test4ll(long long x)
69 #if __SIZEOF_LONG_LONG__ == 8
70 return __builtin_bswap64(x) != 12345;
71 #else
72 return (int)x;
73 #endif
76 int test1s(short x, short y)
78 #if __SIZEOF_SHORT__ == 2
79 return __builtin_bswap16(x) == __builtin_bswap16(y);
80 #else
81 return x == y;
82 #endif
85 int test2s(short x, short y)
87 #if __SIZEOF_SHORT__ == 2
88 return __builtin_bswap16(x) != __builtin_bswap16(y);
89 #else
90 return x != y;
91 #endif
94 int test3s(short x)
96 #if __SIZEOF_SHORT__ == 2
97 return __builtin_bswap16(x) == 12345;
98 #else
99 return (int)x;
100 #endif
103 int test4s(short x)
105 #if __SIZEOF_SHORT__ == 2
106 return __builtin_bswap16(x) != 12345;
107 #else
108 return (int)x;
109 #endif
112 /* { dg-final { scan-tree-dump-times "__builtin_bswap" 0 "optimized" } } */