https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Richard Biener from comment #7) > Forcing the pattern to not trigger produces the expected > > t.c:8:6: missed: not vectorized: relevant stmt not supported: iftmp.0_21 = > x.1_14 > 255 ? iftmp.0_19 : iftmp.0_20; > > since condition vectorization itself doesn't know how to handle this, we end > up at > > if (vectype1 && !useless_type_conversion_p (vectype, vectype1)) > return false; > > with vectype V32QI and vectype1 V8SI. > > Splitting out the compare from the COND_EXPR in the pattern but leaving out > the attempt to "widen" it reveals the same fact that vectorizable_condition > doesn't support packing of multiple vector defs for the mask operand. > > I think that is what we need to add. We also don't have a good > representation > for "packing" of masks. > shouldn't multi_step_cvt be supposed to handle this, just a little ambiguous between ‘vec_pack_sbool_trunc_m’ and ‘vec_pack_trunc_m’, need to make vectorizer use vec_pack_sbool_trunc_qi + vec_pack_trunc_qi to get a HI mask, just like how we pack 4 QImode to 1 SImode mask by vec_pack_trunc_qi + vec_pack_trunc_hi (in the main loop with -mprefer-vector-width=256) mask_patt_40.26_118 = vect_x.18_95 > { 255, 255, 255, 255, 255, 255, 255, 255 }; mask_patt_40.26_119 = vect_x.18_96 > { 255, 255, 255, 255, 255, 255, 255, 255 }; mask_patt_40.26_120 = vect_x.18_97 > { 255, 255, 255, 255, 255, 255, 255, 255 }; mask_patt_40.26_121 = vect_x.18_98 > { 255, 255, 255, 255, 255, 255, 255, 255 }; mask_patt_42.28_122 = VEC_PACK_TRUNC_EXPR <mask_patt_40.26_118, mask_patt_40.26_119>; mask_patt_42.28_123 = VEC_PACK_TRUNC_EXPR <mask_patt_40.26_120, mask_patt_40.26_121>; mask_patt_42.27_124 = VEC_PACK_TRUNC_EXPR <mask_patt_42.28_122, mask_patt_42.28_123>; vect_patt_43.29_125 = VEC_COND_EXPR <mask_patt_42.27_124, vect_iftmp.22_113, vect_iftmp.24_116>; iftmp.0_21 = x.1_14 > 255 ? iftmp.0_19 : iftmp.0_20;