aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2005-09-29 14:57:23 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2005-09-29 14:57:23 +0000
commitbe1ea09b13ab5de0aed1ea8f507565bfc64be116 (patch)
treef39404b786d3f5d670d3c1a1b3c6147a9b23ea3a /gcc
parent02eb875fcf9775463bd0f7b26d09e6fc41d09893 (diff)
downloadgcc-be1ea09b13ab5de0aed1ea8f507565bfc64be116.zip
gcc-be1ea09b13ab5de0aed1ea8f507565bfc64be116.tar.gz
gcc-be1ea09b13ab5de0aed1ea8f507565bfc64be116.tar.bz2
Revert this patch:
2005-09-15 Paolo Bonzini <bonzini@gnu.org> * optabs.c (expand_binop): Use swap_commutative_operands_with_target to order operands. (swap_commutative_operands_with_target): New. From-SVN: r104775
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/optabs.c35
2 files changed, 21 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2d793e0..ebedfca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2005-09-29 Paolo Bonzini <bonzini@gnu.org>
+ Revert this patch:
+
+ 2005-09-15 Paolo Bonzini <bonzini@gnu.org>
+
+ * optabs.c (expand_binop): Use swap_commutative_operands_with_target
+ to order operands.
+ (swap_commutative_operands_with_target): New.
+
+2005-09-29 Paolo Bonzini <bonzini@gnu.org>
+
PR c/21419
* gimplify.c (gimplify_asm_expr): Raise an error if an output is
read-only.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index bc859205..70cf2b4 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -998,28 +998,6 @@ expand_simple_binop (enum machine_mode mode, enum rtx_code code, rtx op0,
return expand_binop (mode, binop, op0, op1, target, unsignedp, methods);
}
-
-/* Return whether OP0 and OP1 should be swapped when expanding a commutative
- binop. Order them according to commutative_operand_precedence and, if
- possible, try to put TARGET first. */
-static bool
-swap_commutative_operands_with_target (rtx target, rtx op0, rtx op1)
-{
- int op0_prec = commutative_operand_precedence (op0);
- int op1_prec = commutative_operand_precedence (op1);
-
- if (op0_prec < op1_prec)
- return true;
-
- if (op0_prec > op1_prec)
- return false;
-
- /* With equal precedence, both orders are ok, but try to put the
- target first. */
- return target && rtx_equal_p (op1, target);
-}
-
-
/* Generate code to perform an operation specified by BINOPTAB
on operands OP0 and OP1, with result having machine-mode MODE.
@@ -1083,7 +1061,10 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
/* Record where to delete back to if we backtrack. */
last = get_last_insn ();
- /* If operation is commutative, canonicalize the order of the operands. */
+ /* If operation is commutative,
+ try to make the first operand a register.
+ Even better, try to make it the same as the target.
+ Also try to make the last operand a constant. */
if (GET_RTX_CLASS (binoptab->code) == RTX_COMM_ARITH
|| binoptab == smul_widen_optab
|| binoptab == umul_widen_optab
@@ -1091,7 +1072,13 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
|| binoptab == umul_highpart_optab)
{
commutative_op = 1;
- if (swap_commutative_operands_with_target (target, op0, op1))
+
+ if (((target == 0 || REG_P (target))
+ ? ((REG_P (op1)
+ && !REG_P (op0))
+ || target == op1)
+ : rtx_equal_p (op1, target))
+ || GET_CODE (op0) == CONST_INT)
{
temp = op1;
op1 = op0;