1//=- X86SchedSandyBridge.td - X86 Sandy Bridge Scheduling ----*- tablegen -*-=// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// This file defines the machine model for Sandy Bridge to support instruction 10// scheduling and other instruction cost heuristics. 11// 12// Note that we define some instructions here that are not supported by SNB, 13// but we still have to define them because SNB is the default subtarget for 14// X86. These instructions are tagged with a comment `Unsupported = 1`. 15// 16//===----------------------------------------------------------------------===// 17 18def SandyBridgeModel : SchedMachineModel { 19 // All x86 instructions are modeled as a single micro-op, and SB can decode 4 20 // instructions per cycle. 21 // FIXME: Identify instructions that aren't a single fused micro-op. 22 let IssueWidth = 4; 23 let MicroOpBufferSize = 168; // Based on the reorder buffer. 24 let LoadLatency = 5; 25 let MispredictPenalty = 16; 26 27 // Based on the LSD (loop-stream detector) queue size. 28 let LoopMicroOpBufferSize = 28; 29 30 // This flag is set to allow the scheduler to assign 31 // a default model to unrecognized opcodes. 32 let CompleteModel = 0; 33} 34 35let SchedModel = SandyBridgeModel in { 36 37// Sandy Bridge can issue micro-ops to 6 different ports in one cycle. 38 39// Ports 0, 1, and 5 handle all computation. 40def SBPort0 : ProcResource<1>; 41def SBPort1 : ProcResource<1>; 42def SBPort5 : ProcResource<1>; 43 44// Ports 2 and 3 are identical. They handle loads and the address half of 45// stores. 46def SBPort23 : ProcResource<2>; 47 48// Port 4 gets the data half of stores. Store data can be available later than 49// the store address, but since we don't model the latency of stores, we can 50// ignore that. 51def SBPort4 : ProcResource<1>; 52 53// Many micro-ops are capable of issuing on multiple ports. 54def SBPort01 : ProcResGroup<[SBPort0, SBPort1]>; 55def SBPort05 : ProcResGroup<[SBPort0, SBPort5]>; 56def SBPort15 : ProcResGroup<[SBPort1, SBPort5]>; 57def SBPort015 : ProcResGroup<[SBPort0, SBPort1, SBPort5]>; 58 59// 54 Entry Unified Scheduler 60def SBPortAny : ProcResGroup<[SBPort0, SBPort1, SBPort23, SBPort4, SBPort5]> { 61 let BufferSize=54; 62} 63 64// Integer division issued on port 0. 65def SBDivider : ProcResource<1>; 66// FP division and sqrt on port 0. 67def SBFPDivider : ProcResource<1>; 68 69// Integer loads are 5 cycles, so ReadAfterLd registers needn't be available until 5 70// cycles after the memory operand. 71def : ReadAdvance<ReadAfterLd, 5>; 72 73// Vector loads are 5/6/7 cycles, so ReadAfterVec*Ld registers needn't be available 74// until 5/6/7 cycles after the memory operand. 75def : ReadAdvance<ReadAfterVecLd, 5>; 76def : ReadAdvance<ReadAfterVecXLd, 6>; 77def : ReadAdvance<ReadAfterVecYLd, 7>; 78 79def : ReadAdvance<ReadInt2Fpu, 0>; 80 81// Many SchedWrites are defined in pairs with and without a folded load. 82// Instructions with folded loads are usually micro-fused, so they only appear 83// as two micro-ops when queued in the reservation station. 84// This multiclass defines the resource usage for variants with and without 85// folded loads. 86multiclass SBWriteResPair<X86FoldableSchedWrite SchedRW, 87 list<ProcResourceKind> ExePorts, 88 int Lat, list<int> Res = [1], int UOps = 1, 89 int LoadLat = 5> { 90 // Register variant is using a single cycle on ExePort. 91 def : WriteRes<SchedRW, ExePorts> { 92 let Latency = Lat; 93 let ResourceCycles = Res; 94 let NumMicroOps = UOps; 95 } 96 97 // Memory variant also uses a cycle on port 2/3 and adds LoadLat cycles to 98 // the latency (default = 5). 99 def : WriteRes<SchedRW.Folded, !listconcat([SBPort23], ExePorts)> { 100 let Latency = !add(Lat, LoadLat); 101 let ResourceCycles = !listconcat([1], Res); 102 let NumMicroOps = !add(UOps, 1); 103 } 104} 105 106// A folded store needs a cycle on port 4 for the store data, and an extra port 107// 2/3 cycle to recompute the address. 108def : WriteRes<WriteRMW, [SBPort23,SBPort4]>; 109 110def : WriteRes<WriteStore, [SBPort23, SBPort4]>; 111def : WriteRes<WriteStoreNT, [SBPort23, SBPort4]>; 112def : WriteRes<WriteLoad, [SBPort23]> { let Latency = 5; } 113def : WriteRes<WriteMove, [SBPort015]>; 114 115// Treat misc copies as a move. 116def : InstRW<[WriteMove], (instrs COPY)>; 117 118// Idioms that clear a register, like xorps %xmm0, %xmm0. 119// These can often bypass execution ports completely. 120def : WriteRes<WriteZero, []>; 121 122// Model the effect of clobbering the read-write mask operand of the GATHER operation. 123// Does not cost anything by itself, only has latency, matching that of the WriteLoad, 124defm : X86WriteRes<WriteVecMaskedGatherWriteback, [], 5, [], 0>; 125 126// Arithmetic. 127defm : SBWriteResPair<WriteALU, [SBPort015], 1>; 128defm : SBWriteResPair<WriteADC, [SBPort05,SBPort015], 2, [1,1], 2>; 129 130defm : SBWriteResPair<WriteIMul8, [SBPort1], 3>; 131defm : SBWriteResPair<WriteIMul16, [SBPort1,SBPort05,SBPort015], 4, [1,1,2], 4>; 132defm : X86WriteRes<WriteIMul16Imm, [SBPort1,SBPort015], 4, [1,1], 2>; 133defm : X86WriteRes<WriteIMul16ImmLd, [SBPort1,SBPort015,SBPort23], 8, [1,1,1], 3>; 134defm : SBWriteResPair<WriteIMul16Reg, [SBPort1], 3>; 135defm : SBWriteResPair<WriteIMul32, [SBPort1,SBPort05,SBPort015], 4, [1,1,1], 3>; 136defm : SBWriteResPair<WriteMULX32, [SBPort1,SBPort05,SBPort015], 3, [1,1,1], 3>; 137defm : SBWriteResPair<WriteIMul32Imm, [SBPort1], 3>; 138defm : SBWriteResPair<WriteIMul32Reg, [SBPort1], 3>; 139defm : SBWriteResPair<WriteIMul64, [SBPort1,SBPort0], 4, [1,1], 2>; 140defm : SBWriteResPair<WriteMULX64, [SBPort1,SBPort0], 3, [1,1], 2>; 141defm : SBWriteResPair<WriteIMul64Imm, [SBPort1], 3>; 142defm : SBWriteResPair<WriteIMul64Reg, [SBPort1], 3>; 143def SBWriteIMulH : WriteRes<WriteIMulH, []> { let Latency = 4; } 144def : WriteRes<WriteIMulHLd, []> { 145 let Latency = !add(SBWriteIMulH.Latency, SandyBridgeModel.LoadLatency); 146} 147 148defm : X86WriteRes<WriteXCHG, [SBPort015], 2, [3], 3>; 149defm : X86WriteRes<WriteBSWAP32, [SBPort1], 1, [1], 1>; 150defm : X86WriteRes<WriteBSWAP64, [SBPort1, SBPort05], 2, [1,1], 2>; 151defm : X86WriteRes<WriteCMPXCHG, [SBPort05, SBPort015], 5, [1,3], 4>; 152defm : X86WriteRes<WriteCMPXCHGRMW,[SBPort015, SBPort5, SBPort23, SBPort4], 8, [1, 2, 2, 1], 6>; 153 154defm : SBWriteResPair<WriteDiv8, [SBPort0, SBDivider], 25, [1, 10]>; 155defm : SBWriteResPair<WriteDiv16, [SBPort0, SBDivider], 25, [1, 10]>; 156defm : SBWriteResPair<WriteDiv32, [SBPort0, SBDivider], 25, [1, 10]>; 157defm : SBWriteResPair<WriteDiv64, [SBPort0, SBDivider], 25, [1, 10]>; 158defm : SBWriteResPair<WriteIDiv8, [SBPort0, SBDivider], 25, [1, 10]>; 159defm : SBWriteResPair<WriteIDiv16, [SBPort0, SBDivider], 25, [1, 10]>; 160defm : SBWriteResPair<WriteIDiv32, [SBPort0, SBDivider], 25, [1, 10]>; 161defm : SBWriteResPair<WriteIDiv64, [SBPort0, SBDivider], 25, [1, 10]>; 162 163// SHLD/SHRD. 164defm : X86WriteRes<WriteSHDrri, [SBPort05, SBPort015], 2, [1, 1], 2>; 165defm : X86WriteRes<WriteSHDrrcl,[SBPort05, SBPort015], 4, [3, 1], 4>; 166defm : X86WriteRes<WriteSHDmri, [SBPort4,SBPort23,SBPort05,SBPort015], 8, [1, 2, 1, 1], 5>; 167defm : X86WriteRes<WriteSHDmrcl,[SBPort4,SBPort23,SBPort05,SBPort015], 10, [1, 2, 3, 1], 7>; 168 169defm : SBWriteResPair<WriteShift, [SBPort05], 1>; 170defm : SBWriteResPair<WriteShiftCL, [SBPort05], 3, [3], 3>; 171defm : SBWriteResPair<WriteRotate, [SBPort05], 2, [2], 2>; 172defm : SBWriteResPair<WriteRotateCL, [SBPort05], 3, [3], 3>; 173 174defm : SBWriteResPair<WriteJump, [SBPort5], 1>; 175defm : SBWriteResPair<WriteCRC32, [SBPort1], 3, [1], 1, 5>; 176 177defm : SBWriteResPair<WriteCMOV, [SBPort05,SBPort015], 2, [1,1], 2>; // Conditional move. 178defm : X86WriteRes<WriteFCMOV, [SBPort5,SBPort05], 3, [2,1], 3>; // x87 conditional move. 179def : WriteRes<WriteSETCC, [SBPort05]>; // Setcc. 180def : WriteRes<WriteSETCCStore, [SBPort05,SBPort4,SBPort23]> { 181 let Latency = 2; 182 let NumMicroOps = 3; 183} 184 185defm : X86WriteRes<WriteLAHFSAHF, [SBPort05], 1, [1], 1>; 186defm : X86WriteRes<WriteBitTest, [SBPort05], 1, [1], 1>; 187defm : X86WriteRes<WriteBitTestImmLd, [SBPort05,SBPort23], 6, [1,1], 2>; 188//defm : X86WriteRes<WriteBitTestRegLd, [SBPort05,SBPort23], 6, [1,1], 2>; 189defm : X86WriteRes<WriteBitTestSet, [SBPort05], 1, [1], 1>; 190defm : X86WriteRes<WriteBitTestSetImmLd, [SBPort05,SBPort23], 6, [1,1], 3>; 191defm : X86WriteRes<WriteBitTestSetRegLd, [SBPort05,SBPort23,SBPort5,SBPort015], 8, [1,1,1,1], 5>; 192 193// This is for simple LEAs with one or two input operands. 194// The complex ones can only execute on port 1, and they require two cycles on 195// the port to read all inputs. We don't model that. 196def : WriteRes<WriteLEA, [SBPort01]>; 197 198// Bit counts. 199defm : SBWriteResPair<WriteBSF, [SBPort1], 3, [1], 1, 5>; 200defm : SBWriteResPair<WriteBSR, [SBPort1], 3, [1], 1, 5>; 201defm : SBWriteResPair<WriteLZCNT, [SBPort1], 3, [1], 1, 5>; 202defm : SBWriteResPair<WriteTZCNT, [SBPort1], 3, [1], 1, 5>; 203defm : SBWriteResPair<WritePOPCNT, [SBPort1], 3, [1], 1, 6>; 204 205// BMI1 BEXTR/BLS, BMI2 BZHI 206// NOTE: These don't exist on Sandy Bridge. Ports are guesses. 207defm : SBWriteResPair<WriteBEXTR, [SBPort05,SBPort1], 2, [1,1], 2>; 208defm : SBWriteResPair<WriteBLS, [SBPort015], 1>; 209defm : SBWriteResPair<WriteBZHI, [SBPort1], 1>; 210 211// Scalar and vector floating point. 212defm : X86WriteRes<WriteFLD0, [SBPort5], 1, [1], 1>; 213defm : X86WriteRes<WriteFLD1, [SBPort0,SBPort5], 1, [1,1], 2>; 214defm : X86WriteRes<WriteFLDC, [SBPort0,SBPort1], 1, [1,1], 2>; 215defm : X86WriteRes<WriteFLoad, [SBPort23], 5, [1], 1>; 216defm : X86WriteRes<WriteFLoadX, [SBPort23], 6, [1], 1>; 217defm : X86WriteRes<WriteFLoadY, [SBPort23], 7, [1], 1>; 218defm : X86WriteRes<WriteFMaskedLoad, [SBPort23,SBPort05], 8, [1,2], 3>; 219defm : X86WriteRes<WriteFMaskedLoadY, [SBPort23,SBPort05], 9, [1,2], 3>; 220defm : X86WriteRes<WriteFStore, [SBPort23,SBPort4], 1, [1,1], 1>; 221defm : X86WriteRes<WriteFStoreX, [SBPort23,SBPort4], 1, [1,1], 1>; 222defm : X86WriteRes<WriteFStoreY, [SBPort23,SBPort4], 1, [1,1], 1>; 223defm : X86WriteRes<WriteFStoreNT, [SBPort23,SBPort4], 1, [1,1], 1>; 224defm : X86WriteRes<WriteFStoreNTX, [SBPort23,SBPort4], 1, [1,1], 1>; 225defm : X86WriteRes<WriteFStoreNTY, [SBPort23,SBPort4], 1, [1,1], 1>; 226 227defm : X86WriteRes<WriteFMaskedStore32, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 228defm : X86WriteRes<WriteFMaskedStore32Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 229defm : X86WriteRes<WriteFMaskedStore64, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 230defm : X86WriteRes<WriteFMaskedStore64Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 231 232defm : X86WriteRes<WriteFMove, [SBPort5], 1, [1], 1>; 233defm : X86WriteRes<WriteFMoveX, [SBPort5], 1, [1], 1>; 234defm : X86WriteRes<WriteFMoveY, [SBPort5], 1, [1], 1>; 235defm : X86WriteRes<WriteFMoveZ, [SBPort5], 1, [1], 1>; 236defm : X86WriteRes<WriteEMMS, [SBPort015], 31, [31], 31>; 237 238defm : SBWriteResPair<WriteFAdd, [SBPort1], 3, [1], 1, 6>; 239defm : SBWriteResPair<WriteFAddX, [SBPort1], 3, [1], 1, 6>; 240defm : SBWriteResPair<WriteFAddY, [SBPort1], 3, [1], 1, 7>; 241defm : SBWriteResPair<WriteFAddZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 242defm : SBWriteResPair<WriteFAdd64, [SBPort1], 3, [1], 1, 6>; 243defm : SBWriteResPair<WriteFAdd64X, [SBPort1], 3, [1], 1, 6>; 244defm : SBWriteResPair<WriteFAdd64Y, [SBPort1], 3, [1], 1, 7>; 245defm : SBWriteResPair<WriteFAdd64Z, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 246 247defm : SBWriteResPair<WriteFCmp, [SBPort1], 3, [1], 1, 6>; 248defm : SBWriteResPair<WriteFCmpX, [SBPort1], 3, [1], 1, 6>; 249defm : SBWriteResPair<WriteFCmpY, [SBPort1], 3, [1], 1, 7>; 250defm : SBWriteResPair<WriteFCmpZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 251defm : SBWriteResPair<WriteFCmp64, [SBPort1], 3, [1], 1, 6>; 252defm : SBWriteResPair<WriteFCmp64X, [SBPort1], 3, [1], 1, 6>; 253defm : SBWriteResPair<WriteFCmp64Y, [SBPort1], 3, [1], 1, 7>; 254defm : SBWriteResPair<WriteFCmp64Z, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 255 256defm : SBWriteResPair<WriteFCom, [SBPort1], 3>; 257defm : SBWriteResPair<WriteFComX, [SBPort1], 3>; 258 259defm : SBWriteResPair<WriteFMul, [SBPort0], 5, [1], 1, 6>; 260defm : SBWriteResPair<WriteFMulX, [SBPort0], 5, [1], 1, 6>; 261defm : SBWriteResPair<WriteFMulY, [SBPort0], 5, [1], 1, 7>; 262defm : SBWriteResPair<WriteFMulZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 263defm : SBWriteResPair<WriteFMul64, [SBPort0], 5, [1], 1, 6>; 264defm : SBWriteResPair<WriteFMul64X, [SBPort0], 5, [1], 1, 6>; 265defm : SBWriteResPair<WriteFMul64Y, [SBPort0], 5, [1], 1, 7>; 266defm : SBWriteResPair<WriteFMul64Z, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 267 268defm : SBWriteResPair<WriteFDiv, [SBPort0,SBFPDivider], 14, [1,14], 1, 6>; 269defm : SBWriteResPair<WriteFDivX, [SBPort0,SBFPDivider], 14, [1,14], 1, 6>; 270defm : SBWriteResPair<WriteFDivY, [SBPort0,SBPort05,SBFPDivider], 29, [2,1,28], 3, 7>; 271defm : SBWriteResPair<WriteFDivZ, [SBPort0,SBPort05,SBFPDivider], 29, [2,1,28], 3, 7>; // Unsupported = 1 272defm : SBWriteResPair<WriteFDiv64, [SBPort0,SBFPDivider], 22, [1,22], 1, 6>; 273defm : SBWriteResPair<WriteFDiv64X, [SBPort0,SBFPDivider], 22, [1,22], 1, 6>; 274defm : SBWriteResPair<WriteFDiv64Y, [SBPort0,SBPort05,SBFPDivider], 45, [2,1,44], 3, 7>; 275defm : SBWriteResPair<WriteFDiv64Z, [SBPort0,SBPort05,SBFPDivider], 45, [2,1,44], 3, 7>; // Unsupported = 1 276 277defm : SBWriteResPair<WriteFRcp, [SBPort0], 5, [1], 1, 6>; 278defm : SBWriteResPair<WriteFRcpX, [SBPort0], 5, [1], 1, 6>; 279defm : SBWriteResPair<WriteFRcpY, [SBPort0,SBPort05], 7, [2,1], 3, 7>; 280defm : SBWriteResPair<WriteFRcpZ, [SBPort0,SBPort05], 7, [2,1], 3, 7>; // Unsupported = 1 281 282defm : SBWriteResPair<WriteFRsqrt, [SBPort0], 5, [1], 1, 6>; 283defm : SBWriteResPair<WriteFRsqrtX,[SBPort0], 5, [1], 1, 6>; 284defm : SBWriteResPair<WriteFRsqrtY,[SBPort0,SBPort05], 7, [2,1], 3, 7>; 285defm : SBWriteResPair<WriteFRsqrtZ,[SBPort0,SBPort05], 7, [2,1], 3, 7>; // Unsupported = 1 286 287defm : SBWriteResPair<WriteFSqrt, [SBPort0,SBFPDivider], 14, [1,14], 1, 6>; 288defm : SBWriteResPair<WriteFSqrtX, [SBPort0,SBFPDivider], 14, [1,14], 1, 6>; 289defm : SBWriteResPair<WriteFSqrtY, [SBPort0,SBPort05,SBFPDivider], 29, [2,1,28], 3, 7>; 290defm : SBWriteResPair<WriteFSqrtZ, [SBPort0,SBPort05,SBFPDivider], 29, [2,1,28], 3, 7>; // Unsupported = 1 291defm : SBWriteResPair<WriteFSqrt64, [SBPort0,SBFPDivider], 21, [1,21], 1, 6>; 292defm : SBWriteResPair<WriteFSqrt64X, [SBPort0,SBFPDivider], 21, [1,21], 1, 6>; 293defm : SBWriteResPair<WriteFSqrt64Y, [SBPort0,SBPort05,SBFPDivider], 45, [2,1,44], 3, 7>; 294defm : SBWriteResPair<WriteFSqrt64Z, [SBPort0,SBPort05,SBFPDivider], 45, [2,1,44], 3, 7>; // Unsupported = 1 295defm : SBWriteResPair<WriteFSqrt80, [SBPort0,SBFPDivider], 24, [1,24], 1, 6>; 296 297defm : SBWriteResPair<WriteDPPD, [SBPort0,SBPort1,SBPort5], 9, [1,1,1], 3, 6>; 298defm : SBWriteResPair<WriteDPPS, [SBPort0,SBPort1,SBPort5], 12, [1,2,1], 4, 6>; 299defm : SBWriteResPair<WriteDPPSY, [SBPort0,SBPort1,SBPort5], 12, [1,2,1], 4, 7>; 300defm : SBWriteResPair<WriteDPPSZ, [SBPort0,SBPort1,SBPort5], 12, [1,2,1], 4, 7>; // Unsupported = 1 301defm : SBWriteResPair<WriteFSign, [SBPort5], 1>; 302defm : SBWriteResPair<WriteFRnd, [SBPort1], 3, [1], 1, 6>; 303defm : SBWriteResPair<WriteFRndY, [SBPort1], 3, [1], 1, 7>; 304defm : SBWriteResPair<WriteFRndZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 305defm : SBWriteResPair<WriteFLogic, [SBPort5], 1, [1], 1, 6>; 306defm : SBWriteResPair<WriteFLogicY, [SBPort5], 1, [1], 1, 7>; 307defm : SBWriteResPair<WriteFLogicZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 308defm : SBWriteResPair<WriteFTest, [SBPort0], 1, [1], 1, 6>; 309defm : SBWriteResPair<WriteFTestY, [SBPort0], 1, [1], 1, 7>; 310defm : SBWriteResPair<WriteFTestZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 311defm : SBWriteResPair<WriteFShuffle, [SBPort5], 1, [1], 1, 6>; 312defm : SBWriteResPair<WriteFShuffleY,[SBPort5], 1, [1], 1, 7>; 313defm : SBWriteResPair<WriteFShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 314defm : SBWriteResPair<WriteFVarShuffle, [SBPort5], 1, [1], 1, 6>; 315defm : SBWriteResPair<WriteFVarShuffleY,[SBPort5], 1, [1], 1, 7>; 316defm : SBWriteResPair<WriteFVarShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 317defm : SBWriteResPair<WriteFBlend, [SBPort05], 1, [1], 1, 6>; 318defm : SBWriteResPair<WriteFBlendY, [SBPort05], 1, [1], 1, 7>; 319defm : SBWriteResPair<WriteFBlendZ, [SBPort05], 1, [1], 1, 7>; // Unsupported = 1 320defm : SBWriteResPair<WriteFVarBlend, [SBPort05], 2, [2], 2, 6>; 321defm : SBWriteResPair<WriteFVarBlendY,[SBPort05], 2, [2], 2, 7>; 322defm : SBWriteResPair<WriteFVarBlendZ,[SBPort05], 2, [2], 2, 7>; // Unsupported = 1 323 324// Conversion between integer and float. 325defm : SBWriteResPair<WriteCvtSS2I, [SBPort0,SBPort1], 5, [1,1], 2>; 326defm : SBWriteResPair<WriteCvtPS2I, [SBPort1], 3, [1], 1, 6>; 327defm : SBWriteResPair<WriteCvtPS2IY, [SBPort1], 3, [1], 1, 7>; 328defm : SBWriteResPair<WriteCvtPS2IZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 329defm : SBWriteResPair<WriteCvtSD2I, [SBPort0,SBPort1], 5, [1,1], 2>; 330defm : SBWriteResPair<WriteCvtPD2I, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 331defm : X86WriteRes<WriteCvtPD2IY, [SBPort1,SBPort5], 4, [1,1], 2>; 332defm : X86WriteRes<WriteCvtPD2IZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 333defm : X86WriteRes<WriteCvtPD2IYLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; 334defm : X86WriteRes<WriteCvtPD2IZLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; // Unsupported = 1 335 336defm : X86WriteRes<WriteCvtI2SS, [SBPort1,SBPort5], 5, [1,2], 3>; 337defm : X86WriteRes<WriteCvtI2SSLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 338defm : SBWriteResPair<WriteCvtI2PS, [SBPort1], 3, [1], 1, 6>; 339defm : SBWriteResPair<WriteCvtI2PSY, [SBPort1], 3, [1], 1, 7>; 340defm : SBWriteResPair<WriteCvtI2PSZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 341defm : X86WriteRes<WriteCvtI2SD, [SBPort1,SBPort5], 4, [1,1], 2>; 342defm : X86WriteRes<WriteCvtI2PD, [SBPort1,SBPort5], 4, [1,1], 2>; 343defm : X86WriteRes<WriteCvtI2PDY, [SBPort1,SBPort5], 4, [1,1], 2>; 344defm : X86WriteRes<WriteCvtI2PDZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 345defm : X86WriteRes<WriteCvtI2SDLd, [SBPort1,SBPort23], 9, [1,1], 2>; 346defm : X86WriteRes<WriteCvtI2PDLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 347defm : X86WriteRes<WriteCvtI2PDYLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 348defm : X86WriteRes<WriteCvtI2PDZLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; // Unsupported = 1 349 350defm : SBWriteResPair<WriteCvtSS2SD, [SBPort0], 1, [1], 1, 6>; 351defm : X86WriteRes<WriteCvtPS2PD, [SBPort0,SBPort5], 2, [1,1], 2>; 352defm : X86WriteRes<WriteCvtPS2PDY, [SBPort0,SBPort5], 2, [1,1], 2>; 353defm : X86WriteRes<WriteCvtPS2PDZ, [SBPort0,SBPort5], 2, [1,1], 2>; // Unsupported = 1 354defm : X86WriteRes<WriteCvtPS2PDLd, [SBPort0,SBPort23], 7, [1,1], 2>; 355defm : X86WriteRes<WriteCvtPS2PDYLd, [SBPort0,SBPort23], 7, [1,1], 2>; 356defm : X86WriteRes<WriteCvtPS2PDZLd, [SBPort0,SBPort23], 7, [1,1], 2>; // Unsupported = 1 357defm : SBWriteResPair<WriteCvtSD2SS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 358defm : SBWriteResPair<WriteCvtPD2PS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 359defm : SBWriteResPair<WriteCvtPD2PSY, [SBPort1,SBPort5], 4, [1,1], 2, 7>; 360defm : SBWriteResPair<WriteCvtPD2PSZ, [SBPort1,SBPort5], 4, [1,1], 2, 7>; // Unsupported = 1 361 362defm : SBWriteResPair<WriteCvtPH2PS, [SBPort1], 3>; 363defm : SBWriteResPair<WriteCvtPH2PSY, [SBPort1], 3>; 364defm : SBWriteResPair<WriteCvtPH2PSZ, [SBPort1], 3>; // Unsupported = 1 365 366defm : X86WriteRes<WriteCvtPS2PH, [SBPort1], 3, [1], 1>; 367defm : X86WriteRes<WriteCvtPS2PHY, [SBPort1], 3, [1], 1>; 368defm : X86WriteRes<WriteCvtPS2PHZ, [SBPort1], 3, [1], 1>; // Unsupported = 1 369defm : X86WriteRes<WriteCvtPS2PHSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 370defm : X86WriteRes<WriteCvtPS2PHYSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 371defm : X86WriteRes<WriteCvtPS2PHZSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; // Unsupported = 1 372 373// Vector integer operations. 374defm : X86WriteRes<WriteVecLoad, [SBPort23], 5, [1], 1>; 375defm : X86WriteRes<WriteVecLoadX, [SBPort23], 6, [1], 1>; 376defm : X86WriteRes<WriteVecLoadY, [SBPort23], 7, [1], 1>; 377defm : X86WriteRes<WriteVecLoadNT, [SBPort23], 6, [1], 1>; 378defm : X86WriteRes<WriteVecLoadNTY, [SBPort23], 7, [1], 1>; 379defm : X86WriteRes<WriteVecMaskedLoad, [SBPort23,SBPort05], 8, [1,2], 3>; 380defm : X86WriteRes<WriteVecMaskedLoadY, [SBPort23,SBPort05], 9, [1,2], 3>; 381defm : X86WriteRes<WriteVecStore, [SBPort23,SBPort4], 1, [1,1], 1>; 382defm : X86WriteRes<WriteVecStoreX, [SBPort23,SBPort4], 1, [1,1], 1>; 383defm : X86WriteRes<WriteVecStoreY, [SBPort23,SBPort4], 1, [1,1], 1>; 384defm : X86WriteRes<WriteVecStoreNT, [SBPort23,SBPort4], 1, [1,1], 1>; 385defm : X86WriteRes<WriteVecStoreNTY, [SBPort23,SBPort4], 1, [1,1], 1>; 386defm : X86WriteRes<WriteVecMaskedStore32, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 387defm : X86WriteRes<WriteVecMaskedStore32Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 388defm : X86WriteRes<WriteVecMaskedStore64, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 389defm : X86WriteRes<WriteVecMaskedStore64Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 390defm : X86WriteRes<WriteVecMove, [SBPort05], 1, [1], 1>; 391defm : X86WriteRes<WriteVecMoveX, [SBPort015], 1, [1], 1>; 392defm : X86WriteRes<WriteVecMoveY, [SBPort05], 1, [1], 1>; 393defm : X86WriteRes<WriteVecMoveZ, [SBPort05], 1, [1], 1>; 394defm : X86WriteRes<WriteVecMoveToGpr, [SBPort0], 2, [1], 1>; 395defm : X86WriteRes<WriteVecMoveFromGpr, [SBPort5], 1, [1], 1>; 396 397defm : SBWriteResPair<WriteVecLogic, [SBPort015], 1, [1], 1, 5>; 398defm : SBWriteResPair<WriteVecLogicX,[SBPort015], 1, [1], 1, 6>; 399defm : SBWriteResPair<WriteVecLogicY,[SBPort015], 1, [1], 1, 7>; 400defm : SBWriteResPair<WriteVecLogicZ,[SBPort015], 1, [1], 1, 7>; // Unsupported = 1 401defm : SBWriteResPair<WriteVecTest, [SBPort0,SBPort5], 2, [1,1], 2, 6>; 402defm : SBWriteResPair<WriteVecTestY, [SBPort0,SBPort5], 2, [1,1], 2, 7>; 403defm : SBWriteResPair<WriteVecTestZ, [SBPort0,SBPort5], 2, [1,1], 2, 7>; // Unsupported = 1 404defm : SBWriteResPair<WriteVecALU, [SBPort1], 3, [1], 1, 5>; 405defm : SBWriteResPair<WriteVecALUX, [SBPort15], 1, [1], 1, 6>; 406defm : SBWriteResPair<WriteVecALUY, [SBPort15], 1, [1], 1, 7>; 407defm : SBWriteResPair<WriteVecALUZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 408defm : SBWriteResPair<WriteVecIMul, [SBPort0], 5, [1], 1, 5>; 409defm : SBWriteResPair<WriteVecIMulX, [SBPort0], 5, [1], 1, 6>; 410defm : SBWriteResPair<WriteVecIMulY, [SBPort0], 5, [1], 1, 7>; 411defm : SBWriteResPair<WriteVecIMulZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 412defm : SBWriteResPair<WritePMULLD, [SBPort0], 5, [1], 1, 6>; 413defm : SBWriteResPair<WritePMULLDY, [SBPort0], 5, [1], 1, 7>; // TODO this is probably wrong for 256/512-bit for the "generic" model 414defm : SBWriteResPair<WritePMULLDZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 415defm : SBWriteResPair<WriteShuffle, [SBPort5], 1, [1], 1, 5>; 416defm : SBWriteResPair<WriteShuffleX, [SBPort15], 1, [1], 1, 6>; 417defm : SBWriteResPair<WriteShuffleY, [SBPort5], 1, [1], 1, 7>; 418defm : SBWriteResPair<WriteShuffleZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 419defm : SBWriteResPair<WriteVarShuffle, [SBPort15], 1, [1], 1, 5>; 420defm : SBWriteResPair<WriteVarShuffleX, [SBPort15], 1, [1], 1, 6>; 421defm : SBWriteResPair<WriteVarShuffleY, [SBPort15], 1, [1], 1, 7>; 422defm : SBWriteResPair<WriteVarShuffleZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 423defm : SBWriteResPair<WriteBlend, [SBPort15], 1, [1], 1, 6>; 424defm : SBWriteResPair<WriteBlendY, [SBPort15], 1, [1], 1, 7>; 425defm : SBWriteResPair<WriteBlendZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 426defm : SBWriteResPair<WriteVarBlend, [SBPort15], 2, [2], 2, 6>; 427defm : SBWriteResPair<WriteVarBlendY,[SBPort15], 2, [2], 2, 7>; 428defm : SBWriteResPair<WriteVarBlendZ,[SBPort15], 2, [2], 2, 7>; // Unsupported = 1 429defm : SBWriteResPair<WriteMPSAD, [SBPort0, SBPort15], 7, [1,2], 3, 6>; 430defm : SBWriteResPair<WriteMPSADY, [SBPort0, SBPort15], 7, [1,2], 3, 7>; 431defm : SBWriteResPair<WriteMPSADZ, [SBPort0, SBPort15], 7, [1,2], 3, 7>; // Unsupported = 1 432defm : SBWriteResPair<WritePSADBW, [SBPort0], 5, [1], 1, 5>; 433defm : SBWriteResPair<WritePSADBWX, [SBPort0], 5, [1], 1, 6>; 434defm : SBWriteResPair<WritePSADBWY, [SBPort0], 5, [1], 1, 7>; 435defm : SBWriteResPair<WritePSADBWZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 436defm : SBWriteResPair<WritePHMINPOS, [SBPort0], 5, [1], 1, 6>; 437 438// Vector integer shifts. 439defm : SBWriteResPair<WriteVecShift, [SBPort5], 1, [1], 1, 5>; 440defm : SBWriteResPair<WriteVecShiftX, [SBPort0,SBPort15], 2, [1,1], 2, 6>; 441defm : SBWriteResPair<WriteVecShiftY, [SBPort0,SBPort15], 4, [1,1], 2, 7>; 442defm : SBWriteResPair<WriteVecShiftZ, [SBPort0,SBPort15], 4, [1,1], 2, 7>; // Unsupported = 1 443defm : SBWriteResPair<WriteVecShiftImm, [SBPort5], 1, [1], 1, 5>; 444defm : SBWriteResPair<WriteVecShiftImmX, [SBPort0], 1, [1], 1, 6>; 445defm : SBWriteResPair<WriteVecShiftImmY, [SBPort0], 1, [1], 1, 7>; 446defm : SBWriteResPair<WriteVecShiftImmZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 447defm : SBWriteResPair<WriteVarVecShift, [SBPort0], 1, [1], 1, 6>; 448defm : SBWriteResPair<WriteVarVecShiftY, [SBPort0], 1, [1], 1, 7>; 449defm : SBWriteResPair<WriteVarVecShiftZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 450 451// Vector insert/extract operations. 452def : WriteRes<WriteVecInsert, [SBPort5,SBPort15]> { 453 let Latency = 2; 454 let NumMicroOps = 2; 455} 456def : WriteRes<WriteVecInsertLd, [SBPort23,SBPort15]> { 457 let Latency = 7; 458 let NumMicroOps = 2; 459} 460 461def : WriteRes<WriteVecExtract, [SBPort0,SBPort15]> { 462 let Latency = 3; 463 let NumMicroOps = 2; 464} 465def : WriteRes<WriteVecExtractSt, [SBPort4,SBPort23,SBPort15]> { 466 let Latency = 5; 467 let NumMicroOps = 3; 468} 469 470//////////////////////////////////////////////////////////////////////////////// 471// Horizontal add/sub instructions. 472//////////////////////////////////////////////////////////////////////////////// 473 474defm : SBWriteResPair<WriteFHAdd, [SBPort1,SBPort5], 5, [1,2], 3, 6>; 475defm : SBWriteResPair<WriteFHAddY, [SBPort1,SBPort5], 5, [1,2], 3, 7>; 476defm : SBWriteResPair<WriteFHAddZ, [SBPort1,SBPort5], 5, [1,2], 3, 7>; // Unsupported = 1 477defm : SBWriteResPair<WritePHAdd, [SBPort15], 3, [3], 3, 5>; 478defm : SBWriteResPair<WritePHAddX, [SBPort15], 3, [3], 3, 6>; 479defm : SBWriteResPair<WritePHAddY, [SBPort15], 3, [3], 3, 7>; 480defm : SBWriteResPair<WritePHAddZ, [SBPort15], 3, [3], 3, 7>; // Unsupported = 1 481 482//////////////////////////////////////////////////////////////////////////////// 483// String instructions. 484//////////////////////////////////////////////////////////////////////////////// 485 486// Packed Compare Implicit Length Strings, Return Mask 487def : WriteRes<WritePCmpIStrM, [SBPort0]> { 488 let Latency = 11; 489 let NumMicroOps = 3; 490 let ResourceCycles = [3]; 491} 492def : WriteRes<WritePCmpIStrMLd, [SBPort0, SBPort23]> { 493 let Latency = 17; 494 let NumMicroOps = 4; 495 let ResourceCycles = [3,1]; 496} 497 498// Packed Compare Explicit Length Strings, Return Mask 499def : WriteRes<WritePCmpEStrM, [SBPort015]> { 500 let Latency = 11; 501 let ResourceCycles = [8]; 502} 503def : WriteRes<WritePCmpEStrMLd, [SBPort015, SBPort23]> { 504 let Latency = 17; 505 let ResourceCycles = [7, 1]; 506} 507 508// Packed Compare Implicit Length Strings, Return Index 509def : WriteRes<WritePCmpIStrI, [SBPort0]> { 510 let Latency = 11; 511 let NumMicroOps = 3; 512 let ResourceCycles = [3]; 513} 514def : WriteRes<WritePCmpIStrILd, [SBPort0,SBPort23]> { 515 let Latency = 17; 516 let NumMicroOps = 4; 517 let ResourceCycles = [3,1]; 518} 519 520// Packed Compare Explicit Length Strings, Return Index 521def : WriteRes<WritePCmpEStrI, [SBPort015]> { 522 let Latency = 4; 523 let ResourceCycles = [8]; 524} 525def : WriteRes<WritePCmpEStrILd, [SBPort015, SBPort23]> { 526 let Latency = 10; 527 let ResourceCycles = [7, 1]; 528} 529 530// MOVMSK Instructions. 531def : WriteRes<WriteFMOVMSK, [SBPort0]> { let Latency = 2; } 532def : WriteRes<WriteVecMOVMSK, [SBPort0]> { let Latency = 2; } 533def : WriteRes<WriteVecMOVMSKY, [SBPort0]> { let Latency = 2; } 534def : WriteRes<WriteMMXMOVMSK, [SBPort0]> { let Latency = 1; } 535 536// AES Instructions. 537def : WriteRes<WriteAESDecEnc, [SBPort5,SBPort015]> { 538 let Latency = 7; 539 let NumMicroOps = 2; 540 let ResourceCycles = [1,1]; 541} 542def : WriteRes<WriteAESDecEncLd, [SBPort5,SBPort23,SBPort015]> { 543 let Latency = 13; 544 let NumMicroOps = 3; 545 let ResourceCycles = [1,1,1]; 546} 547 548def : WriteRes<WriteAESIMC, [SBPort5]> { 549 let Latency = 12; 550 let NumMicroOps = 2; 551 let ResourceCycles = [2]; 552} 553def : WriteRes<WriteAESIMCLd, [SBPort5,SBPort23]> { 554 let Latency = 18; 555 let NumMicroOps = 3; 556 let ResourceCycles = [2,1]; 557} 558 559def : WriteRes<WriteAESKeyGen, [SBPort015]> { 560 let Latency = 8; 561 let ResourceCycles = [11]; 562} 563def : WriteRes<WriteAESKeyGenLd, [SBPort015, SBPort23]> { 564 let Latency = 14; 565 let ResourceCycles = [10, 1]; 566} 567 568// Carry-less multiplication instructions. 569def : WriteRes<WriteCLMul, [SBPort015]> { 570 let Latency = 14; 571 let ResourceCycles = [18]; 572} 573def : WriteRes<WriteCLMulLd, [SBPort015, SBPort23]> { 574 let Latency = 20; 575 let ResourceCycles = [17, 1]; 576} 577 578// Load/store MXCSR. 579// FIXME: This is probably wrong. Only STMXCSR should require Port4. 580def : WriteRes<WriteLDMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ResourceCycles = [1,1,1,1]; } 581def : WriteRes<WriteSTMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ResourceCycles = [1,1,1,1]; } 582 583def : WriteRes<WriteSystem, [SBPort015]> { let Latency = 100; } 584def : WriteRes<WriteMicrocoded, [SBPort015]> { let Latency = 100; } 585def : WriteRes<WriteFence, [SBPort23, SBPort4]>; 586def : WriteRes<WriteNop, []>; 587 588// AVX2/FMA is not supported on that architecture, but we should define the basic 589// scheduling resources anyway. 590defm : SBWriteResPair<WriteFShuffle256, [SBPort5], 1, [1], 1, 7>; 591defm : SBWriteResPair<WriteFVarShuffle256, [SBPort5], 1, [1], 1, 7>; 592defm : SBWriteResPair<WriteShuffle256, [SBPort5], 1, [1], 1, 7>; 593defm : SBWriteResPair<WriteVPMOV256, [SBPort5], 1, [1], 1, 7>; 594defm : SBWriteResPair<WriteVarShuffle256, [SBPort5], 1, [1], 1, 7>; 595defm : SBWriteResPair<WriteFMA, [SBPort01], 5>; 596defm : SBWriteResPair<WriteFMAX, [SBPort01], 5>; 597defm : SBWriteResPair<WriteFMAY, [SBPort01], 5>; 598defm : SBWriteResPair<WriteFMAZ, [SBPort01], 5>; // Unsupported = 1 599 600// Remaining SNB instrs. 601 602def SBWriteResGroup1 : SchedWriteRes<[SBPort1]> { 603 let Latency = 1; 604 let NumMicroOps = 1; 605 let ResourceCycles = [1]; 606} 607def: InstRW<[SBWriteResGroup1], (instrs COMP_FST0r, 608 COM_FST0r, 609 UCOM_FPr, 610 UCOM_Fr)>; 611 612def SBWriteResGroup2 : SchedWriteRes<[SBPort5]> { 613 let Latency = 1; 614 let NumMicroOps = 1; 615 let ResourceCycles = [1]; 616} 617def: InstRW<[SBWriteResGroup2], (instrs FDECSTP, FINCSTP, FFREE, FFREEP, FNOP, 618 LD_Frr, ST_Frr, ST_FPrr)>; 619def: InstRW<[SBWriteResGroup2], (instrs LOOP, LOOPE, LOOPNE)>; // FIXME: This seems wrong compared to other Intel CPUs. 620def: InstRW<[SBWriteResGroup2], (instrs RET64)>; 621 622def SBWriteResGroup4 : SchedWriteRes<[SBPort05]> { 623 let Latency = 1; 624 let NumMicroOps = 1; 625 let ResourceCycles = [1]; 626} 627def: InstRW<[SBWriteResGroup4], (instrs CDQ, CQO)>; 628 629def SBWriteResGroup5 : SchedWriteRes<[SBPort15]> { 630 let Latency = 1; 631 let NumMicroOps = 1; 632 let ResourceCycles = [1]; 633} 634def: InstRW<[SBWriteResGroup5], (instrs MMX_PABSBrr, 635 MMX_PABSDrr, 636 MMX_PABSWrr, 637 MMX_PADDQrr, 638 MMX_PALIGNRrri, 639 MMX_PSIGNBrr, 640 MMX_PSIGNDrr, 641 MMX_PSIGNWrr)>; 642 643def SBWriteResGroup11 : SchedWriteRes<[SBPort015]> { 644 let Latency = 2; 645 let NumMicroOps = 2; 646 let ResourceCycles = [2]; 647} 648def: InstRW<[SBWriteResGroup11], (instrs SCASB, 649 SCASL, 650 SCASQ, 651 SCASW)>; 652 653def SBWriteResGroup12 : SchedWriteRes<[SBPort0,SBPort1]> { 654 let Latency = 2; 655 let NumMicroOps = 2; 656 let ResourceCycles = [1,1]; 657} 658def: InstRW<[SBWriteResGroup12], (instregex "(V?)(U?)COMI(SD|SS)rr")>; 659 660def SBWriteResGroup15 : SchedWriteRes<[SBPort0,SBPort015]> { 661 let Latency = 2; 662 let NumMicroOps = 2; 663 let ResourceCycles = [1,1]; 664} 665def: InstRW<[SBWriteResGroup15], (instrs CWD, 666 FNSTSW16r)>; 667 668def SBWriteResGroup18 : SchedWriteRes<[SBPort5,SBPort015]> { 669 let Latency = 2; 670 let NumMicroOps = 2; 671 let ResourceCycles = [1,1]; 672} 673def: InstRW<[SBWriteResGroup18], (instrs JCXZ, JECXZ, JRCXZ, 674 MMX_MOVDQ2Qrr)>; 675 676def SBWriteResGroup21 : SchedWriteRes<[SBPort1]> { 677 let Latency = 3; 678 let NumMicroOps = 1; 679 let ResourceCycles = [1]; 680} 681def: InstRW<[SBWriteResGroup21], (instrs PUSHFS64)>; 682 683def SBWriteResGroup22 : SchedWriteRes<[SBPort0,SBPort5]> { 684 let Latency = 3; 685 let NumMicroOps = 2; 686 let ResourceCycles = [1,1]; 687} 688def: InstRW<[SBWriteResGroup22], (instregex "(V?)EXTRACTPSrr")>; 689 690def SBWriteResGroup23 : SchedWriteRes<[SBPort05,SBPort015]> { 691 let Latency = 2; 692 let NumMicroOps = 3; 693 let ResourceCycles = [2,1]; 694} 695def: InstRW<[SBWriteResGroup23], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1, 696 RCR8r1, RCR16r1, RCR32r1, RCR64r1)>; 697 698def SBWriteResGroup24 : SchedWriteRes<[SBPort1,SBPort5,SBPort05,SBPort015]> { 699 let Latency = 3; 700 let NumMicroOps = 8; 701 let ResourceCycles = [1,1,4,2]; 702} 703def: InstRW<[SBWriteResGroup24], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>; 704 705def SBWriteResGroup24b : SchedWriteRes<[SBPort1,SBPort5,SBPort05,SBPort015]> { 706 let Latency = 4; 707 let NumMicroOps = 8; 708 let ResourceCycles = [1,1,4,2]; 709} 710def: InstRW<[SBWriteResGroup24b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>; 711 712def SBWriteResGroup25_1 : SchedWriteRes<[SBPort23,SBPort015]> { 713 let Latency = 7; 714 let NumMicroOps = 3; 715 let ResourceCycles = [1,2]; 716} 717def: InstRW<[SBWriteResGroup25_1], (instrs LEAVE, LEAVE64)>; 718 719def SBWriteResGroup26_2 : SchedWriteRes<[SBPort0,SBPort1,SBPort5]> { 720 let Latency = 3; 721 let NumMicroOps = 3; 722 let ResourceCycles = [1,1,1]; 723} 724def: InstRW<[SBWriteResGroup26_2], (instrs COM_FIPr, COM_FIr, UCOM_FIPr, UCOM_FIr)>; 725 726def SBWriteResGroup29 : SchedWriteRes<[SBPort1,SBPort015]> { 727 let Latency = 4; 728 let NumMicroOps = 2; 729 let ResourceCycles = [1,1]; 730} 731def: InstRW<[SBWriteResGroup29], (instrs MOV64sr)>; 732 733def SBWriteResGroup29_2 : SchedWriteRes<[SBPort5,SBPort015]> { 734 let Latency = 4; 735 let NumMicroOps = 4; 736 let ResourceCycles = [1,3]; 737} 738def: InstRW<[SBWriteResGroup29_2], (instrs PAUSE)>; 739 740def SBWriteResGroup31 : SchedWriteRes<[SBPort23]> { 741 let Latency = 5; 742 let NumMicroOps = 1; 743 let ResourceCycles = [1]; 744} 745def: InstRW<[SBWriteResGroup31], (instregex "MOVSX(16|32|64)rm(8|16|32)", 746 "MOVZX(16|32|64)rm(8|16)")>; 747 748def SBWriteResGroup76 : SchedWriteRes<[SBPort05]> { 749 let Latency = 5; 750 let NumMicroOps = 8; 751 let ResourceCycles = [8]; 752} 753def: InstRW<[SBWriteResGroup76], (instregex "RCL(8|16|32|64)rCL", 754 "RCR(8|16|32|64)rCL")>; 755 756def SBWriteResGroup33 : SchedWriteRes<[SBPort4,SBPort23]> { 757 let Latency = 5; 758 let NumMicroOps = 2; 759 let ResourceCycles = [1,1]; 760} 761def: InstRW<[SBWriteResGroup33], (instregex "PUSH(16r|32r|64r|64i8)")>; 762 763def SBWriteResGroup35 : SchedWriteRes<[SBPort1,SBPort5]> { 764 let Latency = 5; 765 let NumMicroOps = 3; 766 let ResourceCycles = [1,2]; 767} 768def: InstRW<[SBWriteResGroup35], (instrs CLI)>; 769 770def SBWriteResGroup35_2 : SchedWriteRes<[SBPort1,SBPort4,SBPort23]> { 771 let Latency = 5; 772 let NumMicroOps = 3; 773 let ResourceCycles = [1,1,1]; 774} 775def: InstRW<[SBWriteResGroup35_2], (instrs PUSHGS64)>; 776def: InstRW<[SBWriteResGroup35_2], (instregex "ISTT_FP(16|32|64)m")>; 777 778def SBWriteResGroup36 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 779 let Latency = 5; 780 let NumMicroOps = 3; 781 let ResourceCycles = [1,1,1]; 782} 783def: InstRW<[SBWriteResGroup36], (instrs CALL64pcrel32)>; 784def: InstRW<[SBWriteResGroup36], (instregex "CALL(16|32|64)r", 785 "(V?)EXTRACTPSmr")>; 786 787def SBWriteResGroup40 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 788 let Latency = 5; 789 let NumMicroOps = 3; 790 let ResourceCycles = [1,1,1]; 791} 792def: InstRW<[SBWriteResGroup40], (instrs STOSB, STOSL, STOSQ, STOSW)>; 793 794def SBWriteResGroup41 : SchedWriteRes<[SBPort5,SBPort015]> { 795 let Latency = 5; 796 let NumMicroOps = 4; 797 let ResourceCycles = [1,3]; 798} 799def: InstRW<[SBWriteResGroup41], (instrs FNINIT)>; 800 801def SBWriteResGroup45 : SchedWriteRes<[SBPort0,SBPort4,SBPort23,SBPort15]> { 802 let Latency = 5; 803 let NumMicroOps = 4; 804 let ResourceCycles = [1,1,1,1]; 805} 806def: InstRW<[SBWriteResGroup45], (instregex "(V?)PEXTR(D|Q)mr", 807 "PUSHF(16|64)")>; 808 809def SBWriteResGroup46 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 810 let Latency = 5; 811 let NumMicroOps = 4; 812 let ResourceCycles = [1,1,1,1]; 813} 814def: InstRW<[SBWriteResGroup46], (instregex "CLFLUSH")>; 815 816def SBWriteResGroup47 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 817 let Latency = 5; 818 let NumMicroOps = 5; 819 let ResourceCycles = [1,2,1,1]; 820} 821def: InstRW<[SBWriteResGroup47], (instregex "FXRSTOR")>; 822 823def SBWriteResGroup48 : SchedWriteRes<[SBPort23]> { 824 let Latency = 6; 825 let NumMicroOps = 1; 826 let ResourceCycles = [1]; 827} 828def: InstRW<[SBWriteResGroup48], (instrs VBROADCASTSSrm)>; 829def: InstRW<[SBWriteResGroup48], (instregex "POP(16|32|64)r", 830 "(V?)MOV64toPQIrm", 831 "(V?)MOVDDUPrm", 832 "(V?)MOVDI2PDIrm", 833 "(V?)MOVQI2PQIrm", 834 "(V?)MOVSDrm", 835 "(V?)MOVSHDUPrm", 836 "(V?)MOVSLDUPrm", 837 "(V?)MOVSSrm")>; 838 839def SBWriteResGroup49 : SchedWriteRes<[SBPort5,SBPort23]> { 840 let Latency = 6; 841 let NumMicroOps = 2; 842 let ResourceCycles = [1,1]; 843} 844def: InstRW<[SBWriteResGroup49], (instrs MOV16sm)>; 845 846def SBWriteResGroup51 : SchedWriteRes<[SBPort23,SBPort15]> { 847 let Latency = 6; 848 let NumMicroOps = 2; 849 let ResourceCycles = [1,1]; 850} 851def: InstRW<[SBWriteResGroup51], (instrs MMX_PABSBrm, 852 MMX_PABSDrm, 853 MMX_PABSWrm, 854 MMX_PALIGNRrmi, 855 MMX_PSIGNBrm, 856 MMX_PSIGNDrm, 857 MMX_PSIGNWrm)>; 858 859def SBWriteResGroup52 : SchedWriteRes<[SBPort23,SBPort015]> { 860 let Latency = 6; 861 let NumMicroOps = 2; 862 let ResourceCycles = [1,1]; 863} 864def: InstRW<[SBWriteResGroup52], (instrs LODSL, LODSQ)>; 865 866def SBWriteResGroup53 : SchedWriteRes<[SBPort4,SBPort23]> { 867 let Latency = 6; 868 let NumMicroOps = 3; 869 let ResourceCycles = [1,2]; 870} 871def: InstRW<[SBWriteResGroup53], (instregex "ST_F(32|64)m", 872 "ST_FP(32|64|80)m")>; 873 874def SBWriteResGroup54 : SchedWriteRes<[SBPort23]> { 875 let Latency = 7; 876 let NumMicroOps = 1; 877 let ResourceCycles = [1]; 878} 879def: InstRW<[SBWriteResGroup54], (instrs VBROADCASTSDYrm, 880 VBROADCASTSSYrm, 881 VMOVDDUPYrm, 882 VMOVSHDUPYrm, 883 VMOVSLDUPYrm)>; 884 885def SBWriteResGroup58 : SchedWriteRes<[SBPort23,SBPort05]> { 886 let Latency = 7; 887 let NumMicroOps = 2; 888 let ResourceCycles = [1,1]; 889} 890def: InstRW<[SBWriteResGroup58], (instrs VINSERTF128rm)>; 891 892def SBWriteResGroup59 : SchedWriteRes<[SBPort23,SBPort15]> { 893 let Latency = 7; 894 let NumMicroOps = 2; 895 let ResourceCycles = [1,1]; 896} 897def: InstRW<[SBWriteResGroup59], (instrs MMX_PADDQrm)>; 898 899def SBWriteResGroup62 : SchedWriteRes<[SBPort5,SBPort23]> { 900 let Latency = 7; 901 let NumMicroOps = 3; 902 let ResourceCycles = [2,1]; 903} 904def: InstRW<[SBWriteResGroup62], (instrs VERRm, VERWm)>; 905 906def SBWriteResGroup63 : SchedWriteRes<[SBPort23,SBPort015]> { 907 let Latency = 7; 908 let NumMicroOps = 3; 909 let ResourceCycles = [1,2]; 910} 911def: InstRW<[SBWriteResGroup63], (instrs LODSB, LODSW)>; 912 913def SBWriteResGroup64 : SchedWriteRes<[SBPort5,SBPort01,SBPort23]> { 914 let Latency = 7; 915 let NumMicroOps = 3; 916 let ResourceCycles = [1,1,1]; 917} 918def: InstRW<[SBWriteResGroup64], (instrs FARJMP64m)>; 919 920def SBWriteResGroup66 : SchedWriteRes<[SBPort0,SBPort4,SBPort23]> { 921 let Latency = 7; 922 let NumMicroOps = 4; 923 let ResourceCycles = [1,1,2]; 924} 925def: InstRW<[SBWriteResGroup66], (instrs FNSTSWm)>; 926 927def SBWriteResGroup67 : SchedWriteRes<[SBPort1,SBPort5,SBPort015]> { 928 let Latency = 7; 929 let NumMicroOps = 4; 930 let ResourceCycles = [1,2,1]; 931} 932def: InstRW<[SBWriteResGroup67], (instregex "SLDT(16|32|64)r", 933 "STR(16|32|64)r")>; 934 935def SBWriteResGroup68 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 936 let Latency = 7; 937 let NumMicroOps = 4; 938 let ResourceCycles = [1,1,2]; 939} 940def: InstRW<[SBWriteResGroup68], (instrs FNSTCW16m)>; 941def: InstRW<[SBWriteResGroup68], (instregex "CALL(16|32|64)m")>; 942 943def SBWriteResGroup69 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 944 let Latency = 7; 945 let NumMicroOps = 4; 946 let ResourceCycles = [1,2,1]; 947} 948def: InstRW<[SBWriteResGroup69], (instregex "SAR(8|16|32|64)m(1|i)", 949 "SHL(8|16|32|64)m(1|i)", 950 "SHR(8|16|32|64)m(1|i)")>; 951 952def SBWriteResGroup77 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 953 let Latency = 8; 954 let NumMicroOps = 3; 955 let ResourceCycles = [1,1,1]; 956} 957def: InstRW<[SBWriteResGroup77], (instregex "(V?)(U?)COMI(SD|SS)rm")>; 958 959def SBWriteResGroup81 : SchedWriteRes<[SBPort4, SBPort23, SBPort015]> { 960 let Latency = 6; 961 let NumMicroOps = 3; 962 let ResourceCycles = [1, 2, 1]; 963} 964def: InstRW<[SBWriteResGroup81], (instregex "CMPXCHG(8|16)B")>; 965 966def SBWriteResGroup83 : SchedWriteRes<[SBPort23,SBPort015]> { 967 let Latency = 8; 968 let NumMicroOps = 5; 969 let ResourceCycles = [2,3]; 970} 971def: InstRW<[SBWriteResGroup83], (instrs CMPSB, 972 CMPSL, 973 CMPSQ, 974 CMPSW)>; 975 976def SBWriteResGroup84 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 977 let Latency = 8; 978 let NumMicroOps = 5; 979 let ResourceCycles = [1,2,2]; 980} 981def: InstRW<[SBWriteResGroup84], (instrs FLDCW16m)>; 982 983def SBWriteResGroup85 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 984 let Latency = 8; 985 let NumMicroOps = 5; 986 let ResourceCycles = [1,2,2]; 987} 988def: InstRW<[SBWriteResGroup85], (instregex "ROL(8|16|32|64)m(1|i)", 989 "ROR(8|16|32|64)m(1|i)")>; 990 991def SBWriteResGroup86 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 992 let Latency = 8; 993 let NumMicroOps = 5; 994 let ResourceCycles = [1,2,2]; 995} 996def: InstRW<[SBWriteResGroup86], (instrs MOVSB, MOVSL, MOVSQ, MOVSW)>; 997def: InstRW<[SBWriteResGroup86], (instregex "XADD(8|16|32|64)rm")>; 998 999def SBWriteResGroup87 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 1000 let Latency = 8; 1001 let NumMicroOps = 5; 1002 let ResourceCycles = [1,1,1,2]; 1003} 1004def: InstRW<[SBWriteResGroup87], (instrs FARCALL64m)>; 1005 1006def SBWriteResGroup93 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 1007 let Latency = 9; 1008 let NumMicroOps = 3; 1009 let ResourceCycles = [1,1,1]; 1010} 1011def: InstRW<[SBWriteResGroup93], (instregex "CVT(T?)(SD|SS)2SI(64)?rm")>; 1012 1013def SBWriteResGroup95 : SchedWriteRes<[SBPort5,SBPort01,SBPort23]> { 1014 let Latency = 9; 1015 let NumMicroOps = 3; 1016 let ResourceCycles = [1,1,1]; 1017} 1018def: InstRW<[SBWriteResGroup95], (instregex "LD_F(32|64|80)m")>; 1019 1020def SBWriteResGroup97 : SchedWriteRes<[SBPort1,SBPort4,SBPort23]> { 1021 let Latency = 9; 1022 let NumMicroOps = 4; 1023 let ResourceCycles = [1,1,2]; 1024} 1025def: InstRW<[SBWriteResGroup97], (instregex "IST_F(16|32)m", 1026 "IST_FP(16|32|64)m")>; 1027 1028def SBWriteResGroup97_2 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 1029 let Latency = 9; 1030 let NumMicroOps = 6; 1031 let ResourceCycles = [1,2,3]; 1032} 1033def: InstRW<[SBWriteResGroup97_2], (instregex "ROL(8|16|32|64)mCL", 1034 "ROR(8|16|32|64)mCL", 1035 "SAR(8|16|32|64)mCL", 1036 "SHL(8|16|32|64)mCL", 1037 "SHR(8|16|32|64)mCL")>; 1038 1039def SBWriteResGroup98 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 1040 let Latency = 9; 1041 let NumMicroOps = 6; 1042 let ResourceCycles = [1,2,3]; 1043} 1044def: SchedAlias<WriteADCRMW, SBWriteResGroup98>; 1045 1046def SBWriteResGroup99 : SchedWriteRes<[SBPort4,SBPort23,SBPort05,SBPort015]> { 1047 let Latency = 9; 1048 let NumMicroOps = 6; 1049 let ResourceCycles = [1,2,2,1]; 1050} 1051def: InstRW<[SBWriteResGroup99, ReadAfterLd], (instrs ADC8mr, ADC16mr, ADC32mr, ADC64mr, 1052 SBB8mr, SBB16mr, SBB32mr, SBB64mr)>; 1053 1054def SBWriteResGroup100 : SchedWriteRes<[SBPort4,SBPort5,SBPort23,SBPort05,SBPort015]> { 1055 let Latency = 9; 1056 let NumMicroOps = 6; 1057 let ResourceCycles = [1,1,2,1,1]; 1058} 1059def : SchedAlias<WriteBitTestRegLd, SBWriteResGroup100>; // TODO - this is incorrect - no RMW 1060 1061def SBWriteResGroup101 : SchedWriteRes<[SBPort1,SBPort23]> { 1062 let Latency = 10; 1063 let NumMicroOps = 2; 1064 let ResourceCycles = [1,1]; 1065} 1066def: InstRW<[SBWriteResGroup101], (instregex "(ADD|SUB|SUBR)_F(32|64)m", 1067 "ILD_F(16|32|64)m")>; 1068 1069def SBWriteResGroup104 : SchedWriteRes<[SBPort0,SBPort23]> { 1070 let Latency = 11; 1071 let NumMicroOps = 2; 1072 let ResourceCycles = [1,1]; 1073} 1074def: InstRW<[SBWriteResGroup104], (instregex "(V?)PCMPGTQrm")>; 1075 1076def SBWriteResGroup106 : SchedWriteRes<[SBPort1,SBPort23]> { 1077 let Latency = 11; 1078 let NumMicroOps = 3; 1079 let ResourceCycles = [2,1]; 1080} 1081def: InstRW<[SBWriteResGroup106], (instregex "FICOM(P?)(16|32)m")>; 1082 1083def SBWriteResGroup108 : SchedWriteRes<[SBPort05,SBPort23]> { 1084 let Latency = 11; 1085 let NumMicroOps = 11; 1086 let ResourceCycles = [7,4]; 1087} 1088def: InstRW<[SBWriteResGroup108], (instregex "RCL(8|16|32|64)m", 1089 "RCR(8|16|32|64)m")>; 1090 1091def SBWriteResGroup111 : SchedWriteRes<[SBPort0,SBPort23]> { 1092 let Latency = 12; 1093 let NumMicroOps = 2; 1094 let ResourceCycles = [1,1]; 1095} 1096def: InstRW<[SBWriteResGroup111], (instregex "MUL_F(32|64)m")>; 1097 1098def SBWriteResGroup114 : SchedWriteRes<[SBPort1,SBPort23]> { 1099 let Latency = 13; 1100 let NumMicroOps = 3; 1101 let ResourceCycles = [2,1]; 1102} 1103def: InstRW<[SBWriteResGroup114], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>; 1104 1105def SBWriteResGroup119 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 1106 let Latency = 15; 1107 let NumMicroOps = 3; 1108 let ResourceCycles = [1,1,1]; 1109} 1110def: InstRW<[SBWriteResGroup119], (instregex "MUL_FI(16|32)m")>; 1111 1112def SBWriteResGroup130 : SchedWriteRes<[SBPort0,SBPort23]> { 1113 let Latency = 31; 1114 let NumMicroOps = 2; 1115 let ResourceCycles = [1,1]; 1116} 1117def: InstRW<[SBWriteResGroup130], (instregex "DIV(R?)_F(32|64)m")>; 1118 1119def SBWriteResGroup131 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 1120 let Latency = 34; 1121 let NumMicroOps = 3; 1122 let ResourceCycles = [1,1,1]; 1123} 1124def: InstRW<[SBWriteResGroup131], (instregex "DIV(R?)_FI(16|32)m")>; 1125 1126def SBWriteResGroupVzeroall : SchedWriteRes<[SBPort5]> { 1127 let Latency = 9; 1128 let NumMicroOps = 20; 1129 let ResourceCycles = [2]; 1130} 1131def: InstRW<[SBWriteResGroupVzeroall], (instrs VZEROALL)>; 1132 1133def SBWriteResGroupVzeroupper : SchedWriteRes<[]> { 1134 let Latency = 1; 1135 let NumMicroOps = 4; 1136 let ResourceCycles = []; 1137} 1138def: InstRW<[SBWriteResGroupVzeroupper], (instrs VZEROUPPER)>; 1139 1140def: InstRW<[WriteZero], (instrs CLC)>; 1141 1142// Instruction variants handled by the renamer. These might not need execution 1143// ports in certain conditions. 1144// See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs", 1145// section "Sandy Bridge and Ivy Bridge Pipeline" > "Register allocation and 1146// renaming". 1147// These can be investigated with llvm-exegesis, e.g. 1148// echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1149// echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1150 1151def SBWriteZeroLatency : SchedWriteRes<[]> { 1152 let Latency = 0; 1153} 1154 1155def SBWriteZeroIdiom : SchedWriteVariant<[ 1156 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1157 SchedVar<NoSchedPred, [WriteALU]> 1158]>; 1159def : InstRW<[SBWriteZeroIdiom], (instrs SUB32rr, SUB64rr, 1160 XOR32rr, XOR64rr)>; 1161 1162def SBWriteFZeroIdiom : SchedWriteVariant<[ 1163 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1164 SchedVar<NoSchedPred, [WriteFLogic]> 1165]>; 1166def : InstRW<[SBWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr, 1167 VXORPDrr)>; 1168 1169def SBWriteFZeroIdiomY : SchedWriteVariant<[ 1170 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1171 SchedVar<NoSchedPred, [WriteFLogicY]> 1172]>; 1173def : InstRW<[SBWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>; 1174 1175def SBWriteVZeroIdiomLogicX : SchedWriteVariant<[ 1176 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1177 SchedVar<NoSchedPred, [WriteVecLogicX]> 1178]>; 1179def : InstRW<[SBWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>; 1180 1181def SBWriteVZeroIdiomALUX : SchedWriteVariant<[ 1182 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1183 SchedVar<NoSchedPred, [WriteVecALUX]> 1184]>; 1185def : InstRW<[SBWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr, 1186 PSUBDrr, VPSUBDrr, 1187 PSUBQrr, VPSUBQrr, 1188 PSUBWrr, VPSUBWrr, 1189 PCMPGTBrr, VPCMPGTBrr, 1190 PCMPGTDrr, VPCMPGTDrr, 1191 PCMPGTWrr, VPCMPGTWrr)>; 1192 1193def SBWritePCMPGTQ : SchedWriteRes<[SBPort0]> { 1194 let Latency = 5; 1195 let NumMicroOps = 1; 1196 let ResourceCycles = [1]; 1197} 1198 1199def SBWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[ 1200 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1201 SchedVar<NoSchedPred, [SBWritePCMPGTQ]> 1202]>; 1203def : InstRW<[SBWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr)>; 1204 1205// CMOVs that use both Z and C flag require an extra uop. 1206def SBWriteCMOVA_CMOVBErr : SchedWriteRes<[SBPort05,SBPort015]> { 1207 let Latency = 3; 1208 let ResourceCycles = [2,1]; 1209 let NumMicroOps = 3; 1210} 1211 1212def SBWriteCMOVA_CMOVBErm : SchedWriteRes<[SBPort23,SBPort05,SBPort015]> { 1213 let Latency = 8; 1214 let ResourceCycles = [1,2,1]; 1215 let NumMicroOps = 4; 1216} 1217 1218def SBCMOVA_CMOVBErr : SchedWriteVariant<[ 1219 SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [SBWriteCMOVA_CMOVBErr]>, 1220 SchedVar<NoSchedPred, [WriteCMOV]> 1221]>; 1222 1223def SBCMOVA_CMOVBErm : SchedWriteVariant<[ 1224 SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [SBWriteCMOVA_CMOVBErm]>, 1225 SchedVar<NoSchedPred, [WriteCMOV.Folded]> 1226]>; 1227 1228def : InstRW<[SBCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>; 1229def : InstRW<[SBCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>; 1230 1231// SETCCs that use both Z and C flag require an extra uop. 1232def SBWriteSETA_SETBEr : SchedWriteRes<[SBPort05]> { 1233 let Latency = 2; 1234 let ResourceCycles = [2]; 1235 let NumMicroOps = 2; 1236} 1237 1238def SBWriteSETA_SETBEm : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 1239 let Latency = 3; 1240 let ResourceCycles = [1,1,2]; 1241 let NumMicroOps = 4; 1242} 1243 1244def SBSETA_SETBErr : SchedWriteVariant<[ 1245 SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [SBWriteSETA_SETBEr]>, 1246 SchedVar<NoSchedPred, [WriteSETCC]> 1247]>; 1248 1249def SBSETA_SETBErm : SchedWriteVariant<[ 1250 SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [SBWriteSETA_SETBEm]>, 1251 SchedVar<NoSchedPred, [WriteSETCCStore]> 1252]>; 1253 1254def : InstRW<[SBSETA_SETBErr], (instrs SETCCr)>; 1255def : InstRW<[SBSETA_SETBErm], (instrs SETCCm)>; 1256 1257/////////////////////////////////////////////////////////////////////////////// 1258// Dependency breaking instructions. 1259/////////////////////////////////////////////////////////////////////////////// 1260 1261def : IsZeroIdiomFunction<[ 1262 // GPR Zero-idioms. 1263 DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>, 1264 1265 // SSE Zero-idioms. 1266 DepBreakingClass<[ 1267 // fp variants. 1268 XORPSrr, XORPDrr, 1269 1270 // int variants. 1271 PXORrr, 1272 PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr, 1273 PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr 1274 ], ZeroIdiomPredicate>, 1275 1276 // AVX Zero-idioms. 1277 DepBreakingClass<[ 1278 // xmm fp variants. 1279 VXORPSrr, VXORPDrr, 1280 1281 // xmm int variants. 1282 VPXORrr, 1283 VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr, 1284 VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr, 1285 ], ZeroIdiomPredicate>, 1286]>; 1287 1288} // SchedModel 1289