diff options
author | Alan Modra <amodra@bigpond.net.au> | 2005-12-01 23:48:13 +0000 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2005-12-02 10:18:13 +1030 |
commit | 36686ad6c0018b2f17eabe9d5578530b7661b964 (patch) | |
tree | e5acd90e1a6a766bad1b0202c0c04c3cd0f3f23c /gcc/simplify-rtx.c | |
parent | 728cdd0872eb752c12519e4e6c0b4f9fa5d226e1 (diff) | |
download | gcc-36686ad6c0018b2f17eabe9d5578530b7661b964.zip gcc-36686ad6c0018b2f17eabe9d5578530b7661b964.tar.gz gcc-36686ad6c0018b2f17eabe9d5578530b7661b964.tar.bz2 |
simplify-rtx.c (simplify_plus_minus): Do simplify constants.
* simplify-rtx.c (simplify_plus_minus): Do simplify constants.
Delete dead code.
From-SVN: r107840
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index bc17131..9b39f0d 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2602,7 +2602,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, { struct simplify_plus_minus_op_data ops[8]; rtx result, tem; - int n_ops = 2, input_ops = 2, input_consts = 0, n_consts; + int n_ops = 2, input_ops = 2; int first, changed, canonicalized = 0; int i, j; @@ -2661,7 +2661,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, ops[n_ops].op = XEXP (XEXP (this_op, 0), 1); ops[n_ops].neg = this_neg; n_ops++; - input_consts++; changed = 1; canonicalized = 1; } @@ -2699,7 +2698,16 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, gcc_assert (n_ops >= 2); if (!canonicalized) - return NULL_RTX; + { + int n_constants = 0; + + for (i = 0; i < n_ops; i++) + if (GET_CODE (ops[i].op) == CONST_INT) + n_constants++; + + if (n_constants <= 1) + return NULL_RTX; + } /* If we only have two operands, we can avoid the loops. */ if (n_ops == 2) @@ -2728,11 +2736,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, return simplify_const_binary_operation (code, mode, lhs, rhs); } - /* Count the number of CONSTs we didn't split above. */ - for (i = 0; i < n_ops; i++) - if (GET_CODE (ops[i].op) == CONST) - input_consts++; - /* Now simplify each pair of operands until nothing changes. The first time through just simplify constants against each other. */ @@ -2835,12 +2838,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, n_ops--; } - /* Count the number of CONSTs that we generated. */ - n_consts = 0; - for (i = 0; i < n_ops; i++) - if (GET_CODE (ops[i].op) == CONST) - n_consts++; - /* Put a non-negated operand first, if possible. */ for (i = 0; i < n_ops && ops[i].neg; i++) |