combine.c (known_cond): After replacing the REG of a SUBREG, try to simplify it.
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 14 Feb 2002 19:30:42 +0000 (19:30 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 14 Feb 2002 19:30:42 +0000 (19:30 +0000)
* combine.c (known_cond): After replacing the REG of a SUBREG, try
to simplify it.

From-SVN: r49775

gcc/ChangeLog
gcc/combine.c

index e23395e7524418567551bb5b136ecda5b347aa4d..82649c55d7018f682194eb7f080df0e6f698f8ca 100644 (file)
@@ -1,5 +1,8 @@
 2002-02-14  Alexandre Oliva  <aoliva@redhat.com>
 
+       * combine.c (known_cond): After replacing the REG of a SUBREG, try
+       to simplify it.
+
        * function.c (assign_parms): Demote promoted argument passed by
        transparent reference.
 
index ba0bf35d21eacff2f7603924e840006a0f08b93b..5abda2e56fe8c7d8e43319de2605637d6d89c7d0 100644 (file)
@@ -7430,6 +7430,25 @@ known_cond (x, cond, reg, val)
            }
        }
     }
+  else if (code == SUBREG)
+    {
+      enum machine_mode inner_mode = GET_MODE (SUBREG_REG (x));
+      rtx new, r = known_cond (SUBREG_REG (x), cond, reg, val);
+
+      if (SUBREG_REG (x) != r)
+       {
+         /* We must simplify subreg here, before we lose track of the
+            original inner_mode.  */
+         new = simplify_subreg (GET_MODE (x), r,
+                                inner_mode, SUBREG_BYTE (x));
+         if (new)
+           return new;
+         else
+           SUBST (SUBREG_REG (x), r);
+       }
+
+      return x;
+    }
 
   fmt = GET_RTX_FORMAT (code);
   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)