Re: [mask-vec_cond, patch 3/2] SLP support
2015-10-19 19:05 GMT+03:00 Jeff Law : > On 10/19/2015 05:21 AM, Ilya Enkovich wrote: >> >> Hi, >> >> This patch adds missing support for cond_expr with no embedded comparison >> in SLP. No new test added because vec cmp SLP test becomes (due to changes >> in bool patterns by the first patch) a regression test for this patch. Does >> it look OK? >> >> Thanks, >> Ilya >> -- >> gcc/ >> >> 2015-10-19 Ilya Enkovich >> >> * tree-vect-slp.c (vect_get_and_check_slp_defs): Allow >> cond_exp with no embedded comparison. >> (vect_build_slp_tree_1): Likewise. > > Is it even valid gimple to have a COND_EXPR that is anything other than a > conditional? > > From looking at gimplify_cond_expr, it looks like we could have a SSA_NAME > that's a bool as the conditional. Presumably we're allowing a vector of > bools as the conditional once we hit the vectorizer, which seems fairly > natural. Currently vectorizer doesn't handle such COND_EXPR and never produces VEC_COND_EXPR with SSA_NAME as a condition. Expand treats such VEC_COND_EXPR as implicit (OP < 0) case (we just have no optab to expand it with no comparison). But the first patch in this series[1] allows such conditions to enable re-using vector comparison result by multiple VEC_COND_EXPRs. > > OK. Please install when the prerequisites are installed. > > Thanks, > jeff > Thanks! Ilya [1] https://gcc.gnu.org/ml/gcc-patches/2015-10/msg00862.html
Re: [mask-vec_cond, patch 3/2] SLP support
On 10/19/2015 05:21 AM, Ilya Enkovich wrote: Hi, This patch adds missing support for cond_expr with no embedded comparison in SLP. No new test added because vec cmp SLP test becomes (due to changes in bool patterns by the first patch) a regression test for this patch. Does it look OK? Thanks, Ilya -- gcc/ 2015-10-19 Ilya Enkovich * tree-vect-slp.c (vect_get_and_check_slp_defs): Allow cond_exp with no embedded comparison. (vect_build_slp_tree_1): Likewise. Is it even valid gimple to have a COND_EXPR that is anything other than a conditional? From looking at gimplify_cond_expr, it looks like we could have a SSA_NAME that's a bool as the conditional. Presumably we're allowing a vector of bools as the conditional once we hit the vectorizer, which seems fairly natural. OK. Please install when the prerequisites are installed. Thanks, jeff
[mask-vec_cond, patch 3/2] SLP support
Hi, This patch adds missing support for cond_expr with no embedded comparison in SLP. No new test added because vec cmp SLP test becomes (due to changes in bool patterns by the first patch) a regression test for this patch. Does it look OK? Thanks, Ilya -- gcc/ 2015-10-19 Ilya Enkovich * tree-vect-slp.c (vect_get_and_check_slp_defs): Allow cond_exp with no embedded comparison. (vect_build_slp_tree_1): Likewise. diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index fa8291e..48311dd 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -257,7 +257,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, { enum tree_code code = gimple_assign_rhs_code (stmt); number_of_oprnds = gimple_num_ops (stmt) - 1; - if (gimple_assign_rhs_code (stmt) == COND_EXPR) + if (gimple_assign_rhs_code (stmt) == COND_EXPR + && COMPARISON_CLASS_P (gimple_assign_rhs1 (stmt))) { first_op_cond = true; commutative = true; @@ -482,7 +483,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, machine_mode vec_mode; HOST_WIDE_INT dummy; gimple *first_load = NULL, *prev_first_load = NULL; - tree cond; /* For every stmt in NODE find its def stmt/s. */ FOR_EACH_VEC_ELT (stmts, i, stmt) @@ -527,24 +527,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, return false; } - if (is_gimple_assign (stmt) - && gimple_assign_rhs_code (stmt) == COND_EXPR - && (cond = gimple_assign_rhs1 (stmt)) - && !COMPARISON_CLASS_P (cond)) -{ - if (dump_enabled_p ()) -{ - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "Build SLP failed: condition is not " - "comparison "); - dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); - dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); -} - /* Fatal mismatch. */ - matches[0] = false; - return false; -} - scalar_type = vect_get_smallest_scalar_type (stmt, &dummy, &dummy); vectype = get_vectype_for_scalar_type (scalar_type); if (!vectype)