+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.
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) == '<')
/* 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);
/* 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;
/* 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;
/* 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;
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
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);