[2/2] Tune memcpy and memset for Zen cores.

Message ID da29675e-25ee-9a1e-6baf-12d844b42a66@suse.cz
State New
Headers show
Series
  • [1/2] Re-format zen memcpy/memset costs.
Related show

Commit Message

Martin Liška June 1, 2020, 11:35 a.m.
Based on the collected numbers in PR95435, I suggest the following
tuning changes:

gcc/ChangeLog:

	PR target/95435
	* config/i386/x86-tune-costs.h: Use libcall for large sizes for
	-m32. Start using libcall from 128+ bytes.
---
  gcc/config/i386/x86-tune-costs.h | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.26.2

Comments

Martin Liška June 1, 2020, 11:40 a.m. | #1
Adding Honza as Uros recommended him for a review.

Martin

On 6/1/20 1:35 PM, Martin Liška wrote:
> Based on the collected numbers in PR95435, I suggest the following

> tuning changes:

> 

> gcc/ChangeLog:

> 

>      PR target/95435

>      * config/i386/x86-tune-costs.h: Use libcall for large sizes for

>      -m32. Start using libcall from 128+ bytes.

> ---

>   gcc/config/i386/x86-tune-costs.h | 12 ++++++------

>   1 file changed, 6 insertions(+), 6 deletions(-)

> 

> diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h

> index 1169178433f..3207404e514 100644

> --- a/gcc/config/i386/x86-tune-costs.h

> +++ b/gcc/config/i386/x86-tune-costs.h

> @@ -1314,20 +1314,20 @@ static stringop_algs znver1_memcpy[2] = {

>     /* 32-bit tuning.  */

>     {libcall, {{6, loop, false},

>            {14, unrolled_loop, false},

> -         {-1, rep_prefix_4_byte, false}}},

> +         {-1, libcall, false}}},

>     /* 64-bit tuning.  */

>     {libcall, {{16, loop, false},

> -         {8192, rep_prefix_8_byte, false},

> +         {128, rep_prefix_8_byte, false},

>            {-1, libcall, false}}}};

>   static stringop_algs znver1_memset[2] = {

>     /* 32-bit tuning.  */

>     {libcall, {{8, loop, false},

>            {24, unrolled_loop, false},

> -         {2048, rep_prefix_4_byte, false},

> +         {128, rep_prefix_4_byte, false},

>            {-1, libcall, false}}},

>     /* 64-bit tuning.  */

>     {libcall, {{48, unrolled_loop, false},

> -         {8192, rep_prefix_8_byte, false},

> +         {128, rep_prefix_8_byte, false},

>            {-1, libcall, false}}}};

>   struct processor_costs znver1_cost = {

>     {

> @@ -1460,7 +1460,7 @@ static stringop_algs znver2_memcpy[2] = {

>     /* 32-bit tuning.  */

>     {libcall, {{6, loop, false},

>            {14, unrolled_loop, false},

> -         {-1, rep_prefix_4_byte, false}}},

> +         {-1, libcall, false}}},

>     /* 64-bit tuning.  */

>     {libcall, {{16, loop, false},

>            {64, rep_prefix_4_byte, false},

> @@ -1469,7 +1469,7 @@ static stringop_algs znver2_memset[2] = {

>     /* 32-bit tuning.  */

>     {libcall, {{8, loop, false},

>            {24, unrolled_loop, false},

> -         {2048, rep_prefix_4_byte, false}

> +         {128, rep_prefix_4_byte, false},

>            {-1, libcall, false}}},

>     /* 64-bit tuning.  */

>     {libcall, {{24, rep_prefix_4_byte, false},
Martin Liška June 3, 2020, 9:14 a.m. | #2
On 6/1/20 1:40 PM, Martin Liška wrote:
> Adding Honza as Uros recommended him for a review.


@Honza asked me personally to remind him this patch ;)

Martin
Martin Liška June 12, 2020, 8:31 a.m. | #3
PING^2

On 6/3/20 11:14 AM, Martin Liška wrote:
> On 6/1/20 1:40 PM, Martin Liška wrote:

>> Adding Honza as Uros recommended him for a review.

> 

> @Honza asked me personally to remind him this patch ;)

> 

> Martin
Martin Liška June 30, 2020, 10:13 a.m. | #4
PING^3

On 6/12/20 10:31 AM, Martin Liška wrote:
> PING^2

> 

> On 6/3/20 11:14 AM, Martin Liška wrote:

>> On 6/1/20 1:40 PM, Martin Liška wrote:

>>> Adding Honza as Uros recommended him for a review.

>>

>> @Honza asked me personally to remind him this patch ;)

>>

>> Martin

>
Jan Hubicka July 29, 2020, 3:44 p.m. | #5
> Based on the collected numbers in PR95435, I suggest the following

> tuning changes:

> 

> gcc/ChangeLog:

> 

> 	PR target/95435

> 	* config/i386/x86-tune-costs.h: Use libcall for large sizes for

> 	-m32. Start using libcall from 128+ bytes.


OK,
thanks!
Honza
> ---

>  gcc/config/i386/x86-tune-costs.h | 12 ++++++------

>  1 file changed, 6 insertions(+), 6 deletions(-)

> 

> diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h

> index 1169178433f..3207404e514 100644

> --- a/gcc/config/i386/x86-tune-costs.h

> +++ b/gcc/config/i386/x86-tune-costs.h

> @@ -1314,20 +1314,20 @@ static stringop_algs znver1_memcpy[2] = {

>    /* 32-bit tuning.  */

>    {libcall, {{6, loop, false},

>  	     {14, unrolled_loop, false},

> -	     {-1, rep_prefix_4_byte, false}}},

> +	     {-1, libcall, false}}},

>    /* 64-bit tuning.  */

>    {libcall, {{16, loop, false},

> -	     {8192, rep_prefix_8_byte, false},

> +	     {128, rep_prefix_8_byte, false},

>  	     {-1, libcall, false}}}};

>  static stringop_algs znver1_memset[2] = {

>    /* 32-bit tuning.  */

>    {libcall, {{8, loop, false},

>  	     {24, unrolled_loop, false},

> -	     {2048, rep_prefix_4_byte, false},

> +	     {128, rep_prefix_4_byte, false},

>  	     {-1, libcall, false}}},

>    /* 64-bit tuning.  */

>    {libcall, {{48, unrolled_loop, false},

> -	     {8192, rep_prefix_8_byte, false},

> +	     {128, rep_prefix_8_byte, false},

>  	     {-1, libcall, false}}}};

>  struct processor_costs znver1_cost = {

>    {

> @@ -1460,7 +1460,7 @@ static stringop_algs znver2_memcpy[2] = {

>    /* 32-bit tuning.  */

>    {libcall, {{6, loop, false},

>  	     {14, unrolled_loop, false},

> -	     {-1, rep_prefix_4_byte, false}}},

> +	     {-1, libcall, false}}},

>    /* 64-bit tuning.  */

>    {libcall, {{16, loop, false},

>  	     {64, rep_prefix_4_byte, false},

> @@ -1469,7 +1469,7 @@ static stringop_algs znver2_memset[2] = {

>    /* 32-bit tuning.  */

>    {libcall, {{8, loop, false},

>  	     {24, unrolled_loop, false},

> -	     {2048, rep_prefix_4_byte, false}

> +	     {128, rep_prefix_4_byte, false},

>  	     {-1, libcall, false}}},

>    /* 64-bit tuning.  */

>    {libcall, {{24, rep_prefix_4_byte, false},

> -- 

> 2.26.2

>

Patch

diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h
index 1169178433f..3207404e514 100644
--- a/gcc/config/i386/x86-tune-costs.h
+++ b/gcc/config/i386/x86-tune-costs.h
@@ -1314,20 +1314,20 @@  static stringop_algs znver1_memcpy[2] = {
    /* 32-bit tuning.  */
    {libcall, {{6, loop, false},
  	     {14, unrolled_loop, false},
-	     {-1, rep_prefix_4_byte, false}}},
+	     {-1, libcall, false}}},
    /* 64-bit tuning.  */
    {libcall, {{16, loop, false},
-	     {8192, rep_prefix_8_byte, false},
+	     {128, rep_prefix_8_byte, false},
  	     {-1, libcall, false}}}};
  static stringop_algs znver1_memset[2] = {
    /* 32-bit tuning.  */
    {libcall, {{8, loop, false},
  	     {24, unrolled_loop, false},
-	     {2048, rep_prefix_4_byte, false},
+	     {128, rep_prefix_4_byte, false},
  	     {-1, libcall, false}}},
    /* 64-bit tuning.  */
    {libcall, {{48, unrolled_loop, false},
-	     {8192, rep_prefix_8_byte, false},
+	     {128, rep_prefix_8_byte, false},
  	     {-1, libcall, false}}}};
  struct processor_costs znver1_cost = {
    {
@@ -1460,7 +1460,7 @@  static stringop_algs znver2_memcpy[2] = {
    /* 32-bit tuning.  */
    {libcall, {{6, loop, false},
  	     {14, unrolled_loop, false},
-	     {-1, rep_prefix_4_byte, false}}},
+	     {-1, libcall, false}}},
    /* 64-bit tuning.  */
    {libcall, {{16, loop, false},
  	     {64, rep_prefix_4_byte, false},
@@ -1469,7 +1469,7 @@  static stringop_algs znver2_memset[2] = {
    /* 32-bit tuning.  */
    {libcall, {{8, loop, false},
  	     {24, unrolled_loop, false},
-	     {2048, rep_prefix_4_byte, false}
+	     {128, rep_prefix_4_byte, false},
  	     {-1, libcall, false}}},
    /* 64-bit tuning.  */
    {libcall, {{24, rep_prefix_4_byte, false},