https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112526
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-11-15 Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think --- gcc/config/i386/i386.md.jj 2023-11-14 21:38:38.667046713 +0100 +++ gcc/config/i386/i386.md 2023-11-15 16:06:30.638353592 +0100 @@ -9918,7 +9918,10 @@ && REGNO (operands[0]) != REGNO (operands[3]) && (REGNO (operands[0]) == REGNO (operands[4]) || REGNO (operands[0]) == REGNO (operands[5]) - || peep2_reg_dead_p (3, operands[0]))" + || peep2_reg_dead_p (3, operands[0])) + && (REGNO (operands[2]) == REGNO (operands[4]) + || REGNO (operands[2]) == REGNO (operands[5]) + || peep2_reg_dead_p (3, operands[2]))" [(set (match_dup 2) (match_dup 1)) (parallel [(set (match_dup 4) (mult:DWIH (match_dup 2) (match_dup 3))) ought to fix this. Unlike the normal imul case where the destination is always %[re]dx:%[re]ax and operands[2] must be %[re]ax, so it is naturally dead at the end and all we need is verify operands[0], in the mulx case the destination is arbitrary pair of registers, so we need to check that both operands[0] and operands[2] (the latter must be %[re]dx) are dead so that we can optimize, because we stop initializing operands[0] altogether and set operands[2] to the immediate rather than the previous value. The question is if I manage to create a small reproducer or not for the testsuite.