| 1 |
/* PR rtl-optimization/49095 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Os -fno-shrink-wrap -masm=att" } */ |
| 4 |
/* { dg-additional-options "-mregparm=2" { target ia32 } } */ |
| 5 |
|
| 6 |
void foo (void *); |
| 7 |
|
| 8 |
int * |
| 9 |
f1 (int *x) |
| 10 |
{ |
| 11 |
if (!--*x) |
| 12 |
foo (x); |
| 13 |
return x; |
| 14 |
} |
| 15 |
|
| 16 |
int |
| 17 |
g1 (int x) |
| 18 |
{ |
| 19 |
if (!--x) |
| 20 |
foo ((void *) 0); |
| 21 |
return x; |
| 22 |
} |
| 23 |
|
| 24 |
#define F(T, OP, OPN) \ |
| 25 |
T * \ |
| 26 |
f##T##OPN (T *x, T y) \ |
| 27 |
{ \ |
| 28 |
*x OP y; \ |
| 29 |
if (!*x) \ |
| 30 |
foo (x); \ |
| 31 |
return x; \ |
| 32 |
} \ |
| 33 |
\ |
| 34 |
T \ |
| 35 |
g##T##OPN (T x, T y) \ |
| 36 |
{ \ |
| 37 |
x OP y; \ |
| 38 |
if (!x) \ |
| 39 |
foo ((void *) 0); \ |
| 40 |
return x; \ |
| 41 |
} \ |
| 42 |
\ |
| 43 |
T * \ |
| 44 |
h##T##OPN (T *x) \ |
| 45 |
{ \ |
| 46 |
*x OP 24; \ |
| 47 |
if (!*x) \ |
| 48 |
foo (x); \ |
| 49 |
return x; \ |
| 50 |
} \ |
| 51 |
\ |
| 52 |
T \ |
| 53 |
i##T##OPN (T x, T y) \ |
| 54 |
{ \ |
| 55 |
x OP 24; \ |
| 56 |
if (!x) \ |
| 57 |
foo ((void *) 0); \ |
| 58 |
return x; \ |
| 59 |
} |
| 60 |
|
| 61 |
#define G(T) \ |
| 62 |
F (T, +=, plus) \ |
| 63 |
F (T, -=, minus) \ |
| 64 |
F (T, &=, and) \ |
| 65 |
F (T, |=, or) \ |
| 66 |
F (T, ^=, xor) |
| 67 |
|
| 68 |
G (char) |
| 69 |
G (short) |
| 70 |
G (int) |
| 71 |
G (long) |
| 72 |
|
| 73 |
/* { dg-final { scan-assembler-not "test\[lq\]" } } */ |
| 74 |
/* { dg-final { scan-assembler-not "\\(%eax\\), %" { target { ia32 } } } } */ |
| 75 |
/* { dg-final { scan-assembler-not "\\(%\[re\]di\\), %" { target { ! ia32 } } } } */ |