summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/combine.c5
-rw-r--r--gcc/expmed.c3
-rw-r--r--gcc/expr.c6
-rw-r--r--gcc/optabs.c27
-rw-r--r--gcc/simplify-rtx.c3
6 files changed, 27 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1442a191b51..eeff21e01e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2001-05-22 Jan Hubicka <jh@suse.cz>
+
+ * combine.c (gen_binary): Use swap_commutative_operands_p
+ (simplify_comparison): Likewise.
+ * expmed.c (emit_store_flag): Likewise.
+ * expr.c (compare_from_rtx): Likewise.
+ (do_compare_rtx_and_jump): Likewise.
+ * optabs.c (emit_cmp_and_jump_insn): Revert last patch; abort
+ if not emitting a branch and operands want swapping.
+
2001-05-22 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lex.c (c_lex): Just cast cpp's hashnode to gcc's one.
diff --git a/gcc/combine.c b/gcc/combine.c
index 675b1fe3e91..e36cdefac45 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -9793,8 +9793,7 @@ gen_binary (code, mode, op0, op1)
rtx tem;
if (GET_RTX_CLASS (code) == 'c'
- && (GET_CODE (op0) == CONST_INT
- || (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)))
+ && swap_commutative_operands_p (op0, op1))
tem = op0, op0 = op1, op1 = tem;
if (GET_RTX_CLASS (code) == '<')
@@ -9999,7 +9998,7 @@ simplify_comparison (code, pop0, pop1)
/* If the first operand is a constant, swap the operands and adjust the
comparison code appropriately, but don't do this if the second operand
is already a constant integer. */
- if (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
+ if (swap_commutative_operands_p (op0, op1))
{
tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code);
diff --git a/gcc/expmed.c b/gcc/expmed.c
index b2396ae9bd9..b08d5353fa7 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -4226,8 +4226,7 @@ emit_store_flag (target, code, op0, op1, mode, unsignedp, normalizep)
/* If one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
+ if (swap_commutative_operands_p (op0, op1))
{
tem = op0;
op0 = op1;
diff --git a/gcc/expr.c b/gcc/expr.c
index b654b460d32..7c7bee7f6d2 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10107,8 +10107,7 @@ compare_from_rtx (op0, op1, code, unsignedp, mode, size, align)
/* If one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
+ if (swap_commutative_operands_p (op0, op1))
{
tem = op0;
op0 = op1;
@@ -10190,8 +10189,7 @@ do_compare_rtx_and_jump (op0, op1, code, unsignedp, mode, size, align,
/* If one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
+ if (swap_commutative_operands_p (op0, op1))
{
tem = op0;
op0 = op1;
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 1bc8aaf1f0e..581fb9b95b2 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3287,23 +3287,18 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
unsigned int align;
rtx label;
{
- rtx op0;
- rtx op1;
-
- /* We may not swap in the general case, since this is called from
- compare_from_rtx, and we have no way of reporting the changed
- comparison code. */
- if (comparison == swap_condition (comparison)
- && swap_commutative_operands_p (x, y))
- {
- /* Swap operands and condition to ensure canonical RTL. */
- op0 = y;
- op1 = x;
- }
- else
+ rtx op0 = x, op1 = y;
+
+ /* Swap operands and condition to ensure canonical RTL. */
+ if (swap_commutative_operands_p (x, y))
{
- op0 = x;
- op1 = y;
+ /* If we're not emitting a branch, this means some caller
+ is out of sync. */
+ if (! label)
+ abort ();
+
+ op0 = y, op1 = x;
+ comparison = swap_condition (comparison);
}
#ifdef HAVE_cc0
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index e586b015413..a4ca80f4efd 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1817,8 +1817,7 @@ simplify_relational_operation (code, mode, op0, op1)
return 0;
/* Make sure the constant is second. */
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
+ if (swap_commutative_operands_p (op0, op1))
{
tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code);
OpenPOWER on IntegriCloud