[PATCH][expmed] Calculate mult-by-const cost properly in mult_by_coeff_cost

Kyrill Tkachov kyrylo.tkachov@arm.com
Mon Mar 16 10:13:00 GMT 2015


Hi all,

Eyeballing the mult_by_coeff_cost function I think it has a typo/bug.
It's supposed to return the cost of multiplying by a constant 'coeff'.
It calculates that by taking the cost of a MULT rtx by that constant
and comparing it to the cost of synthesizing that multiplication, and 
returning
the cheapest. However, in the MULT rtx cost calculations it creates
a MULT rtx of two REGs rather than the a REG and the GEN_INT of coeff as 
I would
expect. This patches fixes that in the obvious way.

Tested aarch64-none-elf and bootstrapped on x86_64-linux-gnu.
I'm guessing this is stage 1 material at this point?

Thanks,
Kyrill

2015-03-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * expmed.c (mult_by_coeff_cost): Pass CONT_INT rtx to MULT cost
     calculation rather than fake_reg.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: expmed-mult-by-coeff.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150316/cb0b7297/attachment.bin>


More information about the Gcc-patches mailing list