Which of (set (reg:HI) (const_int 0)) and (set (reg:SI) (const_int 0)) is cheaper?
Jim Wilson
wilson@tuliptree.org
Sat Jun 14 20:06:00 GMT 2003
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.
It might even be reasonable to do something like this in rtx_cost in
cse.c. Currently it assumes that registers are 0 cost, regardless of
the size of the register.
Jim
More information about the Gcc
mailing list