https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107404

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu.org,
                   |                            |uros at gcc dot gnu.org
             Status|ASSIGNED                    |NEW
           Assignee|rsandifo at gcc dot gnu.org        |unassigned at gcc dot 
gnu.org

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
This is due to the peephole2 added in r12-2640-gf7bf03cf69cc:

;; Eliminate a reg-reg mov by inverting the condition of a cmov (#2).
;; mov r2,r3; mov r0,r1; dec r0; cmov r0,r2 -> dec r1; mov r0,r3; cmov r0, r1
(define_peephole2
 [(set (match_operand:SWI248 2 "general_reg_operand")
       (match_operand:SWI248 3 "general_gr_operand"))
  (set (match_operand:SWI248 0 "general_reg_operand")
       (match_operand:SWI248 1 "general_reg_operand"))
  (parallel [(set (reg FLAGS_REG) (match_operand 5))
             (set (match_dup 0) (match_operand:SWI248 6))])
  (set (match_dup 0)
       (if_then_else:SWI248 (match_operator 4 "ix86_comparison_operator"
                             [(reg FLAGS_REG) (const_int 0)])
        (match_dup 0)
        (match_dup 2)))]
 "TARGET_CMOVE
  && REGNO (operands[2]) != REGNO (operands[0])
  && REGNO (operands[2]) != REGNO (operands[1])
  && peep2_reg_dead_p (2, operands[1])
  && peep2_reg_dead_p (4, operands[2])
  && !reg_overlap_mentioned_p (operands[0], operands[3])"
 [(parallel [(set (match_dup 7) (match_dup 8))
             (set (match_dup 1) (match_dup 9))])
  (set (match_dup 0) (match_dup 3))
  (set (match_dup 0) (if_then_else:SWI248 (match_dup 4)
                                          (match_dup 1)
                                          (match_dup 0)))]
{
  operands[7] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (2)), 0, 0));
  operands[8] = replace_rtx (operands[5], operands[0], operands[1], true);
  operands[9] = replace_rtx (operands[6], operands[0], operands[1], true);
})

The conditions make sure that the 2<-3 and 0<-1 moves are independent,
but they don't check what effect the 2<-3 move has on the third
instruction.  I don't know if the intention was to exclude cases
where operands 5 and 6 reference operand 2, or whether the intention
was to cope with those cases where possible.

Reply via email to