| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* PR target/109657: (a ? -1 : 0) | b could be better */ |
| 4 |
|
| 5 |
/* Both functions should have the same assembly of: |
| 6 |
cmp w1, 0 |
| 7 |
csinv w0, w0, wzr, eq |
| 8 |
|
| 9 |
We should not get: |
| 10 |
cmp w1, 0 |
| 11 |
csetm w1, ne |
| 12 |
orr w0, w1, w0 |
| 13 |
*/ |
| 14 |
/* { dg-final { scan-assembler-times "csinv\tw\[0-9\]" 2 } } */ |
| 15 |
/* { dg-final { scan-assembler-not "csetm\tw\[0-9\]" } } */ |
| 16 |
unsigned b(unsigned a, unsigned b) |
| 17 |
{ |
| 18 |
if(b) |
| 19 |
return -1; |
| 20 |
return a; |
| 21 |
} |
| 22 |
unsigned b1(unsigned a, unsigned b) |
| 23 |
{ |
| 24 |
unsigned t = b ? -1 : 0; |
| 25 |
return a | t; |
| 26 |
} |