If you can provide a testcase, I can take a look. If it isn't easy to find
a testcase, please disable the second pattern:
(define_peephole2
[(set (match_operand 0 "register_operand" "")
(match_operand 1 "register_operand" ""))
(set (match_dup 0)
(match_operator 3 "commutative_operator"
[(match_dup 0)
(match_operand 2 "memory_operand" "")]))]
"operands[0] != operands[1]
&& ((MMX_REG_P (operands[0]) && MMX_REG_P (operands[1]))
|| (SSE_REG_P (operands[0]) && SSE_REG_P (operands[1])))"
[(set (match_dup 0) (match_dup 2))
(set (match_dup 0)
(match_op_dup 3 [(match_dup 0) (match_dup 1)]))]
"")
to see if it makes a difference.