]> gcc.gnu.org Git - gcc.git/commitdiff
re PR target/70903 (wrong code with bfi @ aarch64 with -Os)
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 4 Aug 2016 13:20:57 +0000 (13:20 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Thu, 4 Aug 2016 13:20:57 +0000 (13:20 +0000)
2016-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR rtl-optimization/70903
        * cse.c (cse_insn): If DEST is a paradoxical SUBREG, don't record DEST.

testsuite:
2016-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR rtl-optimization/70903
        * gcc.c-torture/execute/pr70903.c: New test.

From-SVN: r239122

gcc/ChangeLog
gcc/cse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr70903.c [new file with mode: 0644]

index 2d9d8c17202a98a6b38b579a25833b70fb555e3a..6c41321c47a26e1298a01c0b6170ca8d8526260f 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR rtl-optimization/70903
+       * cse.c (cse_insn): If DEST is a paradoxical SUBREG, don't record DEST.
+
 2016-08-04  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * tree-inline.c (remap_ssa_name): Check for POINTER_TYPE_P before
index 61d2d7e3c3f77445295688eebe08c6d0313b5b25..0bfd7ff16699b74530368eb6e602cbd26b0e4099 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5898,15 +5898,7 @@ cse_insn (rtx_insn *insn)
            || GET_MODE (dest) == BLKmode
            /* If we didn't put a REG_EQUAL value or a source into the hash
               table, there is no point is recording DEST.  */
-           || sets[i].src_elt == 0
-           /* If DEST is a paradoxical SUBREG and SRC is a ZERO_EXTEND
-              or SIGN_EXTEND, don't record DEST since it can cause
-              some tracking to be wrong.
-
-              ??? Think about this more later.  */
-           || (paradoxical_subreg_p (dest)
-               && (GET_CODE (sets[i].src) == SIGN_EXTEND
-                   || GET_CODE (sets[i].src) == ZERO_EXTEND)))
+           || sets[i].src_elt == 0)
          continue;
 
        /* STRICT_LOW_PART isn't part of the value BEING set,
@@ -5925,6 +5917,11 @@ cse_insn (rtx_insn *insn)
              sets[i].dest_hash = HASH (dest, GET_MODE (dest));
            }
 
+       /* If DEST is a paradoxical SUBREG, don't record DEST since the bits
+          outside the mode of GET_MODE (SUBREG_REG (dest)) are undefined.  */
+       if (paradoxical_subreg_p (dest))
+         continue;
+
        elt = insert (dest, sets[i].src_elt,
                      sets[i].dest_hash, GET_MODE (dest));
 
index b5ccb9a25a1303fa7eb6ffa0e8f999e82f534f6d..0b2a7f211a8301305d2b011cda822d019b3ce1f5 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR rtl-optimization/70903
+       * gcc.c-torture/execute/pr70903.c: New test.
+
 2016-08-04  Martin Liska  <mliska@suse.cz>
 
        * gcc.dg/params/params.exp: Replace file exists with
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70903.c b/gcc/testsuite/gcc.c-torture/execute/pr70903.c
new file mode 100644 (file)
index 0000000..6ffd0aa
--- /dev/null
@@ -0,0 +1,38 @@
+typedef unsigned char V8 __attribute__ ((vector_size (32)));
+typedef unsigned int V32 __attribute__ ((vector_size (32)));
+typedef unsigned long long V64 __attribute__ ((vector_size (32)));
+
+static V32 __attribute__ ((noinline, noclone))
+foo (V64 x)
+{
+  V64 y = (V64)(V8){((V8)(V64){65535, x[0]})[1]};
+  return (V32){y[0], 255};
+}
+
+int main ()
+{
+  V32 x = foo ((V64){});
+//  __builtin_printf ("%08x %08x %08x %08x %08x %08x %08x %08x\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
+  if (x[1] != 255)
+    __builtin_abort();
+  return 0;
+}
+typedef unsigned char V8 __attribute__ ((vector_size (32)));
+typedef unsigned int V32 __attribute__ ((vector_size (32)));
+typedef unsigned long long V64 __attribute__ ((vector_size (32)));
+
+static V32 __attribute__ ((noinline, noclone))
+foo (V64 x)
+{
+  V64 y = (V64)(V8){((V8)(V64){65535, x[0]})[1]};
+  return (V32){y[0], 255};
+}
+
+int main ()
+{
+  V32 x = foo ((V64){});
+//  __builtin_printf ("%08x %08x %08x %08x %08x %08x %08x %08x\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
+  if (x[1] != 255)
+    __builtin_abort();
+  return 0;
+}
This page took 0.13513 seconds and 5 git commands to generate.