define_peepholes in mn10300

Paolo Bonzini bonzini@gnu.org
Mon Oct 18 17:45:00 GMT 2010


> It's been a long time since I dealt with this aspect of porting, but
> isn't it the case that most ports don't expose branch-on-carry-set
> branch-on-carry-clear? It looks like the mn103 was recently changed to
> not use cc0, which is definitely a good thing. I'm not sure offhand the
> best way to recode this optimization in that new world.

It was removed there, but I would just use a new define_insn producing
more than one instruction, like

(define_insn "cbranch_si_ge0_clobber"
   (set (pc)
       (if_then_else
               (ge [(match_operand:SI 0 "register_operand" "+dx")
                    (const_int 0)])
               (label_ref (match_operand 1 ""))
               (pc)))
   (clobber (match_dup 0))
   (clobber (reg:CC CC_REG))]
   "add %0, %0\;bcc %1"
   [(set_attr "cc", "clobber")])

and likewise for bcs.  While not many, there are some instances of this 
in the port.

Paolo



More information about the Gcc mailing list