| 1 |
/* PR tree-optimization/103660 */ |
| 2 |
/* Vector type version. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O1 -fdump-tree-forwprop2-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 t = {0,0,0,0}; \ |
| 10 |
v4si X = a < b ? a : t; \ |
| 11 |
v4si Y = a < b ? t : b; \ |
| 12 |
return (X OP Y); \ |
| 13 |
} \ |
| 14 |
v4si f_##n(v4si a, v4si b, \ |
| 15 |
v4si c, v4si d) { \ |
| 16 |
v4si t = {0,0,0,0}; \ |
| 17 |
v4si X = a < b ? c : t; \ |
| 18 |
v4si Y = a < b ? t : d; \ |
| 19 |
return (X OP Y); \ |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
funcs(|, ior) |
| 24 |
funcs(^, xor) |
| 25 |
funcs(+, plus) |
| 26 |
|
| 27 |
/* min_ior/min_xor/min_plus should produce min<a,b> or `a < b ? a : b` depending on if the target |
| 28 |
supports min on the vector type or not. */ |
| 29 |
/* f_ior/f_xor/f_plus should produce (a < b) ? c : d */ |
| 30 |
/* { dg-final { scan-tree-dump-not "bit_xor_expr, " "forwprop2" } } */ |
| 31 |
/* { dg-final { scan-tree-dump-not "bit_ior_expr, " "forwprop2" } } */ |
| 32 |
/* { dg-final { scan-tree-dump-not "plus_expr, " "forwprop2" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-not "bit_ior_expr, " "forwprop2" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-times "(?:lt_expr|min_expr), " 6 "forwprop2" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-times "(?:vec_cond_expr|min_expr), " 6 "forwprop2" } } */ |