OSDN Git Service

(compare_from_rtx): Only swap operand if first is a constant and
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Jan 1993 00:22:17 +0000 (00:22 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Jan 1993 00:22:17 +0000 (00:22 +0000)
second is not.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3370 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expr.c

index 1a3cd5b..6b4a57a 100644 (file)
@@ -7116,9 +7116,11 @@ compare_from_rtx (op0, op1, code, unsignedp, mode, size, align)
 {
   rtx tem;
 
-  /* If one operand is constant, make it the second one.  */
+  /* If one operand is constant, make it the second one.  Only do this
+     if the other operand is not constant as well.  */
 
-  if (GET_CODE (op0) == CONST_INT || GET_CODE (op0) == CONST_DOUBLE)
+  if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
+      || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
     {
       tem = op0;
       op0 = op1;