Commit a7771f78 by Jim Wilson

(multcosts): Do not compute cost of constant power-of-two multiplies as if they were shifts.

(multcosts): Do not compute cost of constant power-of-two
multiplies as if they were shifts.  Reduce multiply cost from 5 to 3.
Delete variable insn_cost.

From-SVN: r8777
parent 50d1b7a1
...@@ -1537,38 +1537,20 @@ int ...@@ -1537,38 +1537,20 @@ int
multcosts (RTX) multcosts (RTX)
rtx RTX; rtx RTX;
{ {
/* If mult by a power of 2 then work out how we'd shift to make it */
int insn_cost = 0;
if (GET_CODE (XEXP (RTX, 1)) == CONST_INT)
{
int i = exact_log2 (INTVAL (XEXP (RTX, 1)));
if (i >= 0)
insn_cost = howshift (i);
else
insn_cost = 100000;
}
if (TARGET_SH2) if (TARGET_SH2)
{ {
/* We have a mul insn, so we can never take more than the mul and the /* We have a mul insn, so we can never take more than the mul and the
read of the mac reg, but count more because of the latency and extra reg read of the mac reg, but count more because of the latency and extra
usage */ reg usage */
if (TARGET_SMALLCODE) if (TARGET_SMALLCODE)
return 2; return 2;
if (insn_cost > 5) return 3;
return 5;
return insn_cost;
} }
/* If we we're aiming at small code, then just count the number of /* If we're aiming at small code, then just count the number of
insns in a multiply call sequence */ insns in a multiply call sequence */
if (TARGET_SMALLCODE) if (TARGET_SMALLCODE)
{ return 6;
if (insn_cost > 6)
return 6;
return insn_cost;
}
/* Otherwise count all the insns in the routine we'd be calling too */ /* Otherwise count all the insns in the routine we'd be calling too */
return 20; return 20;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment