[patch] h8300: Optimize addsi_h8300.

Kazu Hirata kazu@cs.umass.edu
Wed Jan 22 18:13:00 GMT 2003


Hi Toshi,

> > > BTW, does the H8/300 port do add-splitting early or late?
> > > 
> > > We noticed on the SH that if you do add-splitting early, it
> > > interferes with CSE because the constants aren't exposed
> > > anymore...
> > > 
> > > Hopeflly this is done late?
> > 
> > By "add-splitting" do you mean splitting
> > 
> >   add.l #3,er0
> > 
> > to
> > 
> >   adds #2,er0
> >   adds #1,er0
> > 
> > If so, it is done everywhere.  The splitter does not even have
> > reload_completed.
> 
> Doh! This is exactly what I mean. 
> 
> Is it easily fixable?

Well, the pattern is as easy as

(define_split
  [(set (match_operand:HI 0 "register_operand" "")
	(plus:HI (match_dup 0)
		 (match_operand:HI 1 "two_insn_adds_subs_operand" "")))]
  ""
  [(const_int 0)]
  "split_adds_subs (HImode, operands, 0); DONE;")

So I can certainly delay this splitting with things like
reload_in_progress, reload_completed, or flow2_completed.  A quick
testing with newlib with reload_completed as the condition worsens the
code.

On SH, what constants do you split?  On H8, I only split very small
constants (3, 5, 6, 8) and their negations.  Loading one of these is
not too difficult because we can do so with 4 bytes like

  sub.l  er0,er0
  add.b  #3,er0

Kazu Hirata



More information about the Gcc-patches mailing list