Which of (set (reg:HI) (const_int 0)) and (set (reg:SI) (const_int 0)) is cheaper?
Kazu Hirata
kazu@cs.umass.edu
Sat Jun 14 21:25:00 GMT 2003
Hi Jim,
> Kazu Hirata wrote:
> > How would one know which of
> > (set (reg:HI) (const_int 0))
> > and
> > (set (reg:SI) (const_int 0))
> > is cheaper?
>
> One doesn't. It is a historical error that constants don't have modes,
> and changing it now would be very hard. However, it is a fairly safe
> assumption that SImode moves are more expensive than HImode moves if
> registers are HImode. This is something you can check for. At its
> simplest, you could check UNITS_PER_WORD and assume anything larger is
> more expensive than anything same sized or smaller.
Thanks. Actually, I wanted to find a case where loading a constant in
a larger mode is as cheap as in a smaller mode (for a special constant
like 0) to tune move2add a little bit.
Kazu Hirata
More information about the Gcc
mailing list