From: Alan Modra Date: Thu, 1 Dec 2005 23:48:13 +0000 (+0000) Subject: simplify-rtx.c (simplify_plus_minus): Do simplify constants. X-Git-Tag: releases/gcc-4.2.0~5634 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36686ad6c0018b2f17eabe9d5578530b7661b964;p=thirdparty%2Fgcc.git simplify-rtx.c (simplify_plus_minus): Do simplify constants. * simplify-rtx.c (simplify_plus_minus): Do simplify constants. Delete dead code. From-SVN: r107840 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d386e6f2465..e40030ad5fca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-12-02 Alan Modra + + * simplify-rtx.c (simplify_plus_minus): Do simplify constants. + Delete dead code. + 2005-12-01 Richard Henderson * optabs.c (expand_vec_cond_expr): Use EXPAND_NORMAL. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index bc1713145890..9b39f0d97225 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++)