| 1 |
/* Check that btst/btstq other than a field starting at bit 0, is used. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-not "\tand" } } */ |
| 5 |
/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */ |
| 6 |
/* { dg-final { scan-assembler-times "\tbtstq" 3 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "\tbtst " 3 } } */ |
| 8 |
|
| 9 |
void foo(void); |
| 10 |
|
| 11 |
void f(int *a) |
| 12 |
{ |
| 13 |
if ((*a & 32) != 0) |
| 14 |
foo(); |
| 15 |
} |
| 16 |
|
| 17 |
void g(short int *a) |
| 18 |
{ |
| 19 |
if ((*a & 128) == 0) |
| 20 |
foo(); |
| 21 |
} |
| 22 |
|
| 23 |
void h(char *a) |
| 24 |
{ |
| 25 |
if ((*a & 64) != 0) |
| 26 |
foo(); |
| 27 |
} |
| 28 |
|
| 29 |
void i(int *a, unsigned int n) |
| 30 |
{ |
| 31 |
if ((*a & (1 << n)) != 0) |
| 32 |
foo(); |
| 33 |
} |
| 34 |
|
| 35 |
void j(short int *a, unsigned int n) |
| 36 |
{ |
| 37 |
if ((*a & (1 << n)) == 0) |
| 38 |
foo(); |
| 39 |
} |
| 40 |
|
| 41 |
void k(char *a, unsigned int n) |
| 42 |
{ |
| 43 |
if ((*a & (1 << n)) != 0) |
| 44 |
foo(); |
| 45 |
} |