https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69421
Ilya Enkovich <ienkovich at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #9 from Ilya Enkovich <ienkovich at gcc dot gnu.org> --- Here we don't check boolean values get compatible vectypes when analyze VEC_COND statement. Here statement gets V16QI mode due to boolean type size. And one of its operand gets V2DI mode because it is a result of comparison of doubles. We have patterns to catch such cases and add additional mask conversion for comparison and bit operations but don't have them for VEC_COND. Suppose vectorization of such cases should be delayed until stage1. For now this patch helps to compile both reduced and original tests: diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 1d2246d..8cb1bfe 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -7528,6 +7528,7 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi, tree vectype = STMT_VINFO_VECTYPE (stmt_info); int nunits = TYPE_VECTOR_SUBPARTS (vectype); + tree vectype1 = NULL_TREE, vectype2 = NULL_TREE; if (slp_node || PURE_SLP_STMT (stmt_info)) ncopies = 1; @@ -7547,9 +7548,19 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi, return false; gimple *def_stmt; - if (!vect_is_simple_use (then_clause, stmt_info->vinfo, &def_stmt, &dt)) + if (!vect_is_simple_use (then_clause, stmt_info->vinfo, &def_stmt, &dt, + &vectype1)) + return false; + if (!vect_is_simple_use (else_clause, stmt_info->vinfo, &def_stmt, &dt, + &vectype2)) return false; - if (!vect_is_simple_use (else_clause, stmt_info->vinfo, &def_stmt, &dt)) + + if (vectype1 + && TYPE_VECTOR_SUBPARTS (vectype1) != TYPE_VECTOR_SUBPARTS (vectype)) + return false; + + if (vectype2 + && TYPE_VECTOR_SUBPARTS (vectype2) != TYPE_VECTOR_SUBPARTS (vectype)) return false; masked = !COMPARISON_CLASS_P (cond_expr);