https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101097
--- Comment #13 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Hongtao.liu from comment #12) > (In reply to rsand...@gcc.gnu.org from comment #11) > > FWIW, you could try something similar to how aarch64 handles this > > for Advanced SIMD, with a combination of: > > > > - TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES > > - TARGET_VECTORIZE_RELATED_MODE. > I added a target_hook to return vector mode with same element number for > i386 backend. > It works for this case, but regresses many testcases which are related to > gather/scatter instructions, because gather/scatter instructions accept same > vector size but not same element number. > > /* AVX2 */ > def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv2df", > V2DF_FTYPE_V2DF_PCDOUBLE_V4SI_V2DF_INT, > IX86_BUILTIN_GATHERSIV2DF); It hits the gcc_assert in tree-vect-stmts.c:vect_build_gather_load_calls if (!useless_type_conversion_p (idxtype, TREE_TYPE (op))) { gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (TREE_TYPE (op)), TYPE_VECTOR_SUBPARTS (idxtype)));