[llvm] r329354 - [X86] Separate CDQ and CDQE in the scheduler model.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 14:56:19 PDT 2018


Author: ctopper
Date: Thu Apr  5 14:56:19 2018
New Revision: 329354

URL: http://llvm.org/viewvc/llvm-project?rev=329354&view=rev
Log:
[X86] Separate CDQ and CDQE in the scheduler model.

According to Agner's data, CDQE is closer to CWDE.

Modified:
    llvm/trunk/lib/Target/X86/X86SchedBroadwell.td
    llvm/trunk/lib/Target/X86/X86SchedHaswell.td
    llvm/trunk/lib/Target/X86/X86SchedSandyBridge.td
    llvm/trunk/lib/Target/X86/X86SchedSkylakeClient.td
    llvm/trunk/lib/Target/X86/X86SchedSkylakeServer.td
    llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll

Modified: llvm/trunk/lib/Target/X86/X86SchedBroadwell.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86SchedBroadwell.td?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86SchedBroadwell.td (original)
+++ llvm/trunk/lib/Target/X86/X86SchedBroadwell.td Thu Apr  5 14:56:19 2018
@@ -455,6 +455,7 @@ def BWWriteResGroup6 : SchedWriteRes<[BW
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
+def: InstRW<[BWWriteResGroup6], (instrs CDQ, CQO)>;
 def: InstRW<[BWWriteResGroup6], (instregex "ADC(16|32|64)ri",
                                            "ADC(16|32|64)i",
                                            "ADC(8|16|32|64)rr",
@@ -468,9 +469,7 @@ def: InstRW<[BWWriteResGroup6], (instreg
                                            "BTR(16|32|64)rr",
                                            "BTS(16|32|64)ri8",
                                            "BTS(16|32|64)rr",
-                                           "CDQ",
                                            "CMOV(AE|B|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)(16|32|64)rr",
-                                           "CQO",
                                            "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_1",
                                            "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_4",
                                            "JMP_1",
@@ -605,14 +604,13 @@ def BWWriteResGroup9 : SchedWriteRes<[BW
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
-def: InstRW<[BWWriteResGroup9], (instrs CWDE)>;
+def: InstRW<[BWWriteResGroup9], (instrs CBW, CWDE, CDQE)>;
 def: InstRW<[BWWriteResGroup9], (instregex "ADD(8|16|32|64)ri",
                                            "ADD(8|16|32|64)rr",
                                            "ADD(8|16|32|64)i",
                                            "AND(8|16|32|64)ri",
                                            "AND(8|16|32|64)rr",
                                            "AND(8|16|32|64)i",
-                                           "CBW",
                                            "CLC",
                                            "CMC",
                                            "CMP(8|16|32|64)ri",

Modified: llvm/trunk/lib/Target/X86/X86SchedHaswell.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86SchedHaswell.td?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86SchedHaswell.td (original)
+++ llvm/trunk/lib/Target/X86/X86SchedHaswell.td Thu Apr  5 14:56:19 2018
@@ -813,6 +813,7 @@ def HWWriteResGroup7 : SchedWriteRes<[HW
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
+def: InstRW<[HWWriteResGroup7], (instrs CDQ, CQO)>;
 def: InstRW<[HWWriteResGroup7], (instregex "BT(16|32|64)ri8",
                                            "BT(16|32|64)rr",
                                            "BTC(16|32|64)ri8",
@@ -821,8 +822,6 @@ def: InstRW<[HWWriteResGroup7], (instreg
                                            "BTR(16|32|64)rr",
                                            "BTS(16|32|64)ri8",
                                            "BTS(16|32|64)rr",
-                                           "CDQ",
-                                           "CQO",
                                            "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_1",
                                            "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_4",
                                            "JMP_1",
@@ -954,14 +953,13 @@ def HWWriteResGroup10 : SchedWriteRes<[H
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
-def: InstRW<[HWWriteResGroup10], (instrs CWDE)>;
+def: InstRW<[HWWriteResGroup10], (instrs CBW, CWDE, CDQE)>;
 def: InstRW<[HWWriteResGroup10], (instregex "ADD(8|16|32|64)ri",
                                             "ADD(8|16|32|64)rr",
                                             "ADD(8|16|32|64)i",
                                             "AND(8|16|32|64)ri",
                                             "AND(8|16|32|64)rr",
                                             "AND(8|16|32|64)i",
-                                            "CBW",
                                             "CLC",
                                             "CMC",
                                             "CMP(8|16|32|64)ri",

Modified: llvm/trunk/lib/Target/X86/X86SchedSandyBridge.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86SchedSandyBridge.td?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86SchedSandyBridge.td (original)
+++ llvm/trunk/lib/Target/X86/X86SchedSandyBridge.td Thu Apr  5 14:56:19 2018
@@ -369,6 +369,7 @@ def SBWriteResGroup4 : SchedWriteRes<[SB
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
+def: InstRW<[SBWriteResGroup4], (instrs CDQ, CQO)>;
 def: InstRW<[SBWriteResGroup4], (instregex "BT(16|32|64)ri8",
                                            "BT(16|32|64)rr",
                                            "BTC(16|32|64)ri8",
@@ -377,8 +378,6 @@ def: InstRW<[SBWriteResGroup4], (instreg
                                            "BTR(16|32|64)rr",
                                            "BTS(16|32|64)ri8",
                                            "BTS(16|32|64)rr",
-                                           "CDQ",
-                                           "CQO",
                                            "LAHF",
                                            "SAHF",
                                            "SAR(8|16|32|64)ri",
@@ -488,14 +487,13 @@ def SBWriteResGroup6 : SchedWriteRes<[SB
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
-def: InstRW<[SBWriteResGroup6], (instrs CWDE)>;
+def: InstRW<[SBWriteResGroup6], (instrs CBW, CWDE, CDQE)>;
 def: InstRW<[SBWriteResGroup6], (instregex "ADD(8|16|32|64)ri",
                                            "ADD(8|16|32|64)rr",
                                            "ADD(8|16|32|64)i",
                                            "AND(8|16|32|64)ri",
                                            "AND(8|16|32|64)rr",
                                            "AND(8|16|32|64)i",
-                                           "CBW",
                                            "CMC",
                                            "CMP(8|16|32|64)ri",
                                            "CMP(8|16|32|64)rr",

Modified: llvm/trunk/lib/Target/X86/X86SchedSkylakeClient.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86SchedSkylakeClient.td?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86SchedSkylakeClient.td (original)
+++ llvm/trunk/lib/Target/X86/X86SchedSkylakeClient.td Thu Apr  5 14:56:19 2018
@@ -519,6 +519,7 @@ def SKLWriteResGroup7 : SchedWriteRes<[S
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
+def: InstRW<[SKLWriteResGroup7], (instrs CDQ, CQO)>;
 def: InstRW<[SKLWriteResGroup7], (instregex "ADC(16|32|64)ri",
                                             "ADC(16|32|64)i",
                                             "ADC(8|16|32|64)rr",
@@ -532,10 +533,8 @@ def: InstRW<[SKLWriteResGroup7], (instre
                                             "BTR(16|32|64)rr",
                                             "BTS(16|32|64)ri8",
                                             "BTS(16|32|64)rr",
-                                            "CDQ",
                                             "CLAC",
                                             "CMOV(AE|B|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)(16|32|64)rr",
-                                            "CQO",
                                             "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_1",
                                             "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_4",
                                             "JMP_1",
@@ -609,14 +608,13 @@ def SKLWriteResGroup10 : SchedWriteRes<[
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
-def: InstRW<[SKLWriteResGroup10], (instrs CWDE)>;
+def: InstRW<[SKLWriteResGroup10], (instrs CBW, CWDE, CDQE)>;
 def: InstRW<[SKLWriteResGroup10], (instregex "ADD(8|16|32|64)ri",
                                              "ADD(8|16|32|64)rr",
                                              "ADD(8|16|32|64)i",
                                              "AND(8|16|32|64)ri",
                                              "AND(8|16|32|64)rr",
                                              "AND(8|16|32|64)i",
-                                             "CBW",
                                              "CLC",
                                              "CMC",
                                              "CMP(8|16|32|64)ri",

Modified: llvm/trunk/lib/Target/X86/X86SchedSkylakeServer.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86SchedSkylakeServer.td?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86SchedSkylakeServer.td (original)
+++ llvm/trunk/lib/Target/X86/X86SchedSkylakeServer.td Thu Apr  5 14:56:19 2018
@@ -995,6 +995,7 @@ def SKXWriteResGroup7 : SchedWriteRes<[S
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
+def: InstRW<[SKXWriteResGroup7], (instrs CDQ, CQO)>;
 def: InstRW<[SKXWriteResGroup7], (instregex "ADC(16|32|64)ri",
                                             "ADC(16|32|64)i",
                                             "ADC(8|16|32|64)rr",
@@ -1008,10 +1009,8 @@ def: InstRW<[SKXWriteResGroup7], (instre
                                             "BTR(16|32|64)rr",
                                             "BTS(16|32|64)ri8",
                                             "BTS(16|32|64)rr",
-                                            "CDQ",
                                             "CLAC",
                                             "CMOV(AE|B|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)(16|32|64)rr",
-                                            "CQO",
                                             "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_1",
                                             "J(A|AE|B|BE|E|G|GE|L|LE|NE|NO|NP|NS|O|P|S)_4",
                                             "JMP_1",
@@ -1269,14 +1268,13 @@ def SKXWriteResGroup10 : SchedWriteRes<[
   let NumMicroOps = 1;
   let ResourceCycles = [1];
 }
-def: InstRW<[SKXWriteResGroup10], (instrs CWDE)>;
+def: InstRW<[SKXWriteResGroup10], (instrs CBW, CWDE, CDQE)>;
 def: InstRW<[SKXWriteResGroup10], (instregex "ADD(8|16|32|64)ri",
                                              "ADD(8|16|32|64)rr",
                                              "ADD(8|16|32|64)i",
                                              "AND(8|16|32|64)ri",
                                              "AND(8|16|32|64)rr",
                                              "AND(8|16|32|64)i",
-                                             "CBW",
                                              "CLC",
                                              "CMC",
                                              "CMP(8|16|32|64)ri",

Modified: llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll?rev=329354&r1=329353&r2=329354&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll Thu Apr  5 14:56:19 2018
@@ -3343,7 +3343,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; GENERIC-NEXT:    #APP
 ; GENERIC-NEXT:    cbtw # sched: [1:0.33]
 ; GENERIC-NEXT:    cltd # sched: [1:0.50]
-; GENERIC-NEXT:    cltq # sched: [1:0.50]
+; GENERIC-NEXT:    cltq # sched: [1:0.33]
 ; GENERIC-NEXT:    cqto # sched: [1:0.50]
 ; GENERIC-NEXT:    cwtd # sched: [2:1.00]
 ; GENERIC-NEXT:    cwtl # sched: [1:0.33]
@@ -3379,7 +3379,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; SANDY-NEXT:    #APP
 ; SANDY-NEXT:    cbtw # sched: [1:0.33]
 ; SANDY-NEXT:    cltd # sched: [1:0.50]
-; SANDY-NEXT:    cltq # sched: [1:0.50]
+; SANDY-NEXT:    cltq # sched: [1:0.33]
 ; SANDY-NEXT:    cqto # sched: [1:0.50]
 ; SANDY-NEXT:    cwtd # sched: [2:1.00]
 ; SANDY-NEXT:    cwtl # sched: [1:0.33]
@@ -3391,7 +3391,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; HASWELL-NEXT:    #APP
 ; HASWELL-NEXT:    cbtw # sched: [1:0.25]
 ; HASWELL-NEXT:    cltd # sched: [1:0.50]
-; HASWELL-NEXT:    cltq # sched: [1:0.50]
+; HASWELL-NEXT:    cltq # sched: [1:0.25]
 ; HASWELL-NEXT:    cqto # sched: [1:0.50]
 ; HASWELL-NEXT:    cwtd # sched: [2:0.50]
 ; HASWELL-NEXT:    cwtl # sched: [1:0.25]
@@ -3403,7 +3403,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; BROADWELL-NEXT:    #APP
 ; BROADWELL-NEXT:    cbtw # sched: [1:0.25]
 ; BROADWELL-NEXT:    cltd # sched: [1:0.50]
-; BROADWELL-NEXT:    cltq # sched: [1:0.50]
+; BROADWELL-NEXT:    cltq # sched: [1:0.25]
 ; BROADWELL-NEXT:    cqto # sched: [1:0.50]
 ; BROADWELL-NEXT:    cwtd # sched: [2:0.50]
 ; BROADWELL-NEXT:    cwtl # sched: [1:0.25]
@@ -3415,7 +3415,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; SKYLAKE-NEXT:    #APP
 ; SKYLAKE-NEXT:    cbtw # sched: [1:0.25]
 ; SKYLAKE-NEXT:    cltd # sched: [1:0.50]
-; SKYLAKE-NEXT:    cltq # sched: [1:0.50]
+; SKYLAKE-NEXT:    cltq # sched: [1:0.25]
 ; SKYLAKE-NEXT:    cqto # sched: [1:0.50]
 ; SKYLAKE-NEXT:    cwtd # sched: [2:0.50]
 ; SKYLAKE-NEXT:    cwtl # sched: [1:0.25]
@@ -3427,7 +3427,7 @@ define void @test_cbw_cdq_cdqe_cqo_cwd_c
 ; SKX-NEXT:    #APP
 ; SKX-NEXT:    cbtw # sched: [1:0.25]
 ; SKX-NEXT:    cltd # sched: [1:0.50]
-; SKX-NEXT:    cltq # sched: [1:0.50]
+; SKX-NEXT:    cltq # sched: [1:0.25]
 ; SKX-NEXT:    cqto # sched: [1:0.50]
 ; SKX-NEXT:    cwtd # sched: [2:0.50]
 ; SKX-NEXT:    cwtl # sched: [1:0.25]




More information about the llvm-commits mailing list