[Bug target/44883] Combine separate shift and add instructions into a single one
carrot at google dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 9 00:04:00 GMT 2010
------- Comment #2 from carrot at google dot com 2010-07-09 00:04 -------
(In reply to comment #1)
> >So in function fwprop_addr before deciding propagate an expression should we
> also check if it is the only use of the corresponding def?
>
> It does somewhat. Though address cost might be lower for r2+r3 than just r8.
> Please make sure that fwprop_addr has the correct address cost.
>
It occurs before register allocation, it is hard to say (plus (reg 144) (reg
143)) is cheaper than (reg 137).
But the address cost looks really strange. The arm/thumb2 address cost function
is
arm_arm_address_cost (rtx x)
{
enum rtx_code c = GET_CODE (x);
if (c == PRE_INC || c == PRE_DEC || c == POST_INC || c == POST_DEC)
return 0;
if (c == MEM || c == LABEL_REF || c == SYMBOL_REF)
return 10;
if (c == PLUS)
{
if (GET_CODE (XEXP (x, 1)) == CONST_INT)
return 2;
if (ARITHMETIC_P (XEXP (x, 0)) || ARITHMETIC_P (XEXP (x, 1)))
return 3;
return 4;
}
return 6;
}
Give it a single register, the cost is 6. Give it the rtx (plus (reg 144) (reg
143)), the cost is 4. So a single register is more expensive than a plus
expression, not reasonable.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44883
More information about the Gcc-bugs
mailing list