https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98211
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |duanbo3 at huawei dot com, | |rsandifo at gcc dot gnu.org --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, ICEs all over the place as expected. Btw, on the GCC 10 branch we had diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 6a5f9505792..52725f826c7 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -4452,16 +4452,7 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, if (TREE_CODE (rhs1) != SSA_NAME) { tmp = vect_recog_temp_ssa_var (TREE_TYPE (rhs1), NULL); - if (rhs1_op0_type - && TYPE_PRECISION (rhs1_op0_type) != TYPE_PRECISION (rhs1_type)) - rhs1_op0 = build_mask_conversion (vinfo, rhs1_op0, - vectype2, stmt_vinfo); - if (rhs1_op1_type - && TYPE_PRECISION (rhs1_op1_type) != TYPE_PRECISION (rhs1_type)) - rhs1_op1 = build_mask_conversion (vinfo, rhs1_op1, - vectype2, stmt_vinfo); - pattern_stmt = gimple_build_assign (tmp, TREE_CODE (rhs1), - rhs1_op0, rhs1_op1); + pattern_stmt = gimple_build_assign (tmp, rhs1); rhs1 = tmp; append_pattern_def_seq (vinfo, stmt_vinfo, pattern_stmt, vectype2, rhs1_type); and going back fixes the issue as well. That was changed by g:91d80cf4bd28, approved by Richard. That said, using build_mask_conversion on sth not already a mask is definitely wrong as can be seen here. The above conversions should, according to the revs comment, only happen when rhs1_op0_type != rhs1_op1_type (those are scalar types here - but revs comment says vector types mismatch). That said, if we throw bool patterns ontop of the mask conversion one we end up not vectorizing the thing because x3.c:23:9: note: ==> examining statement: patt_22 = _28 ? 1 : 0; x3.c:6:1: missed: not vectorized: relevant stmt not supported: patt_22 = _28 ? 1 : 0; which is because vect_is_simple_cond runs into /* Mask case. */ if (TREE_CODE (cond) == SSA_NAME && VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (cond))) { if (!vect_is_simple_use (vinfo, stmt_info, slp_node, 0, &cond, &slp_op, &dts[0], comp_vectype) || !*comp_vectype || !VECTOR_BOOLEAN_TYPE_P (*comp_vectype)) return false; so I guess that should end up as mask conversion pattern as well, recursively. Meh.