+Wed Jun 27 18:01:09 2001 Jeffrey A Law (law@cygnus.com)
+
+ * simplify-rtx.c (simplify_rtx): Canonicalize commutative expressions
+ by putting complex operands first and constants second.
+
2001-06-27 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.h: Add documentation. Make macros polymorphic.
case '1':
return simplify_unary_operation (code, mode,
XEXP (x, 0), GET_MODE (XEXP (x, 0)));
- case '2':
case 'c':
+ /* Put complex operands first and constants second if commutative. */
+ if (GET_RTX_CLASS (code) == 'c'
+ && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
+ || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o'
+ && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')
+ || (GET_CODE (XEXP (x, 0)) == SUBREG
+ && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o'
+ && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')))
+ {
+ rtx tem;
+
+ tem = XEXP (x, 0);
+ XEXP (x, 0) = XEXP (x, 1);
+ XEXP (x, 1) = tem;
+ return simplify_binary_operation (code, mode,
+ XEXP (x, 0), XEXP (x, 1));
+ }
+
+ case '2':
return simplify_binary_operation (code, mode, XEXP (x, 0), XEXP (x, 1));
case '3':