diff options
author | Richard Stallman <rms@gnu.org> | 1993-04-11 08:08:54 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-04-11 08:08:54 +0000 |
commit | f2dd837227913a70e3cd839c850c0346e7706950 (patch) | |
tree | acfd355da208daabdc4e008c1d65c7737fa3f342 | |
parent | 52266016a226f4dd87ae4efb1a096a06778a6f9b (diff) | |
download | gcc-f2dd837227913a70e3cd839c850c0346e7706950.zip gcc-f2dd837227913a70e3cd839c850c0346e7706950.tar.gz gcc-f2dd837227913a70e3cd839c850c0346e7706950.tar.bz2 |
(expand_divmod): When adjusting op0 for trunc_div or trunc_mod...
(expand_divmod): When adjusting op0 for trunc_div or
trunc_mod, using shifts (not branches), make a new pseudo for the
result. Don't use target for adjusted_op0.
From-SVN: r4081
-rw-r--r-- | gcc/expmed.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 68f0607..90ab40f 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2359,14 +2359,6 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) case TRUNC_DIV_EXPR: if (log >= 0 && ! unsignedp) { - if (! can_clobber_op0) - { - adjusted_op0 = copy_to_suggested_reg (adjusted_op0, target, - compute_mode); - /* Copy op0 to a reg, since emit_cmp_insn will call emit_queue - which will screw up mem refs for autoincrements. */ - op0 = force_reg (compute_mode, op0); - } /* Here we need to add OP1-1 if OP0 is negative, 0 otherwise. This can be computed without jumps by arithmetically shifting OP0 right LOG-1 places and then shifting right logically @@ -2375,17 +2367,33 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) if (log == 1 || BRANCH_COST >= 3) { rtx temp = gen_reg_rtx (compute_mode); + if (! can_clobber_op0) + /* Copy op0 to a reg, to play safe, + since this is done in the other path. */ + op0 = force_reg (compute_mode, op0); temp = copy_to_suggested_reg (adjusted_op0, temp, compute_mode); 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 (size - log, 0), temp, 1); - expand_inc (adjusted_op0, temp); + /* We supply 0 as the target to make a new pseudo + for the value; that helps loop.c optimize the result. */ + adjusted_op0 = expand_binop (compute_mode, add_optab, + adjusted_op0, temp, + 0, 0, OPTAB_LIB_WIDEN); } else { rtx label = gen_label_rtx (); + if (! can_clobber_op0) + { + adjusted_op0 = copy_to_suggested_reg (adjusted_op0, target, + compute_mode); + /* Copy op0 to a reg, since emit_cmp_insn will call emit_queue + which will screw up mem refs for autoincrements. */ + op0 = force_reg (compute_mode, op0); + } emit_cmp_insn (adjusted_op0, const0_rtx, GE, NULL_RTX, compute_mode, 0, 0); emit_jump_insn (gen_bge (label)); |