aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1992-08-17 07:34:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1992-08-17 07:34:23 -0400
commit2c414fba8efe097c221d1f643404ae1b753720ac (patch)
tree2be9f00ca70dcb2322341e438e7cebc4c7aac7d1 /gcc
parent05c0fbb8bcbee55bf0b21bd1eb8201f2fda07240 (diff)
downloadgcc-2c414fba8efe097c221d1f643404ae1b753720ac.zip
gcc-2c414fba8efe097c221d1f643404ae1b753720ac.tar.gz
gcc-2c414fba8efe097c221d1f643404ae1b753720ac.tar.bz2
(expand_mult): Bound second synth_mult cost by cost of algorithm from
first call. (expand_divmod): When doing logical operations, the size of COMPUTE_MODE should be used, not MODE. From-SVN: r1869
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expmed.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 5b6ed4d..2534f57 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1982,7 +1982,8 @@ expand_mult (mode, op0, op1, target, unsignedp)
alg = synth_mult (absval, add_cost, shift_cost, mult_cost);
neg_alg = synth_mult (- absval, add_cost, shift_cost,
- mult_cost - negate_cost);
+ (alg.cost >= 0 ? alg.cost : mult_cost)
+ - negate_cost);
if (neg_alg.cost >= 0 && neg_alg.cost + negate_cost < alg.cost)
alg = neg_alg, negate = 1, absval = - absval;
@@ -2151,6 +2152,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
register rtx result = 0;
enum machine_mode compute_mode;
int log = -1;
+ int size;
int can_clobber_op0;
int mod_insn_no_good = 0;
rtx adjusted_op0 = op0;
@@ -2247,6 +2249,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
if (compute_mode == VOIDmode)
compute_mode = mode;
+ size = GET_MODE_BITSIZE (compute_mode);
+
/* Now convert to the best mode to use. Show we made a copy of OP0
and hence we can clobber it (we cannot use a SUBREG to widen
something. */
@@ -2299,8 +2303,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
temp = expand_shift (RSHIFT_EXPR, compute_mode, temp,
build_int_2 (log - 1, 0), NULL_RTX, 0);
temp = expand_shift (RSHIFT_EXPR, compute_mode, temp,
- build_int_2 (GET_MODE_BITSIZE (mode) - log,
- 0),
+ build_int_2 (size - log, 0),
temp, 1);
expand_inc (adjusted_op0, temp);
}
@@ -2398,7 +2401,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
rtx temp = gen_reg_rtx (compute_mode);
temp = copy_to_suggested_reg (adjusted_op0, temp, compute_mode);
temp = expand_shift (RSHIFT_EXPR, compute_mode, temp,
- build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
+ build_int_2 (size - 1, 0),
NULL_RTX, 0);
op1 = expand_binop (compute_mode, xor_optab, op1, temp, op1,
unsignedp, OPTAB_LIB_WIDEN);