Daily bump.
[official-gcc.git] / gcc / testsuite / c-c++-common / rotate-1.c
blob0777c6b191f983f538f6fd9fa4039c3fd9d36ab7
1 /* Check rotate pattern detection. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 96 "optimized" } } */
6 unsigned int
7 f1 (unsigned int x, unsigned int y)
9 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
12 unsigned int
13 f2 (unsigned int x, unsigned long int y)
15 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
18 unsigned int
19 f3 (unsigned int x, int y __attribute__((unused)))
21 return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
24 unsigned int
25 f4 (unsigned int x, int y __attribute__((unused)))
27 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1);
30 unsigned short int
31 f5 (unsigned short int x, unsigned int y)
33 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
36 unsigned short int
37 f6 (unsigned short int x, unsigned long int y)
39 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
42 unsigned char
43 f7 (unsigned char x, unsigned int y)
45 return (x << y) | (x >> (__CHAR_BIT__ - y));
48 unsigned char
49 f8 (unsigned char x, unsigned long int y)
51 return (x << y) | (x >> (__CHAR_BIT__ - y));
54 unsigned int
55 f9 (unsigned int x, unsigned int y)
57 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
60 unsigned int
61 f10 (unsigned int x, unsigned long int y)
63 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
66 unsigned int
67 f11 (unsigned int x, int y __attribute__((unused)))
69 return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
72 unsigned int
73 f12 (unsigned int x, int y __attribute__((unused)))
75 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1);
78 unsigned short int
79 f13 (unsigned short int x, unsigned int y)
81 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
84 unsigned short int
85 f14 (unsigned short int x, unsigned long int y)
87 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
90 unsigned char
91 f15 (unsigned char x, unsigned int y)
93 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
96 unsigned char
97 f16 (unsigned char x, unsigned long int y)
99 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
102 unsigned int
103 f17 (unsigned int x, unsigned int y)
105 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
108 unsigned int
109 f18 (unsigned int x, unsigned long int y)
111 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
114 unsigned int
115 f19 (unsigned int x, int y __attribute__((unused)))
117 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1);
120 unsigned int
121 f20 (unsigned int x, int y __attribute__((unused)))
123 return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
126 unsigned short int
127 f21 (unsigned short int x, unsigned int y)
129 return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
132 unsigned short int
133 f22 (unsigned short int x, unsigned long int y)
135 return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
138 unsigned char
139 f23 (unsigned char x, unsigned int y)
141 return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
144 unsigned char
145 f24 (unsigned char x, unsigned long int y)
147 return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
150 unsigned int
151 f25 (unsigned int x, unsigned int y)
153 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
156 unsigned int
157 f26 (unsigned int x, unsigned long int y)
159 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
162 unsigned int
163 f27 (unsigned int x, int y __attribute__((unused)))
165 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1);
168 unsigned int
169 f28 (unsigned int x, int y __attribute__((unused)))
171 return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
174 unsigned short int
175 f29 (unsigned short int x, unsigned int y)
177 return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
180 unsigned short int
181 f30 (unsigned short int x, unsigned long int y)
183 return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
186 unsigned char
187 f31 (unsigned char x, unsigned int y)
189 return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
192 unsigned char
193 f32 (unsigned char x, unsigned long int y)
195 return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
198 unsigned int
199 f33 (unsigned int x, unsigned int y)
201 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
204 unsigned int
205 f34 (unsigned int x, unsigned long int y)
207 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
210 unsigned int
211 f35 (unsigned int x, int y __attribute__((unused)))
213 return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
216 unsigned int
217 f36 (unsigned int x, int y __attribute__((unused)))
219 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1);
222 unsigned short int
223 f37 (unsigned short int x, unsigned int y)
225 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
228 unsigned short int
229 f38 (unsigned short int x, unsigned long int y)
231 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
234 unsigned char
235 f39 (unsigned char x, unsigned int y)
237 return (x >> y) | (x << (__CHAR_BIT__ - y));
240 unsigned char
241 f40 (unsigned char x, unsigned long int y)
243 return (x >> y) | (x << (__CHAR_BIT__ - y));
246 unsigned int
247 f41 (unsigned int x, unsigned int y)
249 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
252 unsigned int
253 f42 (unsigned int x, unsigned long int y)
255 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
258 unsigned int
259 f43 (unsigned int x, int y __attribute__((unused)))
261 return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
264 unsigned int
265 f44 (unsigned int x, int y __attribute__((unused)))
267 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1);
270 unsigned short int
271 f45 (unsigned short int x, unsigned int y)
273 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
276 unsigned short int
277 f46 (unsigned short int x, unsigned long int y)
279 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
282 unsigned char
283 f47 (unsigned char x, unsigned int y)
285 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
288 unsigned char
289 f48 (unsigned char x, unsigned long int y)
291 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
294 unsigned int
295 f49 (unsigned int x, unsigned int y)
297 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
300 unsigned int
301 f50 (unsigned int x, unsigned long int y)
303 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
306 unsigned int
307 f51 (unsigned int x, int y __attribute__((unused)))
309 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1);
312 unsigned int
313 f52 (unsigned int x, int y __attribute__((unused)))
315 return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
318 unsigned short int
319 f53 (unsigned short int x, unsigned int y)
321 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
324 unsigned short int
325 f54 (unsigned short int x, unsigned long int y)
327 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
330 unsigned char
331 f55 (unsigned char x, unsigned int y)
333 return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
336 unsigned char
337 f56 (unsigned char x, unsigned long int y)
339 return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
342 unsigned int
343 f57 (unsigned int x, unsigned int y)
345 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
348 unsigned int
349 f58 (unsigned int x, unsigned long int y)
351 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
354 unsigned int
355 f59 (unsigned int x, int y __attribute__((unused)))
357 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1);
360 unsigned int
361 f60 (unsigned int x, int y __attribute__((unused)))
363 return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
366 unsigned short int
367 f61 (unsigned short int x, unsigned int y)
369 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
372 unsigned short int
373 f62 (unsigned short int x, unsigned long int y)
375 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
378 unsigned char
379 f63 (unsigned char x, unsigned int y)
381 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
384 unsigned char
385 f64 (unsigned char x, unsigned long int y)
387 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
390 unsigned int
391 f65 (unsigned int x, unsigned int y)
393 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
396 unsigned int
397 f66 (unsigned int x, unsigned long int y)
399 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
402 unsigned int
403 f67 (unsigned int x, int y __attribute__((unused)))
405 return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
408 unsigned int
409 f68 (unsigned int x, int y __attribute__((unused)))
411 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
414 unsigned short int
415 f69 (unsigned short int x, unsigned int y)
417 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
420 unsigned short int
421 f70 (unsigned short int x, unsigned long int y)
423 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
426 unsigned char
427 f71 (unsigned char x, unsigned int y)
429 return (x << y) + (x >> (__CHAR_BIT__ - y));
432 unsigned char
433 f72 (unsigned char x, unsigned long int y)
435 return (x << y) + (x >> (__CHAR_BIT__ - y));
438 unsigned int
439 f73 (unsigned int x, unsigned int y)
441 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
444 unsigned int
445 f74 (unsigned int x, unsigned long int y)
447 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
450 unsigned int
451 f75 (unsigned int x, int y __attribute__((unused)))
453 return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
456 unsigned int
457 f76 (unsigned int x, int y __attribute__((unused)))
459 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
462 unsigned short int
463 f77 (unsigned short int x, unsigned int y)
465 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
468 unsigned short int
469 f78 (unsigned short int x, unsigned long int y)
471 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
474 unsigned char
475 f79 (unsigned char x, unsigned int y)
477 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
480 unsigned char
481 f80 (unsigned char x, unsigned long int y)
483 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
486 unsigned int
487 f81 (unsigned int x, unsigned int y)
489 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
492 unsigned int
493 f82 (unsigned int x, unsigned long int y)
495 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
498 unsigned int
499 f83 (unsigned int x, int y __attribute__((unused)))
501 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
504 unsigned int
505 f84 (unsigned int x, int y __attribute__((unused)))
507 return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
510 unsigned short int
511 f85 (unsigned short int x, unsigned int y)
513 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
516 unsigned short int
517 f86 (unsigned short int x, unsigned long int y)
519 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
522 unsigned char
523 f87 (unsigned char x, unsigned int y)
525 return (x << (__CHAR_BIT__ - y)) + (x >> y);
528 unsigned char
529 f88 (unsigned char x, unsigned long int y)
531 return (x << (__CHAR_BIT__ - y)) + (x >> y);
534 unsigned int
535 f89 (unsigned int x, unsigned int y)
537 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
540 unsigned int
541 f90 (unsigned int x, unsigned long int y)
543 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
546 unsigned int
547 f91 (unsigned int x, int y __attribute__((unused)))
549 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
552 unsigned int
553 f92 (unsigned int x, int y __attribute__((unused)))
555 return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
558 unsigned short int
559 f93 (unsigned short int x, unsigned int y)
561 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
564 unsigned short int
565 f94 (unsigned short int x, unsigned long int y)
567 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
570 unsigned char
571 f95 (unsigned char x, unsigned int y)
573 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
576 unsigned char
577 f96 (unsigned char x, unsigned long int y)
579 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);