| 1 |
/* PR tree-optimization/103660 */ |
| 2 |
/* Vector type version. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O1 -fdump-tree-forwprop1-raw -Wno-psabi" } */ |
| 5 |
|
| 6 |
typedef int v4si __attribute((__vector_size__(4 * sizeof(int)))); |
| 7 |
#define funcs(OP,n) \ |
| 8 |
v4si min_##n(v4si a, v4si b) { \ |
| 9 |
v4si X = -(a < b) * a; \ |
| 10 |
v4si Y = -(a >= b) * b; \ |
| 11 |
return (X OP Y); \ |
| 12 |
} \ |
| 13 |
v4si f_##n(v4si a, v4si b, \ |
| 14 |
v4si c, v4si d) { \ |
| 15 |
v4si X = -(a < b) * c; \ |
| 16 |
v4si Y = -(a >= b) * d; \ |
| 17 |
return (X OP Y); \ |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
funcs(^, xor) |
| 22 |
funcs(+, plus) |
| 23 |
|
| 24 |
/* min_xor/min_plus should produce min<a,b> or `a < b ? a : b` depending on if the target |
| 25 |
supports min on the vector type or not. */ |
| 26 |
/* f_xor/f_plus should produce (a < b) ? c : d */ |
| 27 |
/* { dg-final { scan-tree-dump-not "bit_xor_expr, " "forwprop1" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-not "plus_expr, " "forwprop1" } } */ |
| 29 |
/* { dg-final { scan-tree-dump-times "(?:lt_expr|min_expr), " 4 "forwprop1" } } */ |
| 30 |
/* { dg-final { scan-tree-dump-times "(?:vec_cond_expr|min_expr), " 4 "forwprop1" } } */ |