https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105591
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Hongtao.liu from comment #6) > Maybe we should add an canonicalization in match.pd to make sure index is in > range of 0 - 2*N, and the general code need't to do check idx % 2*N. That wouldn't work. You can't rely on optimization happening somewhere else. The VEC_PERM_EXPR operand could be substituted somewhere else and match.pd could trigger on it only later or not at all.