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, rs6000] Fix PR84264: ICE in rs6000_emit_le_vsx_store


In PR84264, we hit an assert in rs6000_emit_le_vsx_store causing an ICE
in LRA.  We get there, because LRA called the movv4si expander to generate
a spill and the mov pattern calls rs6000_emit_le_vsx_move which in turn
calls rs6000_emit_le_vsx_store.  The rs6000_emit_le_vsx_{load,store}
routines are used at expand time when targeting P8 on an LE system to
generate vsx load/store insns along with their associated byte swaps.
After expand, we shouldn't call them, hence the asserts.

The problem in this case is that LRA calls the movv4si expander to
generate a spill store and we satisfy all the conditions that lead
to calling rs6000_emit_le_vsx_move().  What is different here, is that
with GCC 8, we now generate altivec lvx/stvx insns which are LE friendly
and do not need byte swaps.  In this specific case, LRA is generating
a store to an altivec mem, so we shouldn't call rs6000_emit_le_vsx_move(),
but rather we should just emit the default RTL from the expander.

The simple fix here is to just verify the memory_operand is not an altivec
mem operand before calling rs6000_emit_le_vsx_move.

This passed bootstrap and regtesting on powerpc64le-linux with no
regressions.  Ok for trunk?

Peter


gcc/
	PR target/84264
	* config/rs6000/vector.md:

gcc/testsuite/
	PR target/84264
	* g++.dg/pr84264.C: New test.

Index: gcc/config/rs6000/vector.md
===================================================================
--- gcc/config/rs6000/vector.md	(revision 258152)
+++ gcc/config/rs6000/vector.md	(working copy)
@@ -136,8 +136,10 @@ (define_expand "mov<mode>"
       && VECTOR_MEM_VSX_P (<MODE>mode)
       && !TARGET_P9_VECTOR
       && !gpr_or_gpr_p (operands[0], operands[1])
-      && (memory_operand (operands[0], <MODE>mode)
-          ^ memory_operand (operands[1], <MODE>mode)))
+      && ((memory_operand (operands[0], <MODE>mode)
+	   && !altivec_indexed_or_indirect_operand(operands[0], <MODE>mode))
+	  ^ (memory_operand (operands[1], <MODE>mode)
+	     && !altivec_indexed_or_indirect_operand(operands[1], <MODE>mode))))
     {
       rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
       DONE;
Index: gcc/testsuite/g++.dg/pr84264.C
===================================================================
--- gcc/testsuite/g++.dg/pr84264.C	(nonexistent)
+++ gcc/testsuite/g++.dg/pr84264.C	(working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-w -O1 -fstack-protector-strong" } */
+
+void _setjmp ();
+void a (unsigned long *);
+void
+b (void)
+{
+  for (;;)
+    {
+      _setjmp ();
+      unsigned long args[9]{};
+      a (args);
+    }
+}


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