]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport PRs 49429, 49454, 86334, 88906
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 11:29:57 +0000 (13:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 11:29:57 +0000 (13:29 +0200)
Backported from mainline
2019-01-22  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/49429
PR target/49454
PR rtl-optimization/86334
PR target/88906
* expr.c (emit_block_move_hints): Move marking of MEM_EXPRs
addressable from here...
(emit_block_op_via_libcall): ... to here.

* gcc.target/i386/pr86334.c: New test.
* gcc.target/i386/pr88906.c: New test.

From-SVN: r275090

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr86334.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr88906.c [new file with mode: 0644]

index 273c7fc0b7729873c748f027aa36c702f74a24f1..0ed72ae8b32a246025a4f3132a1a3c6b73dadad3 100644 (file)
@@ -1,6 +1,16 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-01-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/49429
+       PR target/49454
+       PR rtl-optimization/86334
+       PR target/88906
+       * expr.c (emit_block_move_hints): Move marking of MEM_EXPRs
+       addressable from here...
+       (emit_block_op_via_libcall): ... to here.
+
        2019-01-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/88870
index 08345992dc7c737ab0c5b4ca82f657469ade1d12..2f27c732ef9724c7efa9c12fedeeb054d2874930 100644 (file)
@@ -1607,18 +1607,8 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
   else if (may_use_call
           && ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (x))
           && ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (y)))
-    {
-      /* Since x and y are passed to a libcall, mark the corresponding
-        tree EXPR as addressable.  */
-      tree y_expr = MEM_EXPR (y);
-      tree x_expr = MEM_EXPR (x);
-      if (y_expr)
-       mark_addressable (y_expr);
-      if (x_expr)
-       mark_addressable (x_expr);
-      retval = emit_block_copy_via_libcall (x, y, size,
-                                           method == BLOCK_OP_TAILCALL);
-    }
+    retval = emit_block_copy_via_libcall (x, y, size,
+                                         method == BLOCK_OP_TAILCALL);
 
   else
     emit_block_move_via_loop (x, y, size, align);
@@ -1859,6 +1849,15 @@ emit_block_op_via_libcall (enum built_in_function fncode, rtx dst, rtx src,
   tree call_expr, dst_tree, src_tree, size_tree;
   machine_mode size_mode;
 
+  /* Since dst and src are passed to a libcall, mark the corresponding
+     tree EXPR as addressable.  */
+  tree dst_expr = MEM_EXPR (dst);
+  tree src_expr = MEM_EXPR (src);
+  if (dst_expr)
+    mark_addressable (dst_expr);
+  if (src_expr)
+    mark_addressable (src_expr);
+
   dst_addr = copy_addr_to_reg (XEXP (dst, 0));
   dst_addr = convert_memory_address (ptr_mode, dst_addr);
   dst_tree = make_tree (ptr_type_node, dst_addr);
index 1c551a8be24c2820869b70430b291799716d93c9..8b2cd793cdc2c424d9574e383612fe32592b9cb4 100644 (file)
@@ -1,6 +1,15 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-01-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/49429
+       PR target/49454
+       PR rtl-optimization/86334
+       PR target/88906
+       * gcc.target/i386/pr86334.c: New test.
+       * gcc.target/i386/pr88906.c: New test.
+
        2019-01-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/88949
diff --git a/gcc/testsuite/gcc.target/i386/pr86334.c b/gcc/testsuite/gcc.target/i386/pr86334.c
new file mode 100644 (file)
index 0000000..79ed692
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/86334 */
+/* { dg-do run { target ia32 } } */
+/* { dg-options "-O -march=i386 -mtune=athlon -minline-all-stringops -minline-stringops-dynamically -mmemcpy-strategy=libcall:-1:align -Wno-psabi" } */
+
+typedef int V __attribute__ ((vector_size (64)));
+
+static inline V
+foo (V g)
+{
+  g[0] = 4;
+  return g;
+}
+
+int
+main ()
+{
+  V x = foo ((V) { });
+  if (x[0] != 4 || x[1] || x[2] || x[3] || x[4] || x[5] || x[6] || x[7])
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr88906.c b/gcc/testsuite/gcc.target/i386/pr88906.c
new file mode 100644 (file)
index 0000000..5439a28
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/88906 */
+/* { dg-do run { target ia32 } } */
+/* { dg-options "-O -march=i386 -mtune=k6 -minline-all-stringops -minline-stringops-dynamically -mmemcpy-strategy=libcall:-1:align -Wno-psabi" } */
+
+typedef unsigned V __attribute__ ((vector_size (16)));
+
+static inline V
+foo (V v)
+{
+  __builtin_sub_overflow (0, 0, &v[0]);
+  return v;
+}
+
+int
+main ()
+{
+  V v = foo ((V) { ~0 });
+  if (v[0] || v[1] || v[2] || v[3])
+    __builtin_abort ();
+  return 0;
+}