aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2014-12-02 14:10:23 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2014-12-02 06:10:23 -0800
commit0f884e6709dac066e558c6a63c50a5149ab408f3 (patch)
tree8519c84ca3cfd4e5b3c4e7acd089cd6330aa87ec
parentfb98f8869b20ecc3ee1f6cb473ab6d7b3c34ece7 (diff)
downloadgcc-0f884e6709dac066e558c6a63c50a5149ab408f3.zip
gcc-0f884e6709dac066e558c6a63c50a5149ab408f3.tar.gz
gcc-0f884e6709dac066e558c6a63c50a5149ab408f3.tar.bz2
Stop only if there aren't any usable algorithms
When searching for an usable algorithm with -minline-all-stringops, decide_alg stops when it sees libcall even if there is a usable algorithm. It goes into an infinite loop. This patch changes decide_alg to stop searching only if there aren't any usable algorithms. Testd on Linux/x86-64. gcc/ PR target/64108 * config/i386/i386.c (decide_alg): Stop only if there aren't any usable algorithms. gcc/testsuite/ PR target/64108 * gcc.target/i386/memset-strategy-2.c: New test. From-SVN: r218272
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/memset-strategy-2.c10
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3eacc5a..c746d0f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64108
+ * config/i386/i386.c (decide_alg): Stop only if there aren't
+ any usable algorithms.
+
2014-12-02 Tom de Vries <tom@codesourcery.com>
PR rtl-optimization/63718
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3397167..211c9e6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -24464,7 +24464,8 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
*noalign = alg_noalign;
return alg;
}
- break;
+ else if (!any_alg_usable_p)
+ break;
}
else if (alg_usable_p (candidate, memset))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 00da0bd..5d66849 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/64108
+ * gcc.target/i386/memset-strategy-2.c: New test.
+
2014-12-02 Richard Biener <rguenther@suse.de>
* gcc.dg/torture/20141202-1.c: New testcase.
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-2.c b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
new file mode 100644
index 0000000..aafa54d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
@@ -0,0 +1,10 @@
+/* PR target/64108 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align -minline-all-stringops" } */
+
+char a[2048];
+void t (void)
+{
+ __builtin_memset (a, 1, 2048);
+}
+