https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 13 Jan 2022, rsandifo at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771 > > --- Comment #9 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> > --- > (In reply to Richard Biener from comment #7) > > I think that is what we need to add. We also don't have a good > > representation > > for "packing" of masks. > > > > diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c > > index 3ea905538e1..729a1d32612 100644 > > --- a/gcc/tree-vect-patterns.c > > +++ b/gcc/tree-vect-patterns.c > > @@ -4679,8 +4679,10 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, > > rhs1_type); > > } > > > > - if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype1), > > - TYPE_VECTOR_SUBPARTS (vectype2))) > > + /* AVX512 style masks cannot be packed/unpacked. */ > > + if (TYPE_PRECISION (TREE_TYPE (vectype2)) != 1 > > + && maybe_ne (TYPE_VECTOR_SUBPARTS (vectype1), > > + TYPE_VECTOR_SUBPARTS (vectype2))) > > tmp = build_mask_conversion (vinfo, rhs1, vectype1, stmt_vinfo); > > else > > tmp = rhs1; > Haven't had time to look at it properly yet, but my first impression > is that that's likely to regress SVE. Packing and unpacking are > natural operations on boolean vector modes. Sure, but we can't produce scalar code mimicking this for 1 bit element vectors. It "works" for the others because based on the width of the elements we choose a vector with different number of elements. But here the pattern produces a 8 bit element which isn't want is desired here.