| 1 |
/* Check that for dynamic logical right shifts with a constant the negated |
| 2 |
constant is loaded directly, instead of loading the postitive constant |
| 3 |
and negating it separately. This was a case that happened at optimization |
| 4 |
level -O2 and looked like: |
| 5 |
cmp/eq r6,r5 |
| 6 |
mov #30,r1 |
| 7 |
neg r1,r1 |
| 8 |
shld r1,r4 |
| 9 |
mov r4,r0 |
| 10 |
rts |
| 11 |
rotcr r0 */ |
| 12 |
/* { dg-do compile { target { has_dyn_shift } } } */ |
| 13 |
/* { dg-options "-O2" } */ |
| 14 |
/* { dg-final { scan-assembler-not "neg" } } */ |
| 15 |
|
| 16 |
unsigned int |
| 17 |
test (unsigned int a, int b, int c) |
| 18 |
{ |
| 19 |
unsigned char r = b == c; |
| 20 |
return ((a >> 31) | (r << 31)); |
| 21 |
} |