| 1 |
/* Check that eliminable compare-instructions are eliminated. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */ |
| 5 |
/* { dg-final { scan-assembler "\tlsr|\tsmi" } } */ |
| 6 |
|
| 7 |
/* Regarding the "lsr", see pr93372-2.c; we get a shift for the |
| 8 |
sign-bit. For "<", that's equally optimal to smi; we just want this |
| 9 |
test to be different with the "<" instead of ">=". */ |
| 10 |
|
| 11 |
int f(int a, int b, int *d) |
| 12 |
{ |
| 13 |
int c = a + b; |
| 14 |
|
| 15 |
*d = (c == 0); |
| 16 |
|
| 17 |
return c < 0; |
| 18 |
} |