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