| 1 |
/* Check that storing the (negated) T bit as all ones or zeros in a reg |
| 2 |
uses the subc instruction. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O1 -mbranch-cost=2" } */ |
| 5 |
/* { dg-final { scan-assembler-not "movt|tst|negc|movrt" } } */ |
| 6 |
/* { dg-final { scan-assembler-times "subc" 3 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "not\t" 1 } } */ |
| 8 |
/* { dg-final { scan-assembler-times "shll" 1 } } */ |
| 9 |
/* { dg-final { scan-assembler-not "cmp/gt" } } */ |
| 10 |
|
| 11 |
int |
| 12 |
test_00 (int x, int y) |
| 13 |
{ |
| 14 |
/* 1x subc, 1x not */ |
| 15 |
return x != y ? -1 : 0; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
test_01 (int x, int y) |
| 20 |
{ |
| 21 |
/* 1x subc */ |
| 22 |
return x == y ? -1 : 0; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
test_02 (int x) |
| 27 |
{ |
| 28 |
/* 1x shll, 1x subc */ |
| 29 |
return 0 <= x ? 0 : -1; |
| 30 |
} |