summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-17 20:17:54 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-17 20:17:54 +0000
commit608526907f0a02fb65a97bad4d16e13c9b962c8c (patch)
tree85ccf25f29bce00a90b36b0428c3c68b74835ba9 /gcc/expmed.c
parent41481754c30dea84669a0cf470cce266af0df21c (diff)
downloadgcc-608526907f0a02fb65a97bad4d16e13c9b962c8c.tar.gz
PR middle-end/22067
* expmed.c (expand_mult): Substitute simple register for op0 when computing max_cost. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index a58ae0ff578..292957cc3c8 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3022,6 +3022,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
&& (unsignedp || !flag_trapv))
{
HOST_WIDE_INT coeff = 0;
+ rtx reg = gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1);
/* synth_mult does an `unsigned int' multiply. As long as the mode is
less than or equal in size to `unsigned int' this doesn't matter.
@@ -3040,7 +3041,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
{
/* Its safe to use -INTVAL (op1) even for INT_MIN, as the
result is interpreted as an unsigned coefficient. */
- max_cost = rtx_cost (gen_rtx_MULT (mode, op0, op1), SET)
+ max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET)
- neg_cost[mode];
if (max_cost > 0
&& choose_mult_variant (mode, -INTVAL (op1), &algorithm,
@@ -3083,7 +3084,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
build_int_cst (NULL_TREE, floor_log2 (coeff)),
target, unsignedp);
- max_cost = rtx_cost (gen_rtx_MULT (mode, op0, op1), SET);
+ max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET);
if (choose_mult_variant (mode, coeff, &algorithm, &variant,
max_cost))
return expand_mult_const (mode, op0, coeff, target,