| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
|
| 5 |
void bar (void); |
| 6 |
|
| 7 |
void |
| 8 |
foo(unsigned int abc123) |
| 9 |
{ |
| 10 |
unsigned int xyzpdq = (1 << abc123); |
| 11 |
if ((xyzpdq & 0x800) != 0) |
| 12 |
bar(); |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
baz(unsigned int abc123) |
| 17 |
{ |
| 18 |
unsigned int xyzpdq = (1 << abc123); |
| 19 |
if ((xyzpdq & 0x800) == 0) |
| 20 |
bar(); |
| 21 |
} |
| 22 |
|
| 23 |
/* What we want to verify is that the bit test against xyzpdq is |
| 24 |
replaced with a test against abc123 which avoids the shifting |
| 25 |
and bit ops. */ |
| 26 |
/* { dg-final { scan-tree-dump-not "xyzpdq" "optimized"} } */ |
| 27 |
/* { dg-final { scan-tree-dump-times "if .abc123" 2 "optimized"} } */ |