]> gcc.gnu.org Git - gcc.git/commitdiff
combine.c (make_compound_operation): Swap operands of commutative operation if necess...
authorJoseph Myers <joseph@codesourcery.com>
Sat, 19 Nov 2005 12:32:23 +0000 (12:32 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Sat, 19 Nov 2005 12:32:23 +0000 (12:32 +0000)
* combine.c (make_compound_operation): Swap operands of
commutative operation if necessary before returning.

From-SVN: r107219

gcc/ChangeLog
gcc/combine.c

index 1200433e317e3926355f969f900925e7cc1d9dce..21b558572606c1675a257f5fcc4bd9fc5b584da5 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-19  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * combine.c (make_compound_operation): Swap operands of
+       commutative operation if necessary before returning.
+
 2005-11-19  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/23294
index 9f910a7b336e85a19a86ac9e577844f14b8b1bbd..b43b9b621c665230bed5f3a269b5e5c4ccd65cfc 100644 (file)
@@ -6914,6 +6914,16 @@ make_compound_operation (rtx x, enum rtx_code in_code)
        SUBST (XEXP (x, i), new);
       }
 
+  /* If this is a commutative operation, the changes to the operands
+     may have made it noncanonical.  */
+  if (COMMUTATIVE_ARITH_P (x)
+      && swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1)))
+    {
+      tem = XEXP (x, 0);
+      SUBST (XEXP (x, 0), XEXP (x, 1));
+      SUBST (XEXP (x, 1), tem);
+    }
+
   return x;
 }
 \f
This page took 0.085276 seconds and 5 git commands to generate.