Increase MOVE_RATIO to 17 for Lakemont
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 18 Aug 2016 14:59:46 +0000 (14:59 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 18 Aug 2016 14:59:46 +0000 (07:59 -0700)
Larger MOVE_RATIO will always make code faster.  17 is the number with
smaller code sizes for Lakemont.

gcc/

PR target/72839
* config/i386/i386.c (lakemont_cost): Set MOVE_RATIO to 17.

gcc/testsuite/

PR target/72839
* gcc.target/i386/pr72839.c: New test.

From-SVN: r239578

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

index da653161a66b574884c4204a45b651896080c314..c54e103d69828d2f389bd748600ed75bddbafb48 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/72839
+       * config/i386/i386.c (lakemont_cost): Set MOVE_RATIO to 17.
+
 2016-08-18  Chung-Lin Tang  <cltang@codesourcery.com>
 
        PR middle-end/70895
index e2c9f7242bd9a9c14a1272351077e9641230ec30..be027f5e2dd2ea750aff3d10e24b363e018704a9 100644 (file)
@@ -426,7 +426,7 @@ struct processor_costs lakemont_cost = {
   COSTS_N_INSNS (3),                   /* cost of movsx */
   COSTS_N_INSNS (2),                   /* cost of movzx */
   8,                                   /* "large" insn */
-  9,                                   /* MOVE_RATIO */
+  17,                                  /* MOVE_RATIO */
   6,                                /* cost for loading QImode using movzbl */
   {2, 4, 2},                           /* cost of loading integer registers
                                           in QImode, HImode and SImode.
index 76799287e46476778dd31dc1c67f3db8c1d08e6d..c35808f9402f8bfa002fc4d6bcd05f692bd2528c 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/72839
+       * gcc.target/i386/pr72839.c: New test.
+
 2016-08-18  Chung-Lin Tang  <cltang@codesourcery.com>
 
        PR middle-end/70895
diff --git a/gcc/testsuite/gcc.target/i386/pr72839.c b/gcc/testsuite/gcc.target/i386/pr72839.c
new file mode 100644 (file)
index 0000000..ea724f7
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ia32 } */
+/* { dg-options "-O2 -mtune=lakemont" } */
+
+extern char *strcpy (char *, const char *);
+
+void
+foo (char *s)
+{
+  strcpy (s,
+         "12345678123456781234567812345678123456781234567812345678"
+         "1234567");
+}
+
+/* { dg-final { scan-assembler-times "movl\[ \\t\]+\\$\[0-9\]+, \[0-9\]*\\(%\[^,\]+\\)" 16 } } */
+/* { dg-final { scan-assembler-not "rep movsl" } } */
+/* { dg-final { scan-assembler-not "rep movsb" } } */