https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63666
--- Comment #12 from Marc Glisse <glisse at gcc dot gnu.org> --- (I am traveling this week, so I can only post a short comment) (In reply to Richard Biener from comment #11) > - if (need_mask_canon && arg2 == op2) > + if (need_mask_canon && arg2 == op2 > + && can_vec_perm_p (TYPE_MODE (type), false, sel)) seems reasonable, though if we didn't have can_vec_perm_p before the transformation (which implies we are before vector lowering) we should probably still transform. Also, I believe that targets should try to support single argument permutations when they support a 2 argument version that degenerates to it when both arguments are the same. By the way, from a quick look, I don't see where we protect against TREE_SIDE_EFFECTS(op0) when doing op0=op1 or op1=op0 in this code, I don't remember if there is a reason why it isn't needed.