Commit 8c9864f3 by Jan Hubicka Committed by Richard Henderson

combine.c (gen_binary): Use swap_commutative_operands_p

        * 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.

From-SVN: r42433
parent 083e9f92
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> 2001-05-22 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lex.c (c_lex): Just cast cpp's hashnode to gcc's one. * c-lex.c (c_lex): Just cast cpp's hashnode to gcc's one.
......
...@@ -9793,8 +9793,7 @@ gen_binary (code, mode, op0, op1) ...@@ -9793,8 +9793,7 @@ gen_binary (code, mode, op0, op1)
rtx tem; rtx tem;
if (GET_RTX_CLASS (code) == 'c' if (GET_RTX_CLASS (code) == 'c'
&& (GET_CODE (op0) == CONST_INT && swap_commutative_operands_p (op0, op1))
|| (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)))
tem = op0, op0 = op1, op1 = tem; tem = op0, op0 = op1, op1 = tem;
if (GET_RTX_CLASS (code) == '<') if (GET_RTX_CLASS (code) == '<')
...@@ -9999,7 +9998,7 @@ simplify_comparison (code, pop0, pop1) ...@@ -9999,7 +9998,7 @@ simplify_comparison (code, pop0, pop1)
/* If the first operand is a constant, swap the operands and adjust the /* 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 comparison code appropriately, but don't do this if the second operand
is already a constant integer. */ 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; tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code); code = swap_condition (code);
......
...@@ -4226,8 +4226,7 @@ emit_store_flag (target, code, op0, op1, mode, unsignedp, normalizep) ...@@ -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 one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */ if the other operand is not constant as well. */
if ((CONSTANT_P (op0) && ! CONSTANT_P (op1)) if (swap_commutative_operands_p (op0, op1))
|| (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
{ {
tem = op0; tem = op0;
op0 = op1; op0 = op1;
......
...@@ -10107,8 +10107,7 @@ compare_from_rtx (op0, op1, code, unsignedp, mode, size, align) ...@@ -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 one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */ if the other operand is not constant as well. */
if ((CONSTANT_P (op0) && ! CONSTANT_P (op1)) if (swap_commutative_operands_p (op0, op1))
|| (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
{ {
tem = op0; tem = op0;
op0 = op1; op0 = op1;
...@@ -10190,8 +10189,7 @@ do_compare_rtx_and_jump (op0, op1, code, unsignedp, mode, size, align, ...@@ -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 one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */ if the other operand is not constant as well. */
if ((CONSTANT_P (op0) && ! CONSTANT_P (op1)) if (swap_commutative_operands_p (op0, op1))
|| (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
{ {
tem = op0; tem = op0;
op0 = op1; op0 = op1;
......
...@@ -3287,23 +3287,18 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label) ...@@ -3287,23 +3287,18 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
unsigned int align; unsigned int align;
rtx label; rtx label;
{ {
rtx op0; rtx op0 = x, op1 = y;
rtx op1;
/* Swap operands and condition to ensure canonical RTL. */
/* We may not swap in the general case, since this is called from if (swap_commutative_operands_p (x, y))
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
{ {
op0 = x; /* If we're not emitting a branch, this means some caller
op1 = y; is out of sync. */
if (! label)
abort ();
op0 = y, op1 = x;
comparison = swap_condition (comparison);
} }
#ifdef HAVE_cc0 #ifdef HAVE_cc0
......
...@@ -1817,8 +1817,7 @@ simplify_relational_operation (code, mode, op0, op1) ...@@ -1817,8 +1817,7 @@ simplify_relational_operation (code, mode, op0, op1)
return 0; return 0;
/* Make sure the constant is second. */ /* Make sure the constant is second. */
if ((CONSTANT_P (op0) && ! CONSTANT_P (op1)) if (swap_commutative_operands_p (op0, op1))
|| (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
{ {
tem = op0, op0 = op1, op1 = tem; tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code); code = swap_condition (code);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment