| 1 |
/* Verify that for SH2A smax/smin -> cbranch conversion is done properly |
| 2 |
if the clips insn is not used and the expected comparison insns are |
| 3 |
generated. */ |
| 4 |
/* { dg-do compile { target { sh2a } } } */ |
| 5 |
/* { dg-options "-O2" } */ |
| 6 |
/* { dg-final { scan-assembler-times "cmp/pl" 4 } } */ |
| 7 |
|
| 8 |
int |
| 9 |
test_00 (int a) |
| 10 |
{ |
| 11 |
/* 1x cmp/pl */ |
| 12 |
return a >= 0 ? a : 0; |
| 13 |
} |
| 14 |
|
| 15 |
int |
| 16 |
test_01 (int a) |
| 17 |
{ |
| 18 |
/* 1x cmp/pl */ |
| 19 |
return a <= 0 ? a : 0; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
test_02 (int a) |
| 24 |
{ |
| 25 |
/* 1x cmp/pl */ |
| 26 |
return a < 1 ? 1 : a; |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
test_03 (int a) |
| 31 |
{ |
| 32 |
/* 1x cmp/pl */ |
| 33 |
return a < 1 ? a : 1; |
| 34 |
} |