]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: MMA type causes an ICE in ranger pass due to incompatible types
authorRichard Biener <rguenther@suse.de>
Wed, 21 Oct 2020 19:28:45 +0000 (14:28 -0500)
committerPeter Bergner <bergner@linux.ibm.com>
Sat, 7 Nov 2020 00:21:28 +0000 (18:21 -0600)
PR97360 shows a problem in how we create our PXI and POI modes that cause
an ICE in the ranger pass.  The problem seems to be that the extra call
to build_distinct_type_copy() also creates new TYPE_{MIN,MAX}_VALUEs that
are not compatible/the same as the base type itself.  The simple "fix" is
to actually remove the unneeded build_distinct_type_copy(), since according
to richi, the types returned from make_unsigned_type() are already distinct.

gcc/

2020-10-21  Richard Biener  <rguenther@suse.de>

PR target/97360
* config/rs6000/rs6000-call.c (rs6000_init_builtins): Remove call to
build_distinct_type_copy().

gcc/testsuite/

2020-10-21  Martin Liska  <mliska@suse.cz>

PR target/97360
* gcc.target/powerpc/pr97360.c: New test.

Co-authored-by: Andrew MacLeod <amacleod@redhat.com>
Co-authored-by: Martin Liska <mliska@suse.cz>
(cherry picked from commit 84cc3370d6d5972fe495b2114fb32f7b4a49a98d)

gcc/config/rs6000/rs6000-call.c
gcc/testsuite/gcc.target/powerpc/pr97360.c [new file with mode: 0644]

index e2f5414b80f8be5c34c6057b19a122c225a63dfb..0ddecdc7dca4fb74a5bdead50e9682f65e81cb7a 100644 (file)
@@ -12325,15 +12325,13 @@ rs6000_init_builtins (void)
   /* Vector pair and vector quad support.  */
   if (TARGET_EXTRA_BUILTINS)
     {
-      tree oi_uns_type = make_unsigned_type (256);
-      vector_pair_type_node = build_distinct_type_copy (oi_uns_type);
+      vector_pair_type_node = make_unsigned_type (256);
       SET_TYPE_MODE (vector_pair_type_node, POImode);
       layout_type (vector_pair_type_node);
       lang_hooks.types.register_builtin_type (vector_pair_type_node,
                                              "__vector_pair");
 
-      tree xi_uns_type = make_unsigned_type (512);
-      vector_quad_type_node = build_distinct_type_copy (xi_uns_type);
+      vector_quad_type_node = make_unsigned_type (512);
       SET_TYPE_MODE (vector_quad_type_node, PXImode);
       layout_type (vector_quad_type_node);
       lang_hooks.types.register_builtin_type (vector_quad_type_node,
diff --git a/gcc/testsuite/gcc.target/powerpc/pr97360.c b/gcc/testsuite/gcc.target/powerpc/pr97360.c
new file mode 100644 (file)
index 0000000..2328d28
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/97360 */
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we do not ICE on the test below.  */
+
+typedef unsigned char vec_t __attribute__((vector_size(16)));
+
+void
+foo (__vector_quad *dst, __vector_pair *vpair, vec_t *vec)
+{
+  __vector_quad acc = *dst;
+  for (;;)
+    {
+      __builtin_mma_xvf64gerpp(&acc, *vpair, vec[7]);
+    }
+}