]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/builtin-bswap-13.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / builtin-bswap-13.c
CommitLineData
4c619132
RS
1/* { dg-do compile } */
2/* { dg-options "-O2 -fdump-tree-optimized" } */
3
4int test_s32_0_1(int x) { return __builtin_bswap32(x) & 1; }
5int test_s32_0_2(int x) { return __builtin_bswap32(x) & 2; }
6int test_s32_0_240(int x) { return __builtin_bswap32(x) & 240; }
7int test_s32_0_255(int x) { return __builtin_bswap32(x) & 255; }
8int test_s32_1_1(int x) { return (__builtin_bswap32(x) >> 1) & 1; }
9int test_s32_7_1(int x) { return (__builtin_bswap32(x) >> 7) & 1; }
10int test_s32_8_1(int x) { return (__builtin_bswap32(x) >> 8) & 1; }
11int test_s32_8_240(int x) { return (__builtin_bswap32(x) >> 8) & 240; }
12int test_s32_8_255(int x) { return (__builtin_bswap32(x) >> 8) & 255; }
13int test_s32_15_1(int x) { return (__builtin_bswap32(x) >> 15) & 1; }
14int test_s32_16_1(int x) { return (__builtin_bswap32(x) >> 16) & 1; }
15int test_s32_16_240(int x) { return (__builtin_bswap32(x) >> 16) & 240; }
16int test_s32_16_255(int x) { return (__builtin_bswap32(x) >> 16) & 255; }
17int test_s32_24_1(int x) { return (__builtin_bswap32(x) >> 24) & 1; }
18int test_s32_24_240(int x) { return (__builtin_bswap32(x) >> 24) & 240; }
19int test_s32_24_255(int x) { return (__builtin_bswap32(x) >> 24) & 255; }
20int test_s32_31_1(int x) { return (__builtin_bswap32(x) >> 31) & 1; }
21
22int test_S32_0_1(int x) { return (int)__builtin_bswap32(x) & 1; }
23int test_S32_0_2(int x) { return (int)__builtin_bswap32(x) & 2; }
24int test_S32_0_240(int x) { return (int)__builtin_bswap32(x) & 240; }
25int test_S32_0_255(int x) { return (int)__builtin_bswap32(x) & 255; }
26int test_S32_1_1(int x) { return ((int)__builtin_bswap32(x) >> 1) & 1; }
27int test_S32_7_1(int x) { return ((int)__builtin_bswap32(x) >> 7) & 1; }
28int test_S32_8_1(int x) { return ((int)__builtin_bswap32(x) >> 8) & 1; }
29int test_S32_8_240(int x) { return ((int)__builtin_bswap32(x) >> 8) & 240; }
30int test_S32_8_255(int x) { return ((int)__builtin_bswap32(x) >> 8) & 255; }
31int test_S32_15_1(int x) { return ((int)__builtin_bswap32(x) >> 15) & 1; }
32int test_S32_16_1(int x) { return ((int)__builtin_bswap32(x) >> 16) & 1; }
33int test_S32_16_240(int x) { return ((int)__builtin_bswap32(x) >> 16) & 240; }
34int test_S32_16_255(int x) { return ((int)__builtin_bswap32(x) >> 16) & 255; }
35int test_S32_24_1(int x) { return ((int)__builtin_bswap32(x) >> 24) & 1; }
36int test_S32_24_240(int x) { return ((int)__builtin_bswap32(x) >> 24) & 240; }
37int test_S32_24_255(int x) { return ((int)__builtin_bswap32(x) >> 24) & 255; }
38int test_S32_31_1(int x) { return ((int)__builtin_bswap32(x) >> 31) & 1; }
39
40unsigned int test_u32_24_255(unsigned int x) {
41 return (__builtin_bswap32(x) >> 24) & 255;
42}
43
44long long test_s64_0_1(long long x) {
45 return __builtin_bswap64(x) & 1;
46}
47long long test_s64_0_2(long long x) {
48 return __builtin_bswap64(x) & 2;
49}
50long long test_s64_0_240(long long x) {
51 return __builtin_bswap64(x) & 240;
52}
53long long test_s64_0_255(long long x) {
54 return __builtin_bswap64(x) & 255;
55}
56long long test_s64_7_1(long long x) {
57 return (__builtin_bswap64(x) >> 7) & 1;
58}
59long long test_s64_8_1(long long x) {
60 return (__builtin_bswap64(x) >> 8) & 1;
61}
62long long test_s64_8_240(long long x) {
63 return (__builtin_bswap64(x) >> 56) & 240;
64}
65long long test_s64_8_255(long long x) {
66 return (__builtin_bswap64(x) >> 8) & 255;
67}
68long long test_s64_9_1(long long x) {
69 return (__builtin_bswap64(x) >> 9) & 1;
70}
71long long test_s64_31_1(long long x) {
72 return (__builtin_bswap64(x) >> 31) & 1;
73}
74long long test_s64_32_1(long long x) {
75 return (__builtin_bswap64(x) >> 32) & 1;
76}
77long long test_s64_32_240(long long x) {
78 return (__builtin_bswap64(x) >> 32) & 240;
79}
80long long test_s64_32_255(long long x) {
81 return (__builtin_bswap64(x) >> 32) & 255;
82}
83long long test_s64_33_1(long long x) {
84 return (__builtin_bswap64(x) >> 33) & 1;
85}
86long long test_s64_48_1(long long x) {
87 return (__builtin_bswap64(x) >> 48) & 1;
88}
89long long test_s64_48_240(long long x) {
90 return (__builtin_bswap64(x) >> 48) & 240;
91}
92long long test_s64_48_255(long long x) {
93 return (__builtin_bswap64(x) >> 48) & 255;
94}
95long long test_s64_56_1(long long x) {
96 return (__builtin_bswap64(x) >> 56) & 1;
97}
98long long test_s64_56_240(long long x) {
99 return (__builtin_bswap64(x) >> 56) & 240;
100}
101long long test_s64_56_255(long long x) {
102 return (__builtin_bswap64(x) >> 56) & 255;
103}
104long long test_s64_57_1(long long x) {
105 return (__builtin_bswap64(x) >> 57) & 1;
106}
107long long test_s64_63_1(long long x) {
108 return (__builtin_bswap64(x) >> 63) & 1;
109}
110
111long long test_S64_0_1(long long x) {
112 return (long long)__builtin_bswap64(x) & 1;
113}
114long long test_S64_0_2(long long x) {
115 return (long long)__builtin_bswap64(x) & 2;
116}
117long long test_S64_0_240(long long x) {
118 return (long long)__builtin_bswap64(x) & 240;
119}
120long long test_S64_0_255(long long x) {
121 return (long long)__builtin_bswap64(x) & 255;
122}
123long long test_S64_7_1(long long x) {
124 return ((long long)__builtin_bswap64(x) >> 7) & 1;
125}
126long long test_S64_8_1(long long x) {
127 return ((long long)__builtin_bswap64(x) >> 8) & 1;
128}
129long long test_S64_8_240(long long x) {
130 return ((long long)__builtin_bswap64(x) >> 56) & 240;
131}
132long long test_S64_8_255(long long x) {
133 return ((long long)__builtin_bswap64(x) >> 8) & 255;
134}
135long long test_S64_9_1(long long x) {
136 return ((long long)__builtin_bswap64(x) >> 9) & 1;
137}
138long long test_S64_31_1(long long x) {
139 return ((long long)__builtin_bswap64(x) >> 31) & 1;
140}
141long long test_S64_32_1(long long x) {
142 return ((long long)__builtin_bswap64(x) >> 32) & 1;
143}
144long long test_S64_32_240(long long x) {
145 return ((long long)__builtin_bswap64(x) >> 32) & 240;
146}
147long long test_S64_32_255(long long x) {
148 return ((long long)__builtin_bswap64(x) >> 32) & 255;
149}
150long long test_S64_33_1(long long x) {
151 return ((long long)__builtin_bswap64(x) >> 33) & 1;
152}
153long long test_S64_48_1(long long x) {
154 return ((long long)__builtin_bswap64(x) >> 48) & 1;
155}
156long long test_S64_48_240(long long x) {
157 return ((long long)__builtin_bswap64(x) >> 48) & 240;
158}
159long long test_S64_48_255(long long x) {
160 return ((long long)__builtin_bswap64(x) >> 48) & 255;
161}
162long long test_S64_56_1(long long x) {
163 return ((long long)__builtin_bswap64(x) >> 56) & 1;
164}
165long long test_S64_56_240(long long x) {
166 return ((long long)__builtin_bswap64(x) >> 56) & 240;
167}
168long long test_S64_56_255(long long x) {
169 return ((long long)__builtin_bswap64(x) >> 56) & 255;
170}
171long long test_S64_57_1(long long x) {
172 return ((long long)__builtin_bswap64(x) >> 57) & 1;
173}
174long long test_S64_63_1(long long x) {
175 return ((long long)__builtin_bswap64(x) >> 63) & 1;
176}
177
178unsigned long long test_u64_56_255(unsigned long long x) {
179 return (__builtin_bswap64(x) >> 56) & 255;
180}
181
182short test_s16_0_1(short x) {
183 return __builtin_bswap16(x) & 1;
184}
185short test_s16_0_240(short x) {
186 return __builtin_bswap16(x) & 240;
187}
188short test_s16_0_255(short x) {
189 return __builtin_bswap16(x) & 255;
190}
191short test_s16_1_1(short x) {
192 return (__builtin_bswap16(x) >> 1) & 1;
193}
194short test_s16_7_1(short x) {
195 return (__builtin_bswap16(x) >> 7) & 1;
196}
197short test_s16_8_1(short x) {
198 return (__builtin_bswap16(x) >> 8) & 1;
199}
200short test_s16_8_240(short x) {
201 return (__builtin_bswap16(x) >> 8) & 240;
202}
203short test_s16_8_255(short x) {
204 return (__builtin_bswap16(x) >> 8) & 255;
205}
206short test_s16_9_1(short x) {
207 return (__builtin_bswap16(x) >> 9) & 1;
208}
209short test_s16_15_1(short x) {
210 return (__builtin_bswap16(x) >> 15) & 1;
211}
212
213short test_S16_0_1(short x) {
214 return (short)__builtin_bswap16(x) & 1;
215}
216short test_S16_0_240(short x) {
217 return (short)__builtin_bswap16(x) & 240;
218}
219short test_S16_0_255(short x) {
220 return (short)__builtin_bswap16(x) & 255;
221}
222short test_S16_1_1(short x) {
223 return ((short)__builtin_bswap16(x) >> 1) & 1;
224}
225short test_S16_7_1(short x) {
226 return ((short)__builtin_bswap16(x) >> 7) & 1;
227}
228short test_S16_8_1(short x) {
229 return ((short)__builtin_bswap16(x) >> 8) & 1;
230}
231short test_S16_8_240(short x) {
232 return ((short)__builtin_bswap16(x) >> 8) & 240;
233}
234short test_S16_8_255(short x) {
235 return ((short)__builtin_bswap16(x) >> 8) & 255;
236}
237short test_S16_9_1(short x) {
238 return ((short)__builtin_bswap16(x) >> 9) & 1;
239}
240short test_S16_15_1(short x) {
241 return ((short)__builtin_bswap16(x) >> 15) & 1;
242}
243
244unsigned short test_u16_8_255(unsigned short x) {
245 return (__builtin_bswap16(x) >> 8) & 255;
246}
247
248
249/* Shifts only */
250int test_s32_24(int x) {
251 return __builtin_bswap32(x) >> 24;
252}
253int test_s32_25(int x) {
254 return __builtin_bswap32(x) >> 25;
255}
256int test_s32_30(int x) {
257 return __builtin_bswap32(x) >> 30;
258}
259int test_s32_31(int x) {
260 return __builtin_bswap32(x) >> 31;
261}
262
263unsigned int test_u32_24(unsigned int x) {
264 return __builtin_bswap32(x) >> 24;
265}
266unsigned int test_u32_25(unsigned int x) {
267 return __builtin_bswap32(x) >> 25;
268}
269unsigned int test_u32_30(unsigned int x) {
270 return __builtin_bswap32(x) >> 30;
271}
272unsigned int test_u32_31(unsigned int x) {
273 return __builtin_bswap32(x) >> 31;
274}
275
276long long test_s64_56(long long x) {
277 return __builtin_bswap64(x) >> 56;
278}
279long long test_s64_57(long long x) {
280 return __builtin_bswap64(x) >> 57;
281}
282long long test_s64_62(long long x) {
283 return __builtin_bswap64(x) >> 62;
284}
285long long test_s64_63(long long x) {
286 return __builtin_bswap64(x) >> 63;
287}
288
289unsigned long long test_u64_56(unsigned long long x) {
290 return __builtin_bswap64(x) >> 56;
291}
292unsigned long long test_u64_57(unsigned long long x) {
293 return __builtin_bswap64(x) >> 57;
294}
295unsigned long long test_u64_62(unsigned long long x) {
296 return __builtin_bswap64(x) >> 62;
297}
298unsigned long long test_u64_63(unsigned long long x) {
299 return __builtin_bswap64(x) >> 63;
300}
301
302short test_s16_8(short x) {
303 return __builtin_bswap16(x) >> 8;
304}
305short test_s16_9(short x) {
306 return __builtin_bswap16(x) >> 9;
307}
308short test_s16_14(short x) {
309 return __builtin_bswap16(x) >> 14;
310}
311short test_s16_15(short x) {
312 return __builtin_bswap16(x) >> 15;
313}
314
315unsigned short test_u16_8(unsigned short x) {
316 return __builtin_bswap16(x) >> 8;
317}
318unsigned short test_u16_9(unsigned short x) {
319 return __builtin_bswap16(x) >> 9;
320}
321unsigned short test_u16_14(unsigned short x) {
322 return __builtin_bswap16(x) >> 14;
323}
324unsigned short test_u16_15(unsigned short x) {
325 return __builtin_bswap16(x) >> 15;
326}
327
328/* { dg-final { scan-tree-dump-not "__builtin_bswap" "optimized" } } */
329