| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
int test_sal (int a, int c) |
| 5 |
{ |
| 6 |
return a << (c & 0x1f); |
| 7 |
} |
| 8 |
|
| 9 |
int test_sar (int a, int c) |
| 10 |
{ |
| 11 |
return a >> (c & 0x1f); |
| 12 |
} |
| 13 |
|
| 14 |
unsigned int test_shr (unsigned int a, int c) |
| 15 |
{ |
| 16 |
return a >> (c & 0x1f); |
| 17 |
} |
| 18 |
|
| 19 |
unsigned int test_rol (unsigned int a, int c) |
| 20 |
{ |
| 21 |
int z = c & 0x1f; |
| 22 |
return (a << z) | (a >> (32 - z)); |
| 23 |
} |
| 24 |
|
| 25 |
unsigned int test_ror (unsigned int a, int c) |
| 26 |
{ |
| 27 |
int z = c & 0x1f; |
| 28 |
return (a >> z) | (a << (32 - z)); |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-assembler-not "and" } } */ |