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 <enkovich....@gmail.com> * 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)