aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-07-27 23:33:05 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-07-27 23:33:05 -0400
commit98310eaac7db6d1f1e07a30f3f9970ec1c6e2305 (patch)
tree4d254ab3adc014edb2bcde032121e8ca8ed08305 /gcc/expmed.c
parentd772039ba7150f94f5305fbab4f46a6d7a3fec75 (diff)
downloadgcc-98310eaac7db6d1f1e07a30f3f9970ec1c6e2305.zip
gcc-98310eaac7db6d1f1e07a30f3f9970ec1c6e2305.tar.gz
gcc-98310eaac7db6d1f1e07a30f3f9970ec1c6e2305.tar.bz2
(expand_mult): Properly set ADD_TARGET for add_variant.
From-SVN: r7802
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 994451a..98019ee 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2093,7 +2093,8 @@ expand_mult (mode, op0, op1, target, unsignedp)
alg = alg2, variant = negate_variant;
/* This proves very useful for division-by-constant. */
- synth_mult (&alg2, val - 1, (alg.cost < mult_cost ? alg.cost : mult_cost) - add_cost);
+ synth_mult (&alg2, val - 1,
+ (alg.cost < mult_cost ? alg.cost : mult_cost) - add_cost);
if (alg2.cost + add_cost < alg.cost)
alg = alg2, variant = add_variant;
@@ -2131,7 +2132,9 @@ expand_mult (mode, op0, op1, target, unsignedp)
int log = alg.log[opno];
int preserve = preserve_subexpressions_p ();
rtx shift_subtarget = preserve ? 0 : accum;
- rtx add_target = opno == alg.ops - 1 && target != 0 ? target : 0;
+ rtx add_target
+ = (opno == alg.ops - 1 && target != 0 && variant != add_variant
+ ? target : 0);
rtx accum_target = preserve ? 0 : accum;
switch (alg.op[opno])