| 1 |
/* PR tree-optimization/103660 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O1 -fgimple -fdump-tree-forwprop4-raw" } */ |
| 4 |
|
| 5 |
#define funcs(OP,n) \ |
| 6 |
__GIMPLE() \ |
| 7 |
int min_##n(int a, int b) { \ |
| 8 |
_Bool X; \ |
| 9 |
_Bool Y; \ |
| 10 |
int t; \ |
| 11 |
int t1; \ |
| 12 |
int t2; \ |
| 13 |
X = a < b; \ |
| 14 |
Y = a >= b; \ |
| 15 |
t1 = X ? a : 0; \ |
| 16 |
t2 = Y ? b : 0; \ |
| 17 |
t = t1 OP t2; \ |
| 18 |
return t; \ |
| 19 |
} \ |
| 20 |
__GIMPLE() \ |
| 21 |
int f_##n(int a, int b, int c, \ |
| 22 |
int d) { \ |
| 23 |
_Bool X; \ |
| 24 |
_Bool Y; \ |
| 25 |
int t; \ |
| 26 |
int t1; \ |
| 27 |
int t2; \ |
| 28 |
X = a < b; \ |
| 29 |
Y = a >= b; \ |
| 30 |
t1 = X ? c : 0; \ |
| 31 |
t2 = Y ? d : 0; \ |
| 32 |
t = t1 OP t2; \ |
| 33 |
return t; \ |
| 34 |
} |
| 35 |
|
| 36 |
funcs(|, ior) |
| 37 |
|
| 38 |
/* min_ior should produce min<a,b> */ |
| 39 |
/* f_ior should produce (a < b) ? c : d */ |
| 40 |
/* { dg-final { scan-tree-dump-not "bit_ior_expr, " "forwprop4" } } */ |
| 41 |
/* { dg-final { scan-tree-dump-times "min_expr, " 1 "forwprop4" } } */ |
| 42 |
/* { dg-final { scan-tree-dump-times "lt_expr, " 1 "forwprop4" } } */ |
| 43 |
/* { dg-final { scan-tree-dump-times "cond_expr, " 1 "forwprop4" } } */ |