]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR rtl-optimization/70542
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Apr 2016 17:05:23 +0000 (17:05 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Apr 2016 17:05:23 +0000 (17:05 +0000)
* ree.c (add_removable_extension): For VECTOR_MODE_P punt
if there are any uses other than insn or debug insns.

* gcc.dg/torture/pr70542.c: New test.
* gcc.target/i386/avx2-pr70542.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234756 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ree.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr70542.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx2-pr70542.c [new file with mode: 0644]

index de21dde06f3fd581ed1957392b51f99bd90ac184..df63cc59b8d104d10e0c349eef30601a98299be6 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/70542
+       * ree.c (add_removable_extension): For VECTOR_MODE_P punt
+       if there are any uses other than insn or debug insns.
+
 2016-04-05  Marc Glisse  <marc.glisse@inria.fr>
            Jakub Jelinek  <jakub@redhat.com>
 
index 13a7a0586ac22a6e5758c6d77f17671049f767b1..4627b4f99b555a77d53ebdcd9f1fd3ccb6488082 100644 (file)
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1025,11 +1025,11 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
            return;
          }
        /* For vector mode extensions, ensure that all uses of the
-          XEXP (src, 0) register are the same extension (both code
-          and to which mode), as unlike integral extensions lowpart
-          subreg of the sign/zero extended register are not equal
-          to the original register, so we have to change all uses or
-          none.  */
+          XEXP (src, 0) register are in insn or debug insns, as unlike
+          integral extensions lowpart subreg of the sign/zero extended
+          register are not equal to the original register, so we have
+          to change all uses or none and the current code isn't able
+          to change them all at once in one transaction.  */
        else if (VECTOR_MODE_P (GET_MODE (XEXP (src, 0))))
          {
            if (idx == 0)
@@ -1046,15 +1046,7 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
                        break;
                      }
                    rtx_insn *use_insn = DF_REF_INSN (ref_link->ref);
-                   const_rtx use_set;
-                   if (use_insn == insn || DEBUG_INSN_P (use_insn))
-                     continue;
-                   if (!(use_set = single_set (use_insn))
-                       || !REG_P (SET_DEST (use_set))
-                       || GET_MODE (SET_DEST (use_set)) != GET_MODE (dest)
-                       || GET_CODE (SET_SRC (use_set)) != code
-                       || !rtx_equal_p (XEXP (SET_SRC (use_set), 0),
-                                        XEXP (src, 0)))
+                   if (use_insn != insn && !DEBUG_INSN_P (use_insn))
                      {
                        idx = -1U;
                        break;
index 92ea4a51b23124c1196eb53e3cc88039f00e05fd..ab6935c72fb1b183c978c1204f7d311c89598bf2 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/70542
+       * gcc.dg/torture/pr70542.c: New test.
+       * gcc.target/i386/avx2-pr70542.c: New test.
+
 2016-04-05  Zdenek Sojka  <zsojka@seznam.cz>
 
        PR tree-optimization/70509
diff --git a/gcc/testsuite/gcc.dg/torture/pr70542.c b/gcc/testsuite/gcc.dg/torture/pr70542.c
new file mode 100644 (file)
index 0000000..ed7ab9d
--- /dev/null
@@ -0,0 +1,31 @@
+/* PR rtl-optimization/70542 */
+/* { dg-do run } */
+
+int a[113], d[113];
+short b[113], c[113], e[113];
+
+int
+main ()
+{
+  int i;
+  long j;
+  for (i = 0; i < 113; ++i)
+    {
+      a[i] = -636544305;
+      b[i] = -31804;
+    }
+  for (j = 1; j <= 112; ++j)
+    {
+      c[j] = b[j] >> ((a[j] & 1587842570) - 1510214139);
+      if (a[j])
+       d[j] = j;
+      e[j] = 7 << ((2312631697 - b[j]) - 2312663500);
+    }
+  asm volatile ("" : : : "memory");
+  if (c[0] || d[0] || e[0])
+    __builtin_abort ();
+  for (i = 1; i <= 112; ++i)
+    if (c[i] != -1 || d[i] != i || e[i] != 14)
+      __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr70542.c b/gcc/testsuite/gcc.target/i386/avx2-pr70542.c
new file mode 100644 (file)
index 0000000..2a95c5a
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR tree-optimization/70542 */
+/* { dg-do run } */
+/* { dg-options "-O3 -mavx2" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+
+#define main() do_main ()
+
+#include "../../gcc.dg/torture/pr70542.c"
+
+static void
+avx2_test (void)
+{
+  do_main ();
+}