re PR target/85945 (ICE in resolve_subreg_use, at lower-subreg.c:751)
authorJakub Jelinek <jakub@redhat.com>
Thu, 14 Jun 2018 13:35:06 +0000 (15:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 14 Jun 2018 13:35:06 +0000 (15:35 +0200)
PR target/85945
* lower-subreg.c (find_decomposable_subregs): Don't decompose float
subregs of multi-word pseudos unless the float mode has word size.

* gcc.c-torture/compile/pr85945.c: New test.

From-SVN: r261593

gcc/ChangeLog
gcc/lower-subreg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr85945.c [new file with mode: 0644]

index 269704804bcbd186373e29cd2fcb866cd122d4c3..65284fb6fbcb51e28e629a15c00a46217b13c69f 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/85945
+       * lower-subreg.c (find_decomposable_subregs): Don't decompose float
+       subregs of multi-word pseudos unless the float mode has word size.
+
 2018-06-14  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/86139
index 32e70dcbd12be73adef472d108809d6ce295cd07..72818b8255851921a6300db960fb42a7b29b5e6b 100644 (file)
@@ -497,7 +497,16 @@ find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi)
             were the same number and size of pieces.  Hopefully this
             doesn't happen much.  */
 
-         if (outer_words == 1 && inner_words > 1)
+         if (outer_words == 1
+             && inner_words > 1
+             /* Don't allow to decompose floating point subregs of
+                multi-word pseudos if the floating point mode does
+                not have word size, because otherwise we'd generate
+                a subreg with that floating mode from a different
+                sized integral pseudo which is not allowed by
+                validate_subreg.  */
+             && (!FLOAT_MODE_P (GET_MODE (x))
+                 || outer_size == UNITS_PER_WORD))
            {
              bitmap_set_bit (decomposable_context, regno);
              iter.skip_subrtxes ();
index 1286073f51de427428f660552fb8a492cf297c3b..74e5d850524603ab96389f8b60fa2c1d9ea557d9 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/85945
+       * gcc.c-torture/compile/pr85945.c: New test.
+
 2018-06-14  Richard Biener  <rguenther@suse.de>
 
        PR ipa/86124
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85945.c b/gcc/testsuite/gcc.c-torture/compile/pr85945.c
new file mode 100644 (file)
index 0000000..93b2023
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR target/85945 */
+
+typedef float V __attribute__((vector_size(16)));
+union U { V v; float f[4]; };
+int f;
+float g[4];
+
+void
+foo (void)
+{
+  V d;
+  union U i;
+  i.v = d;
+  for (f = 0; f < 4; f++)
+    g[f] = i.f[f];
+}