* simplify-rtx.c (simplify_plus_minus): Always generate canonical form.

From-SVN: r75724
This commit is contained in:
Paul Brook 2004-01-12 15:33:59 +00:00 committed by Paul Brook
parent 543ca912c8
commit 0786ca8784
2 changed files with 8 additions and 10 deletions

View File

@ -1,3 +1,7 @@
2004-01-09 Paul Brook <paul@codesourcery.com>
* simplify-rtx.c (simplify_plus_minus): Always generate canonical form.
2004-01-09 J"orn Rennecke <joern.rennecke@superh.com> 2004-01-09 J"orn Rennecke <joern.rennecke@superh.com>
PR target/13585 PR target/13585

View File

@ -2250,7 +2250,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
struct simplify_plus_minus_op_data ops[8]; struct simplify_plus_minus_op_data ops[8];
rtx result, tem; rtx result, tem;
int n_ops = 2, input_ops = 2, input_consts = 0, n_consts; int n_ops = 2, input_ops = 2, input_consts = 0, n_consts;
int first, negate, changed; int first, changed;
int i, j; int i, j;
memset (ops, 0, sizeof ops); memset (ops, 0, sizeof ops);
@ -2460,18 +2460,12 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
|| (n_ops + n_consts == input_ops && n_consts <= input_consts))) || (n_ops + n_consts == input_ops && n_consts <= input_consts)))
return NULL_RTX; return NULL_RTX;
/* Put a non-negated operand first. If there aren't any, make all /* Put a non-negated operand first, if possible. */
operands positive and negate the whole thing later. */
negate = 0;
for (i = 0; i < n_ops && ops[i].neg; i++) for (i = 0; i < n_ops && ops[i].neg; i++)
continue; continue;
if (i == n_ops) if (i == n_ops)
{ ops[0].op = gen_rtx_NEG (mode, ops[0].op);
for (i = 0; i < n_ops; i++)
ops[i].neg = 0;
negate = 1;
}
else if (i != 0) else if (i != 0)
{ {
tem = ops[0].op; tem = ops[0].op;
@ -2486,7 +2480,7 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS,
mode, result, ops[i].op); mode, result, ops[i].op);
return negate ? gen_rtx_NEG (mode, result) : result; return result;
} }
/* Like simplify_binary_operation except used for relational operators. /* Like simplify_binary_operation except used for relational operators.