Add test for memcpy expansion with hint.
authorMartin Liska <mliska@suse.cz>
Mon, 27 Aug 2018 13:18:43 +0000 (15:18 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 27 Aug 2018 13:18:43 +0000 (13:18 +0000)
2018-08-27  Martin Liska  <mliska@suse.cz>

* config/i386/i386.c (ix86_expand_set_or_movmem): Dump
        selected expansion strategy.
2018-08-27  Martin Liska  <mliska@suse.cz>

* gcc.dg/tree-prof/val-prof-10.c: New test.

From-SVN: r263881

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-prof/val-prof-10.c [new file with mode: 0644]

index 459bcaddc079245cff4f99a1af9f2f66580eef47..6c79e41f2db687d182d26e9a497b7eb2fa0a07ee 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-27  Martin Liska  <mliska@suse.cz>
+
+       * config/i386/i386.c (ix86_expand_set_or_movmem): Dump
+        selected expansion strategy.
+
 2018-08-27  Martin Liska  <mliska@suse.cz>
 
        * builtins.h (is_builtin_fn): Remove and fndecl_built_in_p.
index eab482c4c841ee4864526c8ce872c3a89643ef1d..c437c18a29cf943cc4ac34d93ec646b9a33582b7 100644 (file)
@@ -27530,6 +27530,11 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
                    issetmem,
                    issetmem && val_exp == const0_rtx, have_as,
                    &dynamic_check, &noalign, false);
+
+  if (dump_file)
+    fprintf (dump_file, "Selected stringop expansion strategy: %s\n",
+            stringop_alg_names[alg]);
+
   if (alg == libcall)
     return false;
   gcc_assert (alg != no_stringop);
index 6e74b17c2fc879265bd0b408d16c85386e33df30..6e6ffd84ff2a9c256df37c02e0b7cbeefa240369 100644 (file)
@@ -1,3 +1,7 @@
+2018-08-27  Martin Liska  <mliska@suse.cz>
+
+       * gcc.dg/tree-prof/val-prof-10.c: New test.
+
 2018-08-27  Martin Liska  <mliska@suse.cz>
 
         PR tree-optimization/86847
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-10.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-10.c
new file mode 100644 (file)
index 0000000..57854b5
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-options "-O2 -fdump-rtl-expand -mtune=core2" } */
+/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */
+
+long buffer1[128], buffer2[128];
+char *x;
+
+void foo(long *r)
+{
+  x = (char *)r;
+  asm volatile("" ::: "memory");
+}
+
+void
+__attribute__((noinline))
+compute()
+{
+  volatile int n = 24;
+  __builtin_memcpy (buffer1, buffer2, n);
+  foo (&buffer1[0]);
+}
+
+int
+main()
+{
+  for (unsigned i = 0; i < 10000; i++)
+    compute ();
+
+  return 0;
+}
+
+/* { dg-final-use-not-autofdo { scan-rtl-dump "Selected stringop expansion strategy: rep_byte" "expand" } } */