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 PR target/71733, ICE with -mcpu=power9 -mno-vsx


The following patch fixes a bug where we do not disable POWER9 vector dform
addressing when we compile for POWER9 but without VSX support.  This manifested
itself with us trying to use dform addressing with altivec loads/stores
which is illegal, leading to an ICE.

This has bootstrapped and regtested with no regessions.  Ok for trunk?

This also affects the FSF 6 branch, ok there too, assuming bootstrap and
regtesting complete cleanly?

Peter

gcc/
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Disable
	-mpower9-dform-vector when disabling -mpower9-vector.

gcc/testsuite/
	* gcc.target/powerpc/pr71733.c: New test.


Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 237945)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -4303,7 +4303,8 @@ rs6000_option_override_internal (bool gl
     {
       if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
 	error ("-mpower9-vector requires -mpower8-vector");
-      rs6000_isa_flags &= ~OPTION_MASK_P9_VECTOR;
+      rs6000_isa_flags &= ~(OPTION_MASK_P9_VECTOR
+			    | OPTION_MASK_P9_DFORM_VECTOR);
     }
 
   /* There have been bugs with -mvsx-timode that don't show up with -mlra,
Index: gcc/testsuite/gcc.target/powerpc/pr71733.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr71733.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr71733.c	(working copy)
@@ -0,0 +1,14 @@
+/* Test for ICE arising from dform code generation with VSX disabled.  */
+
+/* { dg-do compile } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-O0 -mcpu=power9 -mno-vsx" } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-skip-if "" { powerpc*-*-aix* } { "*" } { "" } } */
+
+typedef __attribute__((altivec(vector__))) unsigned char vec_t;
+vec_t
+foo (vec_t src)
+{
+  return src;
+}


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