]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/70062 (ICE: in decide_alg, at config/i386/i386.c:26173 with -mmemcpy...
authorJakub Jelinek <jakub@redhat.com>
Fri, 4 Mar 2016 20:28:27 +0000 (21:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 4 Mar 2016 20:28:27 +0000 (21:28 +0100)
PR target/70062
* config/i386/i386.c (decide_alg): Add RECUR argument.  Revert
2016-02-22 changes, instead don't recurse if RECUR is already true.
Don't change *dynamic_check if RECUR.  Adjust recursive caller
to pass true to the new argument.
(ix86_expand_set_or_movmem): Adjust decide_alg caller.

* gcc.target/i386/pr70062.c: New test.

From-SVN: r233979

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr70062.c [new file with mode: 0644]

index a65e347054defc62096a3ca5c3bb4f8b27968656..ea4e2d52491d3cf94b3e91a6122004519a592e4b 100644 (file)
@@ -1,5 +1,12 @@
 2016-03-04  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/70062
+       * config/i386/i386.c (decide_alg): Add RECUR argument.  Revert
+       2016-02-22 changes, instead don't recurse if RECUR is already true.
+       Don't change *dynamic_check if RECUR.  Adjust recursive caller
+       to pass true to the new argument.
+       (ix86_expand_set_or_movmem): Adjust decide_alg caller.
+
        PR target/70059
        * config/i386/sse.md (vec_set_lo_<mode><mask_name>,
        <extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask): Formatting
index 8a026aeb009da258be24292374e6e5c618ee3cb1..1f98d5bdd171277617851dee25def90c0648b5ba 100644 (file)
@@ -26032,14 +26032,13 @@ static enum stringop_alg
 decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
            unsigned HOST_WIDE_INT min_size, unsigned HOST_WIDE_INT max_size,
            bool memset, bool zero_memset, bool have_as,
-           int *dynamic_check, bool *noalign)
+           int *dynamic_check, bool *noalign, bool recur)
 {
   const struct stringop_algs *algs;
   bool optimize_for_speed;
   int max = 0;
   const struct processor_costs *cost;
   int i;
-  HOST_WIDE_INT orig_expected_size = expected_size;
   bool any_alg_usable_p = false;
 
   *noalign = false;
@@ -26157,19 +26156,18 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
       enum stringop_alg alg;
       HOST_WIDE_INT new_expected_size = (max > 0 ? max : 4096) / 2;
 
-      /* If there aren't any usable algorithms or if recursing with the
-        same arguments as before, then recursing on smaller sizes or
-        same size isn't going to find anything.  Just return the simple
-        byte-at-a-time copy loop.  */
-      if (!any_alg_usable_p || orig_expected_size == new_expected_size)
-        {
-          /* Pick something reasonable.  */
-          if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
-            *dynamic_check = 128;
-          return loop_1_byte;
-        }
+      /* If there aren't any usable algorithms or if recursing already,
+        then recursing on smaller sizes or same size isn't going to
+        find anything.  Just return the simple byte-at-a-time copy loop.  */
+      if (!any_alg_usable_p || recur)
+       {
+         /* Pick something reasonable.  */
+         if (TARGET_INLINE_STRINGOPS_DYNAMICALLY && !recur)
+           *dynamic_check = 128;
+         return loop_1_byte;
+       }
       alg = decide_alg (count, new_expected_size, min_size, max_size, memset,
-                       zero_memset, have_as, dynamic_check, noalign);
+                       zero_memset, have_as, dynamic_check, noalign, true);
       gcc_assert (*dynamic_check == -1);
       if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
        *dynamic_check = max;
@@ -26430,7 +26428,7 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
   alg = decide_alg (count, expected_size, min_size, probable_max_size,
                    issetmem,
                    issetmem && val_exp == const0_rtx, have_as,
-                   &dynamic_check, &noalign);
+                   &dynamic_check, &noalign, false);
   if (alg == libcall)
     return false;
   gcc_assert (alg != no_stringop);
index 84c427593ec94f7f960ddab34784a8659548309e..763364ff42ff3bdb15bfcfb86b0f5a2ee7d03be6 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/70062
+       * gcc.target/i386/pr70062.c: New test.
+
 2016-03-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * g++.dg/template/typename21.C: Remove c++98_only.
diff --git a/gcc/testsuite/gcc.target/i386/pr70062.c b/gcc/testsuite/gcc.target/i386/pr70062.c
new file mode 100644 (file)
index 0000000..e5cb854
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/70062 */
+/* { dg-options "-minline-all-stringops -minline-stringops-dynamically -mmemcpy-strategy=libcall:-1:noalign -Wno-psabi" } */
+/* { dg-additional-options "-mtune=k6-2" { target ia32 } } */
+
+typedef int V __attribute__ ((vector_size (32)));
+
+V
+foo (V x)
+{
+  return (V) { x[0] };
+}