[Bug target/19597] [4.0 Regression] avr-gcc 4.0, multiplication by constant, very long code

roger at eyesopen dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 25 21:23:00 GMT 2005

------- Additional Comments From roger at eyesopen dot com  2005-01-25 21:23 -------
I'm currently working on an updated and improved patch that should address
some of this size regression.  Failing that there are a number of middle-end
improvements that can be made to address the code size increase.  For example,
GCC's middle-end considers any constant with an rtx_cost greater than 
COSTS_N_INSNS(1) to be expensive, and therefore worth keeping in a register
for CSE and GCSE.  Unfortunately, this plays badly with AVR, where the cost
of a register-register copy is often greater than COSTS_N_INSNS(1)!  The
solution to which is to introduce a REG_REG_MOVE_COST(mode) target macro that
can be used to report the cost of copying a pseudo and use this instead of 
COSTS_N_INSNS(1) where appropriate.  This should even help non-AVR platforms,
for example DImode typically requires two move instructions.

The change described above should avoid AVR keeping HImode integer constants
in registers and then copying them when required (its as cheap to load an
immediate constant as it is to copy registers, but the later increases register
pressure, stack frame size, etc...)



More information about the Gcc-bugs mailing list