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
This commit is contained in:
Jan Hubicka 2001-05-22 09:40:26 +02:00 committed by Richard Henderson
parent 083e9f9217
commit 8c9864f32d
6 changed files with 26 additions and 26 deletions

View File

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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
rtx op0 = x, op1 = y;
/* 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. */
if (swap_commutative_operands_p (x, y))
{
/* Swap operands and condition to ensure canonical RTL. */
op0 = y;
op1 = x;
}
else
{
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

View File

@ -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);