https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112661
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 56668 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56668&action=edit patch (not working) So this tries this, moving the duplicate-and-interleave check and changing code generation. It seems though that gimple_build_vector_from_val only uses VEC_DUPLICATE_EXPR for non-constants but tree-vector-builder doesn't like to build the uniform constant and we ICE: internal compiler error: in finalize, at vector-builder.h:513 0x1e36958 vector_builder<tree_node*, tree_node*, tree_vector_builder>::finalize() /space/rguenther/src/gcc/gcc/vector-builder.h:513 0x1e36598 tree_vector_builder::build() /space/rguenther/src/gcc/gcc/tree-vector-builder.cc:42 0x15dc80a gimple_build_vector(gimple_stmt_iterator*, bool, gsi_iterator_update, unsigned int, tree_vector_builder*) /space/rguenther/src/gcc/gcc/gimple-fold.cc:9256 0x1ddb2e7 gimple_build_vector(gimple**, tree_vector_builder*) /space/rguenther/src/gcc/gcc/gimple-fold.h:241 0x1e0d6f5 vect_create_constant_vectors /space/rguenther/src/gcc/gcc/tree-vect-slp.cc:8261 that's the assert 508 void 509 vector_builder<T, Shape, Derived>::finalize () 510 { 511 /* The encoding requires the same number of elements to come from each 512 pattern. */ 513 gcc_assert (multiple_p (m_full_nelts, m_npatterns)); I can of course try to manually build a VEC_DUPLICATE here but I wonder if we're on the right track here.