| 1 |
/* PR tree-optimization/103660 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O1 -fdump-tree-forwprop4-raw" } */ |
| 4 |
|
| 5 |
#define funcs(OP,n) \ |
| 6 |
int min_##n(int a, int b) { \ |
| 7 |
int t; \ |
| 8 |
int t1; \ |
| 9 |
int t2; \ |
| 10 |
t1 = (a < b) * a; \ |
| 11 |
t2 = (a >= b) * b; \ |
| 12 |
t = t1 OP t2; \ |
| 13 |
return t; \ |
| 14 |
} \ |
| 15 |
int f_##n(int a, int b, int c, \ |
| 16 |
int d) { \ |
| 17 |
int t; \ |
| 18 |
int t1; \ |
| 19 |
int t2; \ |
| 20 |
t1 = (a < b) * c; \ |
| 21 |
t2 = (a >= b) * d; \ |
| 22 |
t = t1 OP t2; \ |
| 23 |
return t; \ |
| 24 |
} |
| 25 |
|
| 26 |
funcs(^, xor) |
| 27 |
funcs(+, plus) |
| 28 |
|
| 29 |
/* min_xor/min_plus should produce min<a,b> */ |
| 30 |
/* f_xor/f_plus should produce (a < b) ? c : d */ |
| 31 |
/* { dg-final { scan-tree-dump-not "bit_xor_expr, " "forwprop4" } } */ |
| 32 |
/* { dg-final { scan-tree-dump-not "plus_expr, " "forwprop4" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-times "min_expr, " 2 "forwprop4" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-times "lt_expr, " 2 "forwprop4" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-times "cond_expr, " 2 "forwprop4" } } */ |