Hi Richard,
 
When -Os is used  and the multiplier is of the for 2^N +- 1 we generate a MUL 
instruction
rather that a  shift-left   N and add-sub 1.
 
The problem is that rtx cost for the MUL is too cheap causing the shift-left 
and add-sub sequence
to be  more expensive.
 
This patch makes the MUL slightly more expension so the alternate sequence and 
better sequence
used. The shift + add/sub is faster and can probaly be scheduled better.
 
This change is code size neutral because the MUL requires a load-immediate.
 
ChangeLog:
        * config/mips/mips.c: (mips_rtx_costs): Slightly increase cost of MUL 
when optimizing
       for size. This allows a better sequence to be choosen when multiply by a 
constant of the
        form 2^N +- 1.
 
Graham

Attachment: mips.c.diff
Description: Binary data



Reply via email to