[gcc r10-9638] Fix idiv latencies for znver3

Jan Hubicka hubicka@gcc.gnu.org
Wed Mar 31 12:57:40 GMT 2021


https://gcc.gnu.org/g:078f5545b5242dc62a82ee9e000773435f1b842b

commit r10-9638-g078f5545b5242dc62a82ee9e000773435f1b842b
Author: Jan Hubicka <jh@suse.cz>
Date:   Thu Mar 18 17:15:34 2021 +0100

    Fix idiv latencies for znver3
    
    update costs of integer divides to match actual latencies (the scheduler model
    already does the right thing).  It is essentially no-op, since we end up
    expanding idiv for all sensible constants, so this only may end up disabling
    vectorization in some cases, but I did not find any such examples.  However in
    general it is better ot have actual latencies than random numbers.
    
    gcc/ChangeLog:
    
    2021-03-18  Jan Hubicka  <hubicka@ucw.cz>
    
            * config/i386/x86-tune-costs.h (struct processor_costs): Fix costs of
            integer divides1.
    
    (cherry picked from commit ab03c0d5753549f1a78eeb706510b55fb97c8651)

Diff:
---
 gcc/config/i386/x86-tune-costs.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h
index cb9dccb6409..fc3f8cc87a0 100644
--- a/gcc/config/i386/x86-tune-costs.h
+++ b/gcc/config/i386/x86-tune-costs.h
@@ -1651,13 +1651,11 @@ struct processor_costs znver3_cost = {
    COSTS_N_INSNS (3)},			/*			other.  */
   0,					/* cost of multiply per each bit
 					   set.  */
-   /* Depending on parameters, idiv can get faster on ryzen.  This is upper
-      bound.  */
-  {COSTS_N_INSNS (16),			/* cost of a divide/mod for QI.  */
-   COSTS_N_INSNS (22),			/* 			    HI.  */
-   COSTS_N_INSNS (30),			/*			    SI.  */
-   COSTS_N_INSNS (45),			/*			    DI.  */
-   COSTS_N_INSNS (45)},			/*			    other.  */
+  {COSTS_N_INSNS (9),			/* cost of a divide/mod for QI.  */
+   COSTS_N_INSNS (10),			/* 			    HI.  */
+   COSTS_N_INSNS (12),			/*			    SI.  */
+   COSTS_N_INSNS (17),			/*			    DI.  */
+   COSTS_N_INSNS (17)},			/*			    other.  */
   COSTS_N_INSNS (1),			/* cost of movsx.  */
   COSTS_N_INSNS (1),			/* cost of movzx.  */
   8,					/* "large" insn.  */


More information about the Gcc-cvs mailing list