This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Fix PR target/34856: ICE with some constant vectors


Hello!

It turns out that CONSTANT_P is too broad to filter out supported RTX
in vector constant elements. This patch constraints constant elements
to ones that can really be handled by the infrastructure.

Similar fix is needed for RS6000 and SPU.

Patch was bootstrapped and regression tested for i686-pc-linux-gnu. If
there are no objections on the testcase, It will be comitted to SVN in
a couple of hours.

2008-01-24  Uros Bizjak  <ubizjak@gmail.com>

	PR target/34856
	* config/i386/i386.c (ix86_expand_vector_init): Consider only
	CONST_INT, CONST_DOUBLE and CONST_FIXED as constant elements.

testsuite/ChangeLog:

	PR target/34856
	* gcc.dg/pr34856.c: New test.

Uros.

Index: testsuite/gcc.dg/pr34856.c
===================================================================
--- testsuite/gcc.dg/pr34856.c  (revision 0)
+++ testsuite/gcc.dg/pr34856.c  (revision 0)
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -msse2" { target { i?86-*-* x86_64-*-* } } } */
+
+#undef __vector
+#define __vector __attribute__((vector_size(16) ))
+
+typedef __vector signed char qword;
+typedef __vector unsigned int VU32;
+
+extern short g[192 + 16];
+
+void f (qword);
+
+void f1 (unsigned ctr)
+{
+  VU32 pin;
+  pin = (VU32){(unsigned int) &g[16]};
+  do
+    {
+      f ((qword) pin);
+      ctr--;
+    }
+  while (ctr);
+}
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 131776)
+++ config/i386/i386.c  (working copy)
@@ -23593,7 +23593,9 @@ ix86_expand_vector_init (bool mmx_ok, rt
   for (i = 0; i < n_elts; ++i)
     {
       x = XVECEXP (vals, 0, i);
-      if (!CONSTANT_P (x))
+      if (!(CONST_INT_P (x)
+           || GET_CODE (x) == CONST_DOUBLE
+           || GET_CODE (x) == CONST_FIXED))
        n_var++, one_var = i;
       else if (x != CONST0_RTX (inner_mode))
        all_const_zero = false;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]