Index: lib/Target/X86/X86InstrInfo.td =================================================================== --- lib/Target/X86/X86InstrInfo.td +++ lib/Target/X86/X86InstrInfo.td @@ -2061,7 +2061,7 @@ } -let SchedRW = [WriteALU], hasSideEffects = 0 in { +let SchedRW = [WriteCMPXCHG], hasSideEffects = 0 in { let Defs = [AL, EFLAGS], Uses = [AL] in def CMPXCHG8rr : I<0xB0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src), "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB, Index: lib/Target/X86/X86SchedBroadwell.td =================================================================== --- lib/Target/X86/X86SchedBroadwell.td +++ lib/Target/X86/X86SchedBroadwell.td @@ -119,8 +119,9 @@ defm : BWWriteResPair; defm : BWWriteResPair; -defm : BWWriteResPair; // -defm : BWWriteResPair; // +defm : BWWriteResPair; +defm : BWWriteResPair; +defm : BWWriteResPair; defm : BWWriteResPair; def : WriteRes { let Latency = 3; } // Integer multiplication, high part. @@ -957,13 +958,6 @@ } def: InstRW<[BWWriteResGroup55], (instrs XSETBV)>; -def BWWriteResGroup56 : SchedWriteRes<[BWPort06,BWPort0156]> { - let Latency = 5; - let NumMicroOps = 5; - let ResourceCycles = [2,3]; -} -def: InstRW<[BWWriteResGroup56], (instregex "CMPXCHG(8|16|32|64)rr")>; - def BWWriteResGroup57 : SchedWriteRes<[BWPort4,BWPort237,BWPort0156]> { let Latency = 5; let NumMicroOps = 6; Index: lib/Target/X86/X86SchedHaswell.td =================================================================== --- lib/Target/X86/X86SchedHaswell.td +++ lib/Target/X86/X86SchedHaswell.td @@ -124,6 +124,7 @@ defm : HWWriteResPair; defm : HWWriteResPair; +defm : HWWriteResPair; defm : HWWriteResPair; defm : HWWriteResPair; @@ -1600,13 +1601,6 @@ } def: InstRW<[HWWriteResGroup100], (instrs XSETBV)>; -def HWWriteResGroup101 : SchedWriteRes<[HWPort06,HWPort0156]> { - let Latency = 5; - let NumMicroOps = 5; - let ResourceCycles = [2,3]; -} -def: InstRW<[HWWriteResGroup101], (instregex "CMPXCHG(8|16|32|64)rr")>; - def HWWriteResGroup102 : SchedWriteRes<[HWPort1,HWPort5]> { let Latency = 6; let NumMicroOps = 2; Index: lib/Target/X86/X86SchedSandyBridge.td =================================================================== --- lib/Target/X86/X86SchedSandyBridge.td +++ lib/Target/X86/X86SchedSandyBridge.td @@ -112,6 +112,7 @@ defm : SBWriteResPair; defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; @@ -779,13 +780,6 @@ } def: InstRW<[SBWriteResGroup41], (instrs FNINIT)>; -def SBWriteResGroup42 : SchedWriteRes<[SBPort05,SBPort015]> { - let Latency = 5; - let NumMicroOps = 4; - let ResourceCycles = [1,3]; -} -def: InstRW<[SBWriteResGroup42], (instregex "CMPXCHG(8|16|32|64)rr")>; - def SBWriteResGroup43 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { let Latency = 3; let NumMicroOps = 4; Index: lib/Target/X86/X86SchedSkylakeClient.td =================================================================== --- lib/Target/X86/X86SchedSkylakeClient.td +++ lib/Target/X86/X86SchedSkylakeClient.td @@ -110,6 +110,7 @@ defm : SKLWriteResPair; // Integer multiplication. defm : SKLWriteResPair; // Integer 64-bit multiplication. +defm : SKLWriteResPair; defm : SKLWriteResPair; // defm : SKLWriteResPair; // @@ -983,13 +984,6 @@ } def: InstRW<[SKLWriteResGroup63], (instrs XSETBV)>; -def SKLWriteResGroup64 : SchedWriteRes<[SKLPort06,SKLPort0156]> { - let Latency = 5; - let NumMicroOps = 5; - let ResourceCycles = [2,3]; -} -def: InstRW<[SKLWriteResGroup64], (instregex "CMPXCHG(8|16|32|64)rr")>; - def SKLWriteResGroup65 : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort0156]> { let Latency = 5; let NumMicroOps = 6; Index: lib/Target/X86/X86SchedSkylakeServer.td =================================================================== --- lib/Target/X86/X86SchedSkylakeServer.td +++ lib/Target/X86/X86SchedSkylakeServer.td @@ -110,6 +110,7 @@ defm : SKXWriteResPair; // Integer multiplication. defm : SKXWriteResPair; // Integer 64-bit multiplication. +defm : SKXWriteResPair; // defm : SKXWriteResPair; // defm : SKXWriteResPair; // @@ -1150,13 +1151,6 @@ } def: InstRW<[SKXWriteResGroup67], (instrs XSETBV)>; -def SKXWriteResGroup68 : SchedWriteRes<[SKXPort06,SKXPort0156]> { - let Latency = 5; - let NumMicroOps = 5; - let ResourceCycles = [2,3]; -} -def: InstRW<[SKXWriteResGroup68], (instregex "CMPXCHG(8|16|32|64)rr")>; - def SKXWriteResGroup69 : SchedWriteRes<[SKXPort4,SKXPort237,SKXPort0156]> { let Latency = 5; let NumMicroOps = 6; Index: lib/Target/X86/X86Schedule.td =================================================================== --- lib/Target/X86/X86Schedule.td +++ lib/Target/X86/X86Schedule.td @@ -118,8 +118,9 @@ def WriteIMulH : SchedWrite; // Integer multiplication, high part. def WriteLEA : SchedWrite; // LEA instructions can't fold loads. -defm WriteBSWAP32: X86SchedWritePair; // Byte Order (Endiannes) Swap -defm WriteBSWAP64: X86SchedWritePair; // Byte Order (Endiannes) Swap +defm WriteCMPXCHG: X86SchedWritePair; // Compare and set, compare and swap. +defm WriteBSWAP32: X86SchedWritePair; // Byte Order (Endiannes) Swap. +defm WriteBSWAP64: X86SchedWritePair; // Byte Order (Endiannes) Swap. // Integer division. defm WriteDiv8 : X86SchedWritePair; Index: lib/Target/X86/X86ScheduleAtom.td =================================================================== --- lib/Target/X86/X86ScheduleAtom.td +++ lib/Target/X86/X86ScheduleAtom.td @@ -81,6 +81,7 @@ defm : AtomWriteResPair; defm : AtomWriteResPair; +defm : AtomWriteResPair; defm : AtomWriteResPair; defm : AtomWriteResPair; @@ -677,12 +678,6 @@ } def : InstRW<[AtomWrite01_14], (instrs CMPXCHG16rm, CMPXCHG32rm, CMPXCHG64rm)>; -def AtomWrite01_15 : SchedWriteRes<[AtomPort01]> { - let Latency = 15; - let ResourceCycles = [15]; -} -def : InstRW<[AtomWrite01_15], (instrs CMPXCHG16rr, CMPXCHG32rr, CMPXCHG64rr)>; - def AtomWrite01_17 : SchedWriteRes<[AtomPort01]> { let Latency = 17; let ResourceCycles = [17]; Index: lib/Target/X86/X86ScheduleBtVer2.td =================================================================== --- lib/Target/X86/X86ScheduleBtVer2.td +++ lib/Target/X86/X86ScheduleBtVer2.td @@ -168,6 +168,7 @@ defm : JWriteResIntPair; // i64 multiplication defm : X86WriteRes; +defm : JWriteResIntPair; defm : JWriteResIntPair; defm : JWriteResIntPair; Index: lib/Target/X86/X86ScheduleSLM.td =================================================================== --- lib/Target/X86/X86ScheduleSLM.td +++ lib/Target/X86/X86ScheduleSLM.td @@ -98,6 +98,7 @@ defm : SLMWriteResPair; defm : SLMWriteResPair; +defm : SLMWriteResPair; defm : SLMWriteResPair; defm : SLMWriteResPair; Index: lib/Target/X86/X86ScheduleZnver1.td =================================================================== --- lib/Target/X86/X86ScheduleZnver1.td +++ lib/Target/X86/X86ScheduleZnver1.td @@ -180,6 +180,7 @@ defm : ZnWriteResPair; defm : ZnWriteResPair; +defm : ZnWriteResPair; defm : ZnWriteResPair; defm : ZnWriteResPair;