| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1" } */ |
| 3 |
/* { dg-final { scan-assembler-times "bclr" 6 } } */ |
| 4 |
/* { dg-final { scan-assembler-times "bset" 7 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "bnot" 7 } } */ |
| 6 |
|
| 7 |
void |
| 8 |
test_0 (char* x, unsigned int y) |
| 9 |
{ |
| 10 |
/* Expect 4x bclr here. */ |
| 11 |
x[0] &= 0xFE; |
| 12 |
x[1] = y & ~(1 << 1); |
| 13 |
x[2] &= 0xFE; |
| 14 |
x[65000] &= 0xFE; |
| 15 |
} |
| 16 |
|
| 17 |
unsigned int |
| 18 |
test_1 (unsigned int x, unsigned int y) |
| 19 |
{ |
| 20 |
/* Expect 1x bclr here. */ |
| 21 |
return x & ~(1 << y); |
| 22 |
} |
| 23 |
|
| 24 |
unsigned int |
| 25 |
test_2 (unsigned int x) |
| 26 |
{ |
| 27 |
/* Expect 1x bclr here. */ |
| 28 |
return x & ~(1 << 1); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
test_3 (char* x, unsigned int y, unsigned int z) |
| 33 |
{ |
| 34 |
/* Expect 5x bset here. */ |
| 35 |
x[0] |= 0x10; |
| 36 |
x[1] = y | (1 << 1); |
| 37 |
x[2] |= 0x10; |
| 38 |
x[65000] |= 0x10; |
| 39 |
x[5] |= 1 << z; |
| 40 |
} |
| 41 |
|
| 42 |
unsigned int |
| 43 |
test_4 (unsigned int x, unsigned int y) |
| 44 |
{ |
| 45 |
/* Expect 1x bset here. */ |
| 46 |
return x | (1 << y); |
| 47 |
} |
| 48 |
|
| 49 |
unsigned int |
| 50 |
test_5 (unsigned int x) |
| 51 |
{ |
| 52 |
/* Expect 1x bset here. */ |
| 53 |
return x | (1 << 8); |
| 54 |
} |
| 55 |
|
| 56 |
void |
| 57 |
test_6 (char* x, unsigned int y, unsigned int z) |
| 58 |
{ |
| 59 |
/* Expect 5x bnot here. */ |
| 60 |
x[0] ^= 0x10; |
| 61 |
x[1] = y ^ (1 << 1); |
| 62 |
x[2] ^= 0x10; |
| 63 |
x[65000] ^= 0x10; |
| 64 |
x[5] ^= 1 << z; |
| 65 |
} |
| 66 |
|
| 67 |
unsigned int |
| 68 |
test_7 (unsigned int x, unsigned int y) |
| 69 |
{ |
| 70 |
/* Expect 1x bnot here. */ |
| 71 |
return x ^ (1 << y); |
| 72 |
} |
| 73 |
|
| 74 |
unsigned int |
| 75 |
test_8 (unsigned int x) |
| 76 |
{ |
| 77 |
/* Expect 1x bnot here. */ |
| 78 |
return x ^ (1 << 8); |
| 79 |
} |