| 1 |
/* Verify that the scheduler does not discard the lexical block. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-dA" } */ |
| 4 |
/* On MIPS targets that support conditional moves, the optimal |
| 5 |
implementation of this function is: |
| 6 |
|
| 7 |
l[wd] tmp,p |
| 8 |
li $2,2 |
| 9 |
jr $31 |
| 10 |
movz $2,$0,tmp |
| 11 |
|
| 12 |
After if-conversion, we have a conditional move into a pseudo P |
| 13 |
followed a copy of P into the return register ($2). P is associated |
| 14 |
with xyzzy, so if-conversion is behaving as expected, and has not lost |
| 15 |
the variable association. The destination of the second instruction |
| 16 |
is associated with the function return value. Combine then combines |
| 17 |
these two instructions, removing the last use of P and xyzzy. |
| 18 |
|
| 19 |
Everything is behaving as expected in this scenario, so we avoid |
| 20 |
using conditional moves for this test. |
| 21 |
|
| 22 |
Similar for MMIX, with the payload insns being "LDO $0,p; ZSNZ $0,$0,2". */ |
| 23 |
/* { dg-options "-dA -fno-if-conversion" { target mips*-*-* mmix-knuth-mmixware } } */ |
| 24 |
/* { dg-final { scan-assembler "xyzzy" } } */ |
| 25 |
|
| 26 |
long p; |
| 27 |
|
| 28 |
long foo(void) |
| 29 |
{ |
| 30 |
{ |
| 31 |
long xyzzy = 0; |
| 32 |
if (p) |
| 33 |
xyzzy = 2; |
| 34 |
return xyzzy; |
| 35 |
} |
| 36 |
} |