rtlhooks.c (gen_lowpart_if_possible): Check for invalid subreg before calling gen_low...
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Mon, 2 Jul 2007 19:40:30 +0000 (19:40 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Mon, 2 Jul 2007 19:40:30 +0000 (12:40 -0700)
2007-07-02  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        * rtlhooks.c (gen_lowpart_if_possible): Check for
        invalid subreg before calling gen_lowpart_SUBREG.

From-SVN: r126230

gcc/ChangeLog
gcc/rtlhooks.c

index d0fc5beb151cb2f217c924dd72f0e92f13c0698f..2ef7b32dc69ba6cc064a5a04cc14aa04ff185ca0 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-02  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       * rtlhooks.c (gen_lowpart_if_possible): Check for
+       invalid subreg before calling gen_lowpart_SUBREG.
+
 2007-07-02  Geoffrey Keating  <geoffk@apple.com>
 
        * config/darwin9.h: Add copyright notice.
index ece7198f9a2fc1a12130cfa7b104304a716131ca..79fcb4453090c11e11c9c7d8a4ffeecb0a76c1b4 100644 (file)
@@ -161,7 +161,9 @@ gen_lowpart_if_possible (enum machine_mode mode, rtx x)
 
       return new;
     }
-  else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode)
+  else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode
+          && validate_subreg (mode, GET_MODE (x), x,
+                               subreg_lowpart_offset (mode, GET_MODE (x))))
     return gen_lowpart_SUBREG (mode, x);
   else
     return 0;