1 /* Check rotate pattern detection. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 96 "optimized" } } */
5 /* { dg-final { cleanup-tree-dump "optimized" } } */
8 f1 (unsigned int x
, unsigned int y
)
10 return (x
<< y
) | (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
14 f2 (unsigned int x
, unsigned long int y
)
16 return (x
<< y
) | (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
20 f3 (unsigned int x
, int y
__attribute__((unused
)))
22 return (x
<< 1) | (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
26 f4 (unsigned int x
, int y
__attribute__((unused
)))
28 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) | (x
>> 1);
32 f5 (unsigned short int x
, unsigned int y
)
34 return (x
<< y
) | (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
38 f6 (unsigned short int x
, unsigned long int y
)
40 return (x
<< y
) | (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
44 f7 (unsigned char x
, unsigned int y
)
46 return (x
<< y
) | (x
>> (__CHAR_BIT__
- y
));
50 f8 (unsigned char x
, unsigned long int y
)
52 return (x
<< y
) | (x
>> (__CHAR_BIT__
- y
));
56 f9 (unsigned int x
, unsigned int y
)
58 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
));
62 f10 (unsigned int x
, unsigned long int y
)
64 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
));
68 f11 (unsigned int x
, int y
__attribute__((unused
)))
70 return (x
<< 1) | (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1));
74 f12 (unsigned int x
, int y
__attribute__((unused
)))
76 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1)) | (x
>> 1);
80 f13 (unsigned short int x
, unsigned int y
)
82 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
));
86 f14 (unsigned short int x
, unsigned long int y
)
88 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
));
92 f15 (unsigned char x
, unsigned int y
)
94 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
));
98 f16 (unsigned char x
, unsigned long int y
)
100 return (x
<< y
) | (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
));
104 f17 (unsigned int x
, unsigned int y
)
106 return (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) ^ (x
<< y
);
110 f18 (unsigned int x
, unsigned long int y
)
112 return (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) ^ (x
<< y
);
116 f19 (unsigned int x
, int y
__attribute__((unused
)))
118 return (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) ^ (x
<< 1);
122 f20 (unsigned int x
, int y
__attribute__((unused
)))
124 return (x
>> 1) ^ (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
128 f21 (unsigned short int x
, unsigned int y
)
130 return (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) ^ (x
<< y
);
134 f22 (unsigned short int x
, unsigned long int y
)
136 return (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) ^ (x
<< y
);
140 f23 (unsigned char x
, unsigned int y
)
142 return (x
>> (__CHAR_BIT__
- y
)) ^ (x
<< y
);
146 f24 (unsigned char x
, unsigned long int y
)
148 return (x
>> (__CHAR_BIT__
- y
)) ^ (x
<< y
);
152 f25 (unsigned int x
, unsigned int y
)
154 return (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
)) ^ (x
<< y
);
158 f26 (unsigned int x
, unsigned long int y
)
160 return (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
)) ^ (x
<< y
);
164 f27 (unsigned int x
, int y
__attribute__((unused
)))
166 return (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1)) ^ (x
<< 1);
170 f28 (unsigned int x
, int y
__attribute__((unused
)))
172 return (x
>> 1) ^ (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1));
176 f29 (unsigned short int x
, unsigned int y
)
178 return (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
)) ^ (x
<< y
);
182 f30 (unsigned short int x
, unsigned long int y
)
184 return (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
)) ^ (x
<< y
);
188 f31 (unsigned char x
, unsigned int y
)
190 return (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
)) ^ (x
<< y
);
194 f32 (unsigned char x
, unsigned long int y
)
196 return (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
)) ^ (x
<< y
);
200 f33 (unsigned int x
, unsigned int y
)
202 return (x
>> y
) | (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
206 f34 (unsigned int x
, unsigned long int y
)
208 return (x
>> y
) | (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
212 f35 (unsigned int x
, int y
__attribute__((unused
)))
214 return (x
>> 1) | (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
218 f36 (unsigned int x
, int y
__attribute__((unused
)))
220 return (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) | (x
<< 1);
224 f37 (unsigned short int x
, unsigned int y
)
226 return (x
>> y
) | (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
230 f38 (unsigned short int x
, unsigned long int y
)
232 return (x
>> y
) | (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
236 f39 (unsigned char x
, unsigned int y
)
238 return (x
>> y
) | (x
<< (__CHAR_BIT__
- y
));
242 f40 (unsigned char x
, unsigned long int y
)
244 return (x
>> y
) | (x
<< (__CHAR_BIT__
- y
));
248 f41 (unsigned int x
, unsigned int y
)
250 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
));
254 f42 (unsigned int x
, unsigned long int y
)
256 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
));
260 f43 (unsigned int x
, int y
__attribute__((unused
)))
262 return (x
>> 1) | (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1));
266 f44 (unsigned int x
, int y
__attribute__((unused
)))
268 return (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1)) | (x
<< 1);
272 f45 (unsigned short int x
, unsigned int y
)
274 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
));
278 f46 (unsigned short int x
, unsigned long int y
)
280 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
));
284 f47 (unsigned char x
, unsigned int y
)
286 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
));
290 f48 (unsigned char x
, unsigned long int y
)
292 return (x
>> y
) | (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
));
296 f49 (unsigned int x
, unsigned int y
)
298 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) ^ (x
>> y
);
302 f50 (unsigned int x
, unsigned long int y
)
304 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) ^ (x
>> y
);
308 f51 (unsigned int x
, int y
__attribute__((unused
)))
310 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) ^ (x
>> 1);
314 f52 (unsigned int x
, int y
__attribute__((unused
)))
316 return (x
<< 1) ^ (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
320 f53 (unsigned short int x
, unsigned int y
)
322 return (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) ^ (x
>> y
);
326 f54 (unsigned short int x
, unsigned long int y
)
328 return (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) ^ (x
>> y
);
332 f55 (unsigned char x
, unsigned int y
)
334 return (x
<< (__CHAR_BIT__
- y
)) ^ (x
>> y
);
338 f56 (unsigned char x
, unsigned long int y
)
340 return (x
<< (__CHAR_BIT__
- y
)) ^ (x
>> y
);
344 f57 (unsigned int x
, unsigned int y
)
346 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
)) ^ (x
>> y
);
350 f58 (unsigned int x
, unsigned long int y
)
352 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
)) ^ (x
>> y
);
356 f59 (unsigned int x
, int y
__attribute__((unused
)))
358 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1)) ^ (x
>> 1);
362 f60 (unsigned int x
, int y
__attribute__((unused
)))
364 return (x
<< 1) ^ (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1));
368 f61 (unsigned short int x
, unsigned int y
)
370 return (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
)) ^ (x
>> y
);
374 f62 (unsigned short int x
, unsigned long int y
)
376 return (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
)) ^ (x
>> y
);
380 f63 (unsigned char x
, unsigned int y
)
382 return (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
)) ^ (x
>> y
);
386 f64 (unsigned char x
, unsigned long int y
)
388 return (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
)) ^ (x
>> y
);
392 f65 (unsigned int x
, unsigned int y
)
394 return (x
<< y
) + (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
398 f66 (unsigned int x
, unsigned long int y
)
400 return (x
<< y
) + (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- y
));
404 f67 (unsigned int x
, int y
__attribute__((unused
)))
406 return (x
<< 1) + (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
410 f68 (unsigned int x
, int y
__attribute__((unused
)))
412 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) + (x
>> 1);
416 f69 (unsigned short int x
, unsigned int y
)
418 return (x
<< y
) + (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
422 f70 (unsigned short int x
, unsigned long int y
)
424 return (x
<< y
) + (x
>> (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
));
428 f71 (unsigned char x
, unsigned int y
)
430 return (x
<< y
) + (x
>> (__CHAR_BIT__
- y
));
434 f72 (unsigned char x
, unsigned long int y
)
436 return (x
<< y
) + (x
>> (__CHAR_BIT__
- y
));
440 f73 (unsigned int x
, unsigned int y
)
442 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
));
446 f74 (unsigned int x
, unsigned long int y
)
448 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - y
));
452 f75 (unsigned int x
, int y
__attribute__((unused
)))
454 return (x
<< 1) + (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1));
458 f76 (unsigned int x
, int y
__attribute__((unused
)))
460 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1)) + (x
>> 1);
464 f77 (unsigned short int x
, unsigned int y
)
466 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
));
470 f78 (unsigned short int x
, unsigned long int y
)
472 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned short) - y
));
476 f79 (unsigned char x
, unsigned int y
)
478 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
));
482 f80 (unsigned char x
, unsigned long int y
)
484 return (x
<< y
) + (x
>> (__CHAR_BIT__
* sizeof (unsigned char) - y
));
488 f81 (unsigned int x
, unsigned int y
)
490 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) + (x
>> y
);
494 f82 (unsigned int x
, unsigned long int y
)
496 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- y
)) + (x
>> y
);
500 f83 (unsigned int x
, int y
__attribute__((unused
)))
502 return (x
<< (__CHAR_BIT__
* __SIZEOF_INT__
- 1)) + (x
>> 1);
506 f84 (unsigned int x
, int y
__attribute__((unused
)))
508 return (x
<< 1) + (x
>> (__CHAR_BIT__
* __SIZEOF_INT__
- 1));
512 f85 (unsigned short int x
, unsigned int y
)
514 return (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) + (x
>> y
);
518 f86 (unsigned short int x
, unsigned long int y
)
520 return (x
<< (__CHAR_BIT__
* __SIZEOF_SHORT__
- y
)) + (x
>> y
);
524 f87 (unsigned char x
, unsigned int y
)
526 return (x
<< (__CHAR_BIT__
- y
)) + (x
>> y
);
530 f88 (unsigned char x
, unsigned long int y
)
532 return (x
<< (__CHAR_BIT__
- y
)) + (x
>> y
);
536 f89 (unsigned int x
, unsigned int y
)
538 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
)) + (x
>> y
);
542 f90 (unsigned int x
, unsigned long int y
)
544 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - y
)) + (x
>> y
);
548 f91 (unsigned int x
, int y
__attribute__((unused
)))
550 return (x
<< (__CHAR_BIT__
* sizeof (unsigned int) - 1)) + (x
>> 1);
554 f92 (unsigned int x
, int y
__attribute__((unused
)))
556 return (x
<< 1) + (x
>> (__CHAR_BIT__
* sizeof (unsigned int) - 1));
560 f93 (unsigned short int x
, unsigned int y
)
562 return (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
)) + (x
>> y
);
566 f94 (unsigned short int x
, unsigned long int y
)
568 return (x
<< (__CHAR_BIT__
* sizeof (unsigned short) - y
)) + (x
>> y
);
572 f95 (unsigned char x
, unsigned int y
)
574 return (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
)) + (x
>> y
);
578 f96 (unsigned char x
, unsigned long int y
)
580 return (x
<< (__CHAR_BIT__
* sizeof (unsigned char) - y
)) + (x
>> y
);