https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> --- > And GCC vectorizer only handle 2X elements, but not 4X,8X,... > > /* For scalar masks we may have different boolean > vector types having the same QImode. Thus we > add additional check for elements number. */ > if (known_eq (TYPE_VECTOR_SUBPARTS (vectype) * 2, > TYPE_VECTOR_SUBPARTS (narrow_vectype))) We can have vec_pack_trunc_qi + vec_pack_sbool_trunc_qi by extending vec_pack_sbool_trunc_qi to handle 8/4, 4/2, 2/1 vectype_out/vectype_in elements.