| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-original" } */ |
| 3 |
|
| 4 |
/* x & ~(x & y) -> x & ~y */ |
| 5 |
int fn1 (int x, int y) |
| 6 |
{ |
| 7 |
return x & ~(x & y); |
| 8 |
} |
| 9 |
int fn2 (int x, int y) |
| 10 |
{ |
| 11 |
return ~(x & y) & x; |
| 12 |
} |
| 13 |
int fn3 (int x, int y) |
| 14 |
{ |
| 15 |
return x & ~(y & x); |
| 16 |
} |
| 17 |
int fn4 (int x, int y) |
| 18 |
{ |
| 19 |
return ~(y & x) & x; |
| 20 |
} |
| 21 |
int fn5 (int z) |
| 22 |
{ |
| 23 |
return z & ~(z & 3); |
| 24 |
} |
| 25 |
int fn6 (int z) |
| 26 |
{ |
| 27 |
return ~(z & 3) & z; |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
/* { dg-final { scan-tree-dump-times "~y & x" 4 "original" } } */ |
| 32 |
/* { dg-final { scan-tree-dump-times "z & -4" 2 "original" } } */ |