On Thu, Oct 30, 2014 at 09:56:32AM +0100, Richard Biener wrote: > > The following patch makes fold_ternary no longer make > VEC_PERMs valid for the target invalid. As pointed out > in the PR we only need to make sure this doesn't happen > after vector lowering.
Well, even if you do that before vector lowering, if the original mask is fine and new one is not, you'd seriously pessimize code. How about moving the VEC_PERM_EXPR arg2 == VECTOR_CST folding into a separate function with single_arg argument, call it with operand_equal_p (op0, op1, 0) initially and call that function again if single_arg and !can_vec_perm_p (...), that time with single_arg parameter false? Jakub