* simplify-rtx.c (simplify_subreg): Combine SUBREG and TRUNCATE.
authorAdam Nemet <anemet@caviumnetworks.com>
Tue, 14 Feb 2006 17:45:55 +0000 (17:45 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Tue, 14 Feb 2006 17:45:55 +0000 (17:45 +0000)
From-SVN: r110990

gcc/ChangeLog
gcc/simplify-rtx.c

index 935add304c1c29013eb80ec4a9706346cc21e041..17c8b5f7a5103a38da9f0010c030b439d357aade 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-14  Adam Nemet  <anemet@caviumnetworks.com>
+
+       * simplify-rtx.c (simplify_subreg): Combine SUBREG and TRUNCATE.
+
 2006-02-14  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        PR bootstrap/26053
index c949dea1d16014a232fa62b7bdccc9e70e9aa404..6f4f09b8e092c0f1d56bf22b8f358fd619d6fe52 100644 (file)
@@ -4426,6 +4426,14 @@ simplify_subreg (enum machine_mode outermode, rtx op,
       return NULL_RTX;
     }
 
+  /* Merge implicit and explicit truncations.  */
+
+  if (GET_CODE (op) == TRUNCATE
+      && GET_MODE_SIZE (outermode) < GET_MODE_SIZE (innermode)
+      && subreg_lowpart_offset (outermode, innermode) == byte)
+    return simplify_gen_unary (TRUNCATE, outermode, XEXP (op, 0),
+                              GET_MODE (XEXP (op, 0)));
+
   /* SUBREG of a hard register => just change the register number
      and/or mode.  If the hard register is not valid in that mode,
      suppress this simplification.  If the hard register is the stack,