| 1 |
/* Check that compare-branch is inverted properly. |
| 2 |
Example: |
| 3 |
mov #1,r0 -> tst r8,r8 |
| 4 |
neg r8,r1 bt .L47 |
| 5 |
shad r1,r0 |
| 6 |
tst #1,r0 |
| 7 |
bf .L47 |
| 8 |
*/ |
| 9 |
/* { dg-do compile } */ |
| 10 |
/* { dg-options "-O2" } */ |
| 11 |
/* { dg-final { scan-assembler-not "shad|neg" } } */ |
| 12 |
|
| 13 |
int test_01_00 (int*, void*); |
| 14 |
int |
| 15 |
test_01 (int* m, void* v) |
| 16 |
{ |
| 17 |
unsigned long n = (unsigned long)v - 1; |
| 18 |
|
| 19 |
if (!n) |
| 20 |
return 50; |
| 21 |
|
| 22 |
if (1 & (1 << n)) /* if n == 0: 1 & (1 << 0) -> true */ |
| 23 |
return 60; |
| 24 |
else /* if n != 0: 1 & (1 << n) -> false */ |
| 25 |
return -8; |
| 26 |
} |