summaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-09-07 11:14:32 -0700
committerRichard Henderson <rth@gcc.gnu.org>2001-09-07 11:14:32 -0700
commit9b3bd4249d2e0e46d4bec0909e626543bbd14d3b (patch)
treefdd0e020da43b19ca8c6fe9ea8eb332cf71d6eba /gcc/loop.c
parent9978052974a84e9666af3c1f69bdf599c43cd5d0 (diff)
downloadgcc-9b3bd4249d2e0e46d4bec0909e626543bbd14d3b.tar.gz
loop.c (record_giv): Avoid simplifying MULT to ASHIFT.
* loop.c (record_giv): Avoid simplifying MULT to ASHIFT. (express_from_1): Wrap lines. * rtlanal.c (commutative_operand_precedence): Rename from operand_preference; export. * rtl.h: Declare it. * simplify-rtx.c (simplify_gen_binary): Tidy +/- const_int handling. (simplify_binary_operation): Invoke simplify_plus_minus on (CONST (PLUS ...)) as well. (struct simplify_plus_minus_op_data): New. (simplify_plus_minus_op_data_cmp): New. (simplify_plus_minus): Use them. Avoid infinite recursion with simplify_binary_operation wrt CONST. From-SVN: r45473
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index e72f421b8cc..990826a5a7d 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -4922,9 +4922,12 @@ record_giv (loop, v, insn, src_reg, dest_reg, mult_val, add_val, ext_val,
rtx set = single_set (insn);
rtx temp;
- /* Attempt to prove constantness of the values. */
+ /* Attempt to prove constantness of the values. Don't let simplity_rtx
+ undo the MULT canonicalization that we performed earlier. */
temp = simplify_rtx (add_val);
- if (temp)
+ if (temp
+ && ! (GET_CODE (add_val) == MULT
+ && GET_CODE (temp) == ASHIFT))
add_val = temp;
v->insn = insn;
@@ -6371,7 +6374,10 @@ express_from_1 (a, b, mult)
}
else if (CONSTANT_P (a))
{
- return simplify_gen_binary (MINUS, GET_MODE (b) != VOIDmode ? GET_MODE (b) : GET_MODE (a), b, a);
+ enum machine_mode mode_a = GET_MODE (a);
+ enum machine_mode mode_b = GET_MODE (b);
+ enum machine_mode mode = mode_b == VOIDmode ? mode_a : mode_b;
+ return simplify_gen_binary (MINUS, mode, b, a);
}
else if (GET_CODE (b) == PLUS)
{