re PR target/27158 (ICE in extract_insn with -maltivec)
authorRoger Sayle <roger@eyesopen.com>
Mon, 8 May 2006 21:09:49 +0000 (21:09 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 8 May 2006 21:09:49 +0000 (21:09 +0000)
PR target/27158
* reload.c (find_reloads_toplev): Only return the simplified SUBREG
of a reg_equiv_constant if the result is a legitimate constant.

* gcc.target/powerpc/pr27158.c: New test case.

From-SVN: r113632

gcc/ChangeLog
gcc/reload.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr27158.c [new file with mode: 0644]

index 631921b45a6e7ee708fa72fd2d5e09f83b4f8813..f660c99ec6bc8faa66c0cafc9e0866a59b62626e 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-08  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/27158
+       * reload.c (find_reloads_toplev): Only return the simplified SUBREG
+       of a reg_equiv_constant if the result is a legitimate constant.
+
 2006-05-08  Uros Bizjak  <uros@kss-loka.si>
 
        PR target/27277
index e7798b9c41acb7f52ad3f7cce298f040197847cf..03b5ba6beef4a068e214b579798f9423ecadc3ff 100644 (file)
@@ -4559,20 +4559,24 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
       rtx tem;
 
       if (subreg_lowpart_p (x)
-         && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
+         && regno >= FIRST_PSEUDO_REGISTER
+         && reg_renumber[regno] < 0
          && reg_equiv_constant[regno] != 0
          && (tem = gen_lowpart_common (GET_MODE (x),
-                                       reg_equiv_constant[regno])) != 0)
+                                       reg_equiv_constant[regno])) != 0
+         && LEGITIMATE_CONSTANT_P (tem))
        return tem;
 
-      if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
+      if (regno >= FIRST_PSEUDO_REGISTER
+         && reg_renumber[regno] < 0
          && reg_equiv_constant[regno] != 0)
        {
          tem =
            simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
                                 GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
          gcc_assert (tem);
-         return tem;
+         if (LEGITIMATE_CONSTANT_P (tem))
+           return tem;
        }
 
       /* If the subreg contains a reg that will be converted to a mem,
@@ -4588,7 +4592,7 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
         a wider mode if we have a paradoxical SUBREG.  find_reloads will
         force a reload in that case.  So we should not do anything here.  */
 
-      else if (regno >= FIRST_PSEUDO_REGISTER
+      if (regno >= FIRST_PSEUDO_REGISTER
 #ifdef LOAD_EXTEND_OP
               && (GET_MODE_SIZE (GET_MODE (x))
                   <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
index c490218c53f612cb58b080b8a4286e00f9c3c47f..0911cd99898f306c68a40636cf99b4c0f9512a1e 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-08  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/27158
+       * gcc.target/powerpc/pr27158.c: New test case.
+
 2006-05-08  Laurent GUERBY  <laurent@guerby.net>
 
        PR testsuite/27476
diff --git a/gcc/testsuite/gcc.target/powerpc/pr27158.c b/gcc/testsuite/gcc.target/powerpc/pr27158.c
new file mode 100644 (file)
index 0000000..4228e9a
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "*" } { "" } } */
+/* { dg-options "-O2 -maltivec" } */
+#define REGLIST                                                              \
+         "77",  "78",  "79",  "80",  "81",  "82",  "83",  "84",  "85",  "86",\
+         "87",  "88",  "89",  "90",  "91",  "92",  "93",  "94",  "95",  "96",\
+         "97",  "98",  "99", "100", "101", "102", "103", "104", "105", "106",\
+        "107", "108"
+
+typedef __attribute__ ((vector_size (16))) float v4sf;
+
+void
+foo (int H)
+{
+  volatile v4sf tmp;
+  while (H-- > 0)
+    {
+      asm ("" : : : REGLIST);
+      tmp = (v4sf) __builtin_altivec_vspltisw (1);
+    }
+}
+