| 1 |
/* PR tree-optimization/109424 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* Need -O2 for early non-zero bits */ |
| 4 |
/* { dg-options "-O2 -fdump-tree-forwprop1-raw -fdump-tree-optimized-raw" } */ |
| 5 |
|
| 6 |
|
| 7 |
int maxbool(int ab, int bb) |
| 8 |
{ |
| 9 |
int a = ab & 1; |
| 10 |
int b = bb & 1; |
| 11 |
int c; |
| 12 |
c = (a > b)?a : b; |
| 13 |
return c; |
| 14 |
} |
| 15 |
int minbool(int ab, int bb) |
| 16 |
{ |
| 17 |
int a = ab & 1; |
| 18 |
int b = bb & 1; |
| 19 |
int c; |
| 20 |
c = (a < b)?a : b; |
| 21 |
return c; |
| 22 |
} |
| 23 |
|
| 24 |
/* { dg-final { scan-tree-dump-not "max_expr, " "forwprop1"} } */ |
| 25 |
/* { dg-final { scan-tree-dump-not "min_expr, " "forwprop1"} } */ |
| 26 |
/* There should only be 3 total bit_and_expr, one &1 for each function and one & for minbool. */ |
| 27 |
/* { dg-final { scan-tree-dump-times "bit_and_expr, " 3 "optimized"} } */ |
| 28 |
/* { dg-final { scan-tree-dump-times "bit_ior_expr, " 1 "optimized"} } */ |