| 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 |
|
| 6 |
#ifndef t |
| 7 |
#define t int |
| 8 |
#endif |
| 9 |
#ifndef t2 |
| 10 |
#define t2 t |
| 11 |
#endif |
| 12 |
#ifndef op |
| 13 |
#define op(x) ~(x) |
| 14 |
#endif |
| 15 |
|
| 16 |
extern void foo(t2); |
| 17 |
|
| 18 |
t2 f(t a, t2 *b, t2 *d) |
| 19 |
{ |
| 20 |
t2 c = op(a); |
| 21 |
|
| 22 |
*b = c; |
| 23 |
|
| 24 |
if (c != 0) |
| 25 |
*d = c; |
| 26 |
|
| 27 |
return c; |
| 28 |
} |
| 29 |
|
| 30 |
t2 g(t a, t2 *b, t2 *d) |
| 31 |
{ |
| 32 |
t2 c = op(a); |
| 33 |
|
| 34 |
*b = c; |
| 35 |
|
| 36 |
if (c <= 0) |
| 37 |
*d = c; |
| 38 |
|
| 39 |
return c; |
| 40 |
} |