diff mbox

PR target/72839: Increase MOVE_RATIO to 17 for Lakemont

Message ID 20160817182636.GA16702@intel.com
State New
Headers show

Commit Message

H.J. Lu Aug. 17, 2016, 6:26 p.m. UTC
Larger MOVE_RATIO will always make code faster.  17 is the number with
smaller code sizes for Lakemont.

Tested on x86-64.  OK for trunk?


H.J.
---
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.
---
 gcc/config/i386/i386.c                  |  2 +-
 gcc/testsuite/gcc.target/i386/pr72839.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr72839.c

Comments

Uros Bizjak Aug. 18, 2016, 6:16 a.m. UTC | #1
On Wed, Aug 17, 2016 at 8:26 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Larger MOVE_RATIO will always make code faster.  17 is the number with
> smaller code sizes for Lakemont.
>
> Tested on x86-64.  OK for trunk?

OK, I assume that the patch is based on some benchmark.

Thanks,
Uros.

>
> H.J.
> ---
> 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.
> ---
>  gcc/config/i386/i386.c                  |  2 +-
>  gcc/testsuite/gcc.target/i386/pr72839.c | 17 +++++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr72839.c
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 3805817..8fe3821 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -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.
> diff --git a/gcc/testsuite/gcc.target/i386/pr72839.c b/gcc/testsuite/gcc.target/i386/pr72839.c
> new file mode 100644
> index 0000000..ea724f7
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr72839.c
> @@ -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" } } */
> --
> 2.7.4
>
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3805817..8fe3821 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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.
diff --git a/gcc/testsuite/gcc.target/i386/pr72839.c b/gcc/testsuite/gcc.target/i386/pr72839.c
new file mode 100644
index 0000000..ea724f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr72839.c
@@ -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" } } */