optabs.c (emit_cmp_and_jump_insns): Don't swap commutative operands unless the operat...
authorRichard Henderson <rth@redhat.com>
Mon, 21 May 2001 01:33:53 +0000 (18:33 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 21 May 2001 01:33:53 +0000 (18:33 -0700)
        * optabs.c (emit_cmp_and_jump_insns): Don't swap commutative
        operands unless the operation is commutative.

From-SVN: r42366

gcc/ChangeLog
gcc/optabs.c

index 582f100d8f32dbf0ca4bd33719d404469aad7966..dc32386fdd4a4f0c6c55a0416172ab1d85b23fa3 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-20  Richard Henderson  <rth@redhat.com>
+
+       * optabs.c (emit_cmp_and_jump_insns): Don't swap commutative
+       operands unless the operation is commutative.
+
 2001-05-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * fold-const.c (tree_expr_nonnegative_p): Detect more non-negative
index a2a42c636b162aadc44abe38cd3da370d1b40de9..1bc8aaf1f0e72616ceea27e0393b1de1eddb4da9 100644 (file)
@@ -3289,13 +3289,16 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
 {
   rtx op0;
   rtx op1;
-         
-  if (swap_commutative_operands_p (x, 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.  */
       op0 = y;
       op1 = x;
-      comparison = swap_condition (comparison);
     }
   else
     {