https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109230
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/match.pd.jj 2023-02-18 12:38:30.967022708 +0100 +++ gcc/match.pd 2023-03-21 17:24:54.964665797 +0100 @@ -8096,6 +8096,7 @@ and, scalar_mode inner_mode = GET_MODE_INNER (vec_mode); } (if (sel.series_p (0, 2, 0, 2) + && sel.series_p (1, 2, nelts + 1, 2) && GET_MODE_2XWIDER_MODE (inner_mode).exists (&wide_elt_mode) && multiple_p (GET_MODE_NUNITS (vec_mode), 2, &wide_nunits) && related_vector_mode (vec_mode, wide_elt_mode, seems to indeed fix this.