| 1 |
/* PR target/82498 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-original" } */ |
| 4 |
/* { dg-final { scan-tree-dump-times "x r<< y" 4 "original" { target int32 } } } */ |
| 5 |
/* { dg-final { scan-tree-dump-times "x r>> y" 4 "original" { target int32 } } } */ |
| 6 |
|
| 7 |
unsigned |
| 8 |
f1 (unsigned x, int y) |
| 9 |
{ |
| 10 |
return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)); |
| 11 |
} |
| 12 |
|
| 13 |
unsigned |
| 14 |
f2 (unsigned x, int y) |
| 15 |
{ |
| 16 |
return (x << y) | (x >> (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); |
| 17 |
} |
| 18 |
|
| 19 |
unsigned |
| 20 |
f3 (unsigned x, int y) |
| 21 |
{ |
| 22 |
return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)); |
| 23 |
} |
| 24 |
|
| 25 |
unsigned |
| 26 |
f4 (unsigned x, int y) |
| 27 |
{ |
| 28 |
return (x >> y) | (x << (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))); |
| 29 |
} |
| 30 |
|
| 31 |
unsigned |
| 32 |
f5 (unsigned x, int y) |
| 33 |
{ |
| 34 |
return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) | (x << y); |
| 35 |
} |
| 36 |
|
| 37 |
unsigned |
| 38 |
f6 (unsigned x, int y) |
| 39 |
{ |
| 40 |
return (x >> (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x << y); |
| 41 |
} |
| 42 |
|
| 43 |
unsigned |
| 44 |
f7 (unsigned x, int y) |
| 45 |
{ |
| 46 |
return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) | (x >> y); |
| 47 |
} |
| 48 |
|
| 49 |
unsigned |
| 50 |
f8 (unsigned x, int y) |
| 51 |
{ |
| 52 |
return (x << (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x >> y); |
| 53 |
} |