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]

PR/24951, checking error emitting altivec {0.0, 0.0, 0.0, 0.0}


This bug is probably latent on other versions as well, but it manifests on 4.1 and 4.2 as a checking ICE.

output_vec_const_move includes this code

 cst = INTVAL (CONST_VECTOR_ELT (vec, 0));
 cst2 = INTVAL (CONST_VECTOR_ELT (vec, 1));
 mode = GET_MODE (dest);

 if (TARGET_ALTIVEC)
   {
     if (zero_constant (vec, mode))
	return "vxor %0,%0,%0";

But output_vec_const_move can also be called on a V4SF constant if it is {0.0, 0.0, 0.0, 0.0} and in this case getting cst and cst2 will fail with an error like expected code 'const_int', have 'const_double'.

This is trivially fixed on 4.1 and mainline by moving cst and cst2 just before the usage point, as in the attached patch.

Bootstrapped powerpc-apple-darwin8.2.0, vectorization and PPC testsuites completed with no regressions. I also checked with a cross compiler that it fixes the PR. Andreas, could you test the patch on PPC64? Ok for mainline if it passes?

Paolo
2005-11-21  Paolo Bonzini  <bonzini@gnu.org>

	PR target/24951

	* config/rs6000/rs6000.c (output_vec_const_move): Load cst and
	cst2 only for SPE vectors.

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 107256)
+++ config/rs6000/rs6000.c	(working copy)
@@ -2200,9 +2200,6 @@ output_vec_const_move (rtx *operands)
 
   dest = operands[0];
   vec = operands[1];
-
-  cst = INTVAL (CONST_VECTOR_ELT (vec, 0));
-  cst2 = INTVAL (CONST_VECTOR_ELT (vec, 1));
   mode = GET_MODE (dest);
 
   if (TARGET_ALTIVEC)
@@ -2240,8 +2237,10 @@ output_vec_const_move (rtx *operands)
 
      FIXME: We should probably return # and add post reload
      splitters for these, but this way is so easy ;-).  */
-  operands[1] = GEN_INT (cst);
-  operands[2] = GEN_INT (cst2);
+  cst = INTVAL (CONST_VECTOR_ELT (vec, 0));
+  cst2 = INTVAL (CONST_VECTOR_ELT (vec, 1));
+  operands[1] = CONST_VECTOR_ELT (vec, 0);
+  operands[2] = CONST_VECTOR_ELT (vec, 1);
   if (cst == cst2)
     return "li %0,%1\n\tevmergelo %0,%0,%0";
   else

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