2 /* { dg-options "-O2" } */
4 extern void abort (void);
7 __attribute__ ((noinline
, noclone
))
8 static int rt32 (int x
, int y
, int z
) {
9 return (__builtin_bswap32(x
) >> y
) & z
;
11 #define TEST32(X,Y,Z) if(((__builtin_bswap32(X)>>Y)&Z)!=rt32(X,Y,Z)) abort()
52 #if __SIZEOF_LONG_LONG__ == 8
53 __attribute__ ((noinline
, noclone
))
54 static long long rt64 (long long x
, int y
, long long z
) {
55 return (__builtin_bswap64(x
) >> y
) & z
;
57 #define TEST64(X,Y,Z) if(((__builtin_bswap64(X)>>Y)&Z)!=rt64(X,Y,Z)) abort()
58 void test64(long long x
)
135 __attribute__ ((noinline
, noclone
))
136 static int rt16 (int x
, int y
, int z
) {
137 return (__builtin_bswap16(x
) >> y
) & z
;
139 #define TEST16(X,Y,Z) if(((__builtin_bswap16(X)>>Y)&Z)!=rt16(X,Y,Z)) abort()
203 #if __SIZEOF_LONG_LONG__ == 8
204 test64(0x0000000000000000ll
);
205 test64(0xffffffffffffffffll
);
206 test64(0x0000000000000001ll
);
207 test64(0x0000000000000002ll
);
208 test64(0x0000000000000004ll
);
209 test64(0x0000000000000008ll
);
210 test64(0x0000000000000010ll
);
211 test64(0x0000000000000020ll
);
212 test64(0x0000000000000040ll
);
213 test64(0x0000000000000080ll
);
214 test64(0x0000000000000100ll
);
215 test64(0x0000000000000200ll
);
216 test64(0x0000000000000400ll
);
217 test64(0x0000000000000800ll
);
218 test64(0x0000000000001000ll
);
219 test64(0x0000000000002000ll
);
220 test64(0x0000000000004000ll
);
221 test64(0x0000000000008000ll
);
222 test64(0x0000000000010000ll
);
223 test64(0x0000000000020000ll
);
224 test64(0x0000000000040000ll
);
225 test64(0x0000000000080000ll
);
226 test64(0x0000000000100000ll
);
227 test64(0x0000000000200000ll
);
228 test64(0x0000000000400000ll
);
229 test64(0x0000000000800000ll
);
230 test64(0x0000000001000000ll
);
231 test64(0x0000000002000000ll
);
232 test64(0x0000000004000000ll
);
233 test64(0x0000000008000000ll
);
234 test64(0x0000000010000000ll
);
235 test64(0x0000000020000000ll
);
236 test64(0x0000000040000000ll
);
237 test64(0x0000000080000000ll
);
238 test64(0x0000000100000000ll
);
239 test64(0x0000000200000000ll
);
240 test64(0x0000000400000000ll
);
241 test64(0x0000000800000000ll
);
242 test64(0x0000001000000000ll
);
243 test64(0x0000002000000000ll
);
244 test64(0x0000004000000000ll
);
245 test64(0x0000008000000000ll
);
246 test64(0x0000010000000000ll
);
247 test64(0x0000020000000000ll
);
248 test64(0x0000040000000000ll
);
249 test64(0x0000080000000000ll
);
250 test64(0x0000100000000000ll
);
251 test64(0x0000200000000000ll
);
252 test64(0x0000400000000000ll
);
253 test64(0x0000800000000000ll
);
254 test64(0x0001000000000000ll
);
255 test64(0x0002000000000000ll
);
256 test64(0x0004000000000000ll
);
257 test64(0x0008000000000000ll
);
258 test64(0x0010000000000000ll
);
259 test64(0x0020000000000000ll
);
260 test64(0x0040000000000000ll
);
261 test64(0x0080000000000000ll
);
262 test64(0x0100000000000000ll
);
263 test64(0x0200000000000000ll
);
264 test64(0x0400000000000000ll
);
265 test64(0x0800000000000000ll
);
266 test64(0x1000000000000000ll
);
267 test64(0x2000000000000000ll
);
268 test64(0x4000000000000000ll
);
269 test64(0x8000000000000000ll
);
270 test64(0x0123456789abcdefll
);
271 test64(0xfedcba9876543210ll
);
272 test64(0xdeadbeefdeadbeefll
);
273 test64(0xcafebabecafebabell
);