Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / c-c++-common / rotate-3.c
blobaaa9f507f8519e2da3db438dc494d1658d135464
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" } } */
5 /* { dg-final { cleanup-tree-dump "optimized" } } */
7 unsigned int
8 f1 (unsigned int x, int y)
10 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
13 unsigned int
14 f2 (unsigned int x, long int y)
16 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
19 unsigned int
20 f3 (unsigned int x, int y __attribute__((unused)))
22 return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
25 unsigned int
26 f4 (unsigned int x, int y __attribute__((unused)))
28 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1);
31 unsigned short int
32 f5 (unsigned short int x, int y)
34 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
37 unsigned short int
38 f6 (unsigned short int x, long int y)
40 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
43 unsigned char
44 f7 (unsigned char x, int y)
46 return (x << y) | (x >> (__CHAR_BIT__ - y));
49 unsigned char
50 f8 (unsigned char x, long int y)
52 return (x << y) | (x >> (__CHAR_BIT__ - y));
55 unsigned int
56 f9 (unsigned int x, int y)
58 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
61 unsigned int
62 f10 (unsigned int x, long int y)
64 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
67 unsigned int
68 f11 (unsigned int x, int y __attribute__((unused)))
70 return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
73 unsigned int
74 f12 (unsigned int x, int y __attribute__((unused)))
76 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1);
79 unsigned short int
80 f13 (unsigned short int x, int y)
82 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
85 unsigned short int
86 f14 (unsigned short int x, long int y)
88 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
91 unsigned char
92 f15 (unsigned char x, int y)
94 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
97 unsigned char
98 f16 (unsigned char x, long int y)
100 return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
103 unsigned int
104 f17 (unsigned int x, int y)
106 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
109 unsigned int
110 f18 (unsigned int x, long int y)
112 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
115 unsigned int
116 f19 (unsigned int x, int y __attribute__((unused)))
118 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1);
121 unsigned int
122 f20 (unsigned int x, int y __attribute__((unused)))
124 return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
127 unsigned short int
128 f21 (unsigned short int x, int y)
130 return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
133 unsigned short int
134 f22 (unsigned short int x, long int y)
136 return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
139 unsigned char
140 f23 (unsigned char x, int y)
142 return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
145 unsigned char
146 f24 (unsigned char x, long int y)
148 return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
151 unsigned int
152 f25 (unsigned int x, int y)
154 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
157 unsigned int
158 f26 (unsigned int x, long int y)
160 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
163 unsigned int
164 f27 (unsigned int x, int y __attribute__((unused)))
166 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1);
169 unsigned int
170 f28 (unsigned int x, int y __attribute__((unused)))
172 return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
175 unsigned short int
176 f29 (unsigned short int x, int y)
178 return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
181 unsigned short int
182 f30 (unsigned short int x, long int y)
184 return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
187 unsigned char
188 f31 (unsigned char x, int y)
190 return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
193 unsigned char
194 f32 (unsigned char x, long int y)
196 return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
199 unsigned int
200 f33 (unsigned int x, int y)
202 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
205 unsigned int
206 f34 (unsigned int x, long int y)
208 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
211 unsigned int
212 f35 (unsigned int x, int y __attribute__((unused)))
214 return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
217 unsigned int
218 f36 (unsigned int x, int y __attribute__((unused)))
220 return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1);
223 unsigned short int
224 f37 (unsigned short int x, int y)
226 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
229 unsigned short int
230 f38 (unsigned short int x, long int y)
232 return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
235 unsigned char
236 f39 (unsigned char x, int y)
238 return (x >> y) | (x << (__CHAR_BIT__ - y));
241 unsigned char
242 f40 (unsigned char x, long int y)
244 return (x >> y) | (x << (__CHAR_BIT__ - y));
247 unsigned int
248 f41 (unsigned int x, int y)
250 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
253 unsigned int
254 f42 (unsigned int x, long int y)
256 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
259 unsigned int
260 f43 (unsigned int x, int y __attribute__((unused)))
262 return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
265 unsigned int
266 f44 (unsigned int x, int y __attribute__((unused)))
268 return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1);
271 unsigned short int
272 f45 (unsigned short int x, int y)
274 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
277 unsigned short int
278 f46 (unsigned short int x, long int y)
280 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
283 unsigned char
284 f47 (unsigned char x, int y)
286 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
289 unsigned char
290 f48 (unsigned char x, long int y)
292 return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
295 unsigned int
296 f49 (unsigned int x, int y)
298 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
301 unsigned int
302 f50 (unsigned int x, long int y)
304 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
307 unsigned int
308 f51 (unsigned int x, int y __attribute__((unused)))
310 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1);
313 unsigned int
314 f52 (unsigned int x, int y __attribute__((unused)))
316 return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
319 unsigned short int
320 f53 (unsigned short int x, int y)
322 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
325 unsigned short int
326 f54 (unsigned short int x, long int y)
328 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
331 unsigned char
332 f55 (unsigned char x, int y)
334 return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
337 unsigned char
338 f56 (unsigned char x, long int y)
340 return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
343 unsigned int
344 f57 (unsigned int x, int y)
346 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
349 unsigned int
350 f58 (unsigned int x, long int y)
352 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
355 unsigned int
356 f59 (unsigned int x, int y __attribute__((unused)))
358 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1);
361 unsigned int
362 f60 (unsigned int x, int y __attribute__((unused)))
364 return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
367 unsigned short int
368 f61 (unsigned short int x, int y)
370 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
373 unsigned short int
374 f62 (unsigned short int x, long int y)
376 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
379 unsigned char
380 f63 (unsigned char x, int y)
382 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
385 unsigned char
386 f64 (unsigned char x, long int y)
388 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
391 unsigned int
392 f65 (unsigned int x, int y)
394 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
397 unsigned int
398 f66 (unsigned int x, long int y)
400 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
403 unsigned int
404 f67 (unsigned int x, int y __attribute__((unused)))
406 return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
409 unsigned int
410 f68 (unsigned int x, int y __attribute__((unused)))
412 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
415 unsigned short int
416 f69 (unsigned short int x, int y)
418 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
421 unsigned short int
422 f70 (unsigned short int x, long int y)
424 return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
427 unsigned char
428 f71 (unsigned char x, int y)
430 return (x << y) + (x >> (__CHAR_BIT__ - y));
433 unsigned char
434 f72 (unsigned char x, long int y)
436 return (x << y) + (x >> (__CHAR_BIT__ - y));
439 unsigned int
440 f73 (unsigned int x, int y)
442 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
445 unsigned int
446 f74 (unsigned int x, long int y)
448 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
451 unsigned int
452 f75 (unsigned int x, int y __attribute__((unused)))
454 return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
457 unsigned int
458 f76 (unsigned int x, int y __attribute__((unused)))
460 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
463 unsigned short int
464 f77 (unsigned short int x, int y)
466 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
469 unsigned short int
470 f78 (unsigned short int x, long int y)
472 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
475 unsigned char
476 f79 (unsigned char x, int y)
478 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
481 unsigned char
482 f80 (unsigned char x, long int y)
484 return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
487 unsigned int
488 f81 (unsigned int x, int y)
490 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
493 unsigned int
494 f82 (unsigned int x, long int y)
496 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
499 unsigned int
500 f83 (unsigned int x, int y __attribute__((unused)))
502 return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
505 unsigned int
506 f84 (unsigned int x, int y __attribute__((unused)))
508 return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
511 unsigned short int
512 f85 (unsigned short int x, int y)
514 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
517 unsigned short int
518 f86 (unsigned short int x, long int y)
520 return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
523 unsigned char
524 f87 (unsigned char x, int y)
526 return (x << (__CHAR_BIT__ - y)) + (x >> y);
529 unsigned char
530 f88 (unsigned char x, long int y)
532 return (x << (__CHAR_BIT__ - y)) + (x >> y);
535 unsigned int
536 f89 (unsigned int x, int y)
538 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
541 unsigned int
542 f90 (unsigned int x, long int y)
544 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
547 unsigned int
548 f91 (unsigned int x, int y __attribute__((unused)))
550 return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
553 unsigned int
554 f92 (unsigned int x, int y __attribute__((unused)))
556 return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
559 unsigned short int
560 f93 (unsigned short int x, int y)
562 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
565 unsigned short int
566 f94 (unsigned short int x, long int y)
568 return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
571 unsigned char
572 f95 (unsigned char x, int y)
574 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
577 unsigned char
578 f96 (unsigned char x, long int y)
580 return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);