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

            Bug ID: 68635
           Summary: IRA: Should update cost when choose an alternative for
                    an insn?
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Abnerkook at foxmail dot com
  Target Milestone: ---

When I write a pattern for addsi3 as follows:
(define_insn "addsi3"
  [(set (match_operand:SI 0 "register_operand" "=r,r")
        (plus:SI (match_operand:SI 1 "register_operand" "zra,zrb")
                 (match_operand:SI 2 "register_operand" "zra,zrb")))])

Here, zra and zrb are non-intersect regclass, the selection of alternative is
decided by the register allocation.

But, sometimes when IRA choosing regclass for operand 2 after already allocated
zra to operand 1, because zrb's cost is less than zra, IRA choose zrb for
operand 2. To obey the constraint, additional move insn will be emitted which
we not expect.

So, updating cost when choose an alternative for an insn will be better for
this case? Or, is there some methods to advoid this case?

Please give me some advice, I shall be very grateful. Sorry for my poor
English.

Reply via email to