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, int LoadUOps = 1> { 90 // Register variant is using a single cycle on ExePort. 91 def : WriteRes<SchedRW, ExePorts> { 92 let Latency = Lat; 93 let ReleaseAtCycles = 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 ReleaseAtCycles = !listconcat([1], Res); 102 let NumMicroOps = !add(UOps, LoadUOps); 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,2,1], 4>; 228defm : X86WriteRes<WriteFMaskedStore32Y, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 229defm : X86WriteRes<WriteFMaskedStore64, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 230defm : X86WriteRes<WriteFMaskedStore64Y, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 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 : X86WriteRes<WriteDPPS, [SBPort0,SBPort1,SBPort5], 12, [1,2,1], 4>; 299defm : X86WriteRes<WriteDPPSY, [SBPort0,SBPort1,SBPort5], 12, [1,2,1], 4>; 300defm : X86WriteRes<WriteDPPSLd, [SBPort0,SBPort1,SBPort5,SBPort23], 18, [1,2,2,1], 6>; 301defm : X86WriteRes<WriteDPPSYLd, [SBPort0,SBPort1,SBPort5,SBPort23], 19, [1,2,2,1], 6>; 302defm : SBWriteResPair<WriteFSign, [SBPort5], 1>; 303defm : SBWriteResPair<WriteFRnd, [SBPort1], 3, [1], 1, 6>; 304defm : SBWriteResPair<WriteFRndY, [SBPort1], 3, [1], 1, 7>; 305defm : SBWriteResPair<WriteFRndZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 306defm : SBWriteResPair<WriteFLogic, [SBPort5], 1, [1], 1, 6>; 307defm : SBWriteResPair<WriteFLogicY, [SBPort5], 1, [1], 1, 7>; 308defm : SBWriteResPair<WriteFLogicZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 309defm : SBWriteResPair<WriteFTest, [SBPort0], 1, [1], 1, 6>; 310defm : SBWriteResPair<WriteFTestY, [SBPort0], 1, [1], 1, 7>; 311defm : SBWriteResPair<WriteFTestZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 312defm : SBWriteResPair<WriteFShuffle, [SBPort5], 1, [1], 1, 6>; 313defm : SBWriteResPair<WriteFShuffleY,[SBPort5], 1, [1], 1, 7>; 314defm : SBWriteResPair<WriteFShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 315defm : SBWriteResPair<WriteFVarShuffle, [SBPort5], 1, [1], 1, 6>; 316defm : SBWriteResPair<WriteFVarShuffleY,[SBPort5], 1, [1], 1, 7>; 317defm : SBWriteResPair<WriteFVarShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 318defm : SBWriteResPair<WriteFBlend, [SBPort05], 1, [1], 1, 6>; 319defm : SBWriteResPair<WriteFBlendY, [SBPort05], 1, [1], 1, 7>; 320defm : SBWriteResPair<WriteFBlendZ, [SBPort05], 1, [1], 1, 7>; // Unsupported = 1 321defm : SBWriteResPair<WriteFVarBlend, [SBPort05], 2, [2], 2, 6>; 322defm : SBWriteResPair<WriteFVarBlendY,[SBPort05], 2, [2], 2, 7>; 323defm : SBWriteResPair<WriteFVarBlendZ,[SBPort05], 2, [2], 2, 7>; // Unsupported = 1 324 325// Conversion between integer and float. 326defm : SBWriteResPair<WriteCvtSS2I, [SBPort0,SBPort1], 5, [1,1], 2>; 327defm : SBWriteResPair<WriteCvtPS2I, [SBPort1], 3, [1], 1, 6>; 328defm : SBWriteResPair<WriteCvtPS2IY, [SBPort1], 3, [1], 1, 7>; 329defm : SBWriteResPair<WriteCvtPS2IZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 330defm : SBWriteResPair<WriteCvtSD2I, [SBPort0,SBPort1], 5, [1,1], 2>; 331defm : SBWriteResPair<WriteCvtPD2I, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 332defm : X86WriteRes<WriteCvtPD2IY, [SBPort1,SBPort5], 4, [1,1], 2>; 333defm : X86WriteRes<WriteCvtPD2IZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 334defm : X86WriteRes<WriteCvtPD2IYLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; 335defm : X86WriteRes<WriteCvtPD2IZLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; // Unsupported = 1 336 337defm : X86WriteRes<WriteCvtI2SS, [SBPort1,SBPort5], 5, [1,2], 3>; 338defm : X86WriteRes<WriteCvtI2SSLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 339defm : SBWriteResPair<WriteCvtI2PS, [SBPort1], 3, [1], 1, 6>; 340defm : SBWriteResPair<WriteCvtI2PSY, [SBPort1], 3, [1], 1, 7>; 341defm : SBWriteResPair<WriteCvtI2PSZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 342defm : X86WriteRes<WriteCvtI2SD, [SBPort1,SBPort5], 4, [1,1], 2>; 343defm : X86WriteRes<WriteCvtI2PD, [SBPort1,SBPort5], 4, [1,1], 2>; 344defm : X86WriteRes<WriteCvtI2PDY, [SBPort1,SBPort5], 4, [1,1], 2>; 345defm : X86WriteRes<WriteCvtI2PDZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 346defm : X86WriteRes<WriteCvtI2SDLd, [SBPort1,SBPort23], 9, [1,1], 2>; 347defm : X86WriteRes<WriteCvtI2PDLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 348defm : X86WriteRes<WriteCvtI2PDYLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 349defm : X86WriteRes<WriteCvtI2PDZLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; // Unsupported = 1 350 351defm : SBWriteResPair<WriteCvtSS2SD, [SBPort0], 1, [1], 1, 6>; 352defm : X86WriteRes<WriteCvtPS2PD, [SBPort0,SBPort5], 2, [1,1], 2>; 353defm : X86WriteRes<WriteCvtPS2PDY, [SBPort0,SBPort5], 2, [1,1], 2>; 354defm : X86WriteRes<WriteCvtPS2PDZ, [SBPort0,SBPort5], 2, [1,1], 2>; // Unsupported = 1 355defm : X86WriteRes<WriteCvtPS2PDLd, [SBPort0,SBPort23], 7, [1,1], 2>; 356defm : X86WriteRes<WriteCvtPS2PDYLd, [SBPort0,SBPort23], 7, [1,1], 2>; 357defm : X86WriteRes<WriteCvtPS2PDZLd, [SBPort0,SBPort23], 7, [1,1], 2>; // Unsupported = 1 358defm : SBWriteResPair<WriteCvtSD2SS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 359defm : SBWriteResPair<WriteCvtPD2PS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 360defm : SBWriteResPair<WriteCvtPD2PSY, [SBPort1,SBPort5], 4, [1,1], 2, 7>; 361defm : SBWriteResPair<WriteCvtPD2PSZ, [SBPort1,SBPort5], 4, [1,1], 2, 7>; // Unsupported = 1 362 363defm : SBWriteResPair<WriteCvtPH2PS, [SBPort1], 3>; 364defm : SBWriteResPair<WriteCvtPH2PSY, [SBPort1], 3>; 365defm : SBWriteResPair<WriteCvtPH2PSZ, [SBPort1], 3>; // Unsupported = 1 366 367defm : X86WriteRes<WriteCvtPS2PH, [SBPort1], 3, [1], 1>; 368defm : X86WriteRes<WriteCvtPS2PHY, [SBPort1], 3, [1], 1>; 369defm : X86WriteRes<WriteCvtPS2PHZ, [SBPort1], 3, [1], 1>; // Unsupported = 1 370defm : X86WriteRes<WriteCvtPS2PHSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 371defm : X86WriteRes<WriteCvtPS2PHYSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 372defm : X86WriteRes<WriteCvtPS2PHZSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; // Unsupported = 1 373 374// Vector integer operations. 375defm : X86WriteRes<WriteVecLoad, [SBPort23], 5, [1], 1>; 376defm : X86WriteRes<WriteVecLoadX, [SBPort23], 6, [1], 1>; 377defm : X86WriteRes<WriteVecLoadY, [SBPort23], 7, [1], 1>; 378defm : X86WriteRes<WriteVecLoadNT, [SBPort23], 6, [1], 1>; 379defm : X86WriteRes<WriteVecLoadNTY, [SBPort23], 7, [1], 1>; 380defm : X86WriteRes<WriteVecMaskedLoad, [SBPort23,SBPort05], 8, [1,2], 3>; 381defm : X86WriteRes<WriteVecMaskedLoadY, [SBPort23,SBPort05], 9, [1,2], 3>; 382defm : X86WriteRes<WriteVecStore, [SBPort23,SBPort4], 1, [1,1], 1>; 383defm : X86WriteRes<WriteVecStoreX, [SBPort23,SBPort4], 1, [1,1], 1>; 384defm : X86WriteRes<WriteVecStoreY, [SBPort23,SBPort4], 1, [1,1], 1>; 385defm : X86WriteRes<WriteVecStoreNT, [SBPort23,SBPort4], 1, [1,1], 1>; 386defm : X86WriteRes<WriteVecStoreNTY, [SBPort23,SBPort4], 1, [1,1], 1>; 387defm : X86WriteRes<WriteVecMaskedStore32, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 388defm : X86WriteRes<WriteVecMaskedStore32Y, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 389defm : X86WriteRes<WriteVecMaskedStore64, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 390defm : X86WriteRes<WriteVecMaskedStore64Y, [SBPort4,SBPort01,SBPort23], 5, [1,2,1], 4>; 391defm : X86WriteRes<WriteVecMove, [SBPort05], 1, [1], 1>; 392defm : X86WriteRes<WriteVecMoveX, [SBPort015], 1, [1], 1>; 393defm : X86WriteRes<WriteVecMoveY, [SBPort05], 1, [1], 1>; 394defm : X86WriteRes<WriteVecMoveZ, [SBPort05], 1, [1], 1>; 395defm : X86WriteRes<WriteVecMoveToGpr, [SBPort0], 2, [1], 1>; 396defm : X86WriteRes<WriteVecMoveFromGpr, [SBPort5], 1, [1], 1>; 397 398defm : SBWriteResPair<WriteVecLogic, [SBPort015], 1, [1], 1, 5>; 399defm : SBWriteResPair<WriteVecLogicX,[SBPort015], 1, [1], 1, 6>; 400defm : SBWriteResPair<WriteVecLogicY,[SBPort015], 1, [1], 1, 7>; 401defm : SBWriteResPair<WriteVecLogicZ,[SBPort015], 1, [1], 1, 7>; // Unsupported = 1 402defm : SBWriteResPair<WriteVecTest, [SBPort0,SBPort5], 2, [1,1], 2, 6>; 403defm : SBWriteResPair<WriteVecTestY, [SBPort0,SBPort5], 2, [1,1], 2, 7>; 404defm : SBWriteResPair<WriteVecTestZ, [SBPort0,SBPort5], 2, [1,1], 2, 7>; // Unsupported = 1 405defm : SBWriteResPair<WriteVecALU, [SBPort1], 3, [1], 1, 5>; 406defm : SBWriteResPair<WriteVecALUX, [SBPort15], 1, [1], 1, 6>; 407defm : SBWriteResPair<WriteVecALUY, [SBPort15], 1, [1], 1, 7>; 408defm : SBWriteResPair<WriteVecALUZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 409defm : SBWriteResPair<WriteVecIMul, [SBPort0], 5, [1], 1, 5>; 410defm : SBWriteResPair<WriteVecIMulX, [SBPort0], 5, [1], 1, 6>; 411defm : SBWriteResPair<WriteVecIMulY, [SBPort0], 5, [1], 1, 7>; 412defm : SBWriteResPair<WriteVecIMulZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 413defm : SBWriteResPair<WritePMULLD, [SBPort0], 5, [1], 1, 6>; 414defm : SBWriteResPair<WritePMULLDY, [SBPort0], 5, [1], 1, 7>; // TODO this is probably wrong for 256/512-bit for the "generic" model 415defm : SBWriteResPair<WritePMULLDZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 416defm : SBWriteResPair<WriteShuffle, [SBPort5], 1, [1], 1, 5>; 417defm : SBWriteResPair<WriteShuffleX, [SBPort15], 1, [1], 1, 6>; 418defm : SBWriteResPair<WriteShuffleY, [SBPort5], 1, [1], 1, 7>; 419defm : SBWriteResPair<WriteShuffleZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 420defm : SBWriteResPair<WriteVarShuffle, [SBPort15], 1, [1], 1, 5>; 421defm : SBWriteResPair<WriteVarShuffleX, [SBPort15], 1, [1], 1, 6>; 422defm : SBWriteResPair<WriteVarShuffleY, [SBPort15], 1, [1], 1, 7>; 423defm : SBWriteResPair<WriteVarShuffleZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 424defm : SBWriteResPair<WriteBlend, [SBPort15], 1, [1], 1, 6>; 425defm : SBWriteResPair<WriteBlendY, [SBPort15], 1, [1], 1, 7>; 426defm : SBWriteResPair<WriteBlendZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 427defm : SBWriteResPair<WriteVarBlend, [SBPort15], 2, [2], 2, 6>; 428defm : SBWriteResPair<WriteVarBlendY,[SBPort15], 2, [2], 2, 7>; 429defm : SBWriteResPair<WriteVarBlendZ,[SBPort15], 2, [2], 2, 7>; // Unsupported = 1 430defm : SBWriteResPair<WriteMPSAD, [SBPort0, SBPort15], 7, [1,2], 3, 6>; 431defm : SBWriteResPair<WriteMPSADY, [SBPort0, SBPort15], 7, [1,2], 3, 7>; 432defm : SBWriteResPair<WriteMPSADZ, [SBPort0, SBPort15], 7, [1,2], 3, 7>; // Unsupported = 1 433defm : SBWriteResPair<WritePSADBW, [SBPort0], 5, [1], 1, 5>; 434defm : SBWriteResPair<WritePSADBWX, [SBPort0], 5, [1], 1, 6>; 435defm : SBWriteResPair<WritePSADBWY, [SBPort0], 5, [1], 1, 7>; 436defm : SBWriteResPair<WritePSADBWZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 437defm : SBWriteResPair<WritePHMINPOS, [SBPort0], 5, [1], 1, 6>; 438 439// Vector integer shifts. 440defm : SBWriteResPair<WriteVecShift, [SBPort5], 1, [1], 1, 5>; 441defm : SBWriteResPair<WriteVecShiftX, [SBPort0,SBPort15], 2, [1,1], 2, 6>; 442defm : SBWriteResPair<WriteVecShiftY, [SBPort0,SBPort15], 4, [1,1], 2, 7>; 443defm : SBWriteResPair<WriteVecShiftZ, [SBPort0,SBPort15], 4, [1,1], 2, 7>; // Unsupported = 1 444defm : SBWriteResPair<WriteVecShiftImm, [SBPort5], 1, [1], 1, 5>; 445defm : SBWriteResPair<WriteVecShiftImmX, [SBPort0], 1, [1], 1, 6>; 446defm : SBWriteResPair<WriteVecShiftImmY, [SBPort0], 1, [1], 1, 7>; 447defm : SBWriteResPair<WriteVecShiftImmZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 448defm : SBWriteResPair<WriteVarVecShift, [SBPort0], 1, [1], 1, 6>; 449defm : SBWriteResPair<WriteVarVecShiftY, [SBPort0], 1, [1], 1, 7>; 450defm : SBWriteResPair<WriteVarVecShiftZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 451 452// Vector insert/extract operations. 453def : WriteRes<WriteVecInsert, [SBPort5,SBPort15]> { 454 let Latency = 2; 455 let NumMicroOps = 2; 456} 457def : WriteRes<WriteVecInsertLd, [SBPort23,SBPort15]> { 458 let Latency = 7; 459 let NumMicroOps = 2; 460} 461 462def : WriteRes<WriteVecExtract, [SBPort0,SBPort15]> { 463 let Latency = 3; 464 let NumMicroOps = 2; 465} 466def : WriteRes<WriteVecExtractSt, [SBPort4,SBPort23,SBPort15]> { 467 let Latency = 5; 468 let NumMicroOps = 3; 469} 470 471//////////////////////////////////////////////////////////////////////////////// 472// Horizontal add/sub instructions. 473//////////////////////////////////////////////////////////////////////////////// 474 475defm : SBWriteResPair<WriteFHAdd, [SBPort1,SBPort5], 5, [1,2], 3, 6>; 476defm : SBWriteResPair<WriteFHAddY, [SBPort1,SBPort5], 5, [1,2], 3, 7>; 477defm : SBWriteResPair<WriteFHAddZ, [SBPort1,SBPort5], 5, [1,2], 3, 7>; // Unsupported = 1 478defm : SBWriteResPair<WritePHAdd, [SBPort15], 3, [3], 3, 5>; 479defm : SBWriteResPair<WritePHAddX, [SBPort15], 3, [3], 3, 6>; 480defm : SBWriteResPair<WritePHAddY, [SBPort15], 3, [3], 3, 7>; 481defm : SBWriteResPair<WritePHAddZ, [SBPort15], 3, [3], 3, 7>; // Unsupported = 1 482 483//////////////////////////////////////////////////////////////////////////////// 484// String instructions. 485//////////////////////////////////////////////////////////////////////////////// 486 487// Packed Compare Implicit Length Strings, Return Mask 488def : WriteRes<WritePCmpIStrM, [SBPort0]> { 489 let Latency = 11; 490 let NumMicroOps = 3; 491 let ReleaseAtCycles = [3]; 492} 493def : WriteRes<WritePCmpIStrMLd, [SBPort0, SBPort23]> { 494 let Latency = 17; 495 let NumMicroOps = 4; 496 let ReleaseAtCycles = [3,1]; 497} 498 499// Packed Compare Explicit Length Strings, Return Mask 500def : WriteRes<WritePCmpEStrM, [SBPort015]> { 501 let Latency = 11; 502 let ReleaseAtCycles = [8]; 503} 504def : WriteRes<WritePCmpEStrMLd, [SBPort015, SBPort23]> { 505 let Latency = 17; 506 let ReleaseAtCycles = [7, 1]; 507} 508 509// Packed Compare Implicit Length Strings, Return Index 510def : WriteRes<WritePCmpIStrI, [SBPort0]> { 511 let Latency = 11; 512 let NumMicroOps = 3; 513 let ReleaseAtCycles = [3]; 514} 515def : WriteRes<WritePCmpIStrILd, [SBPort0,SBPort23]> { 516 let Latency = 17; 517 let NumMicroOps = 4; 518 let ReleaseAtCycles = [3,1]; 519} 520 521// Packed Compare Explicit Length Strings, Return Index 522def : WriteRes<WritePCmpEStrI, [SBPort015]> { 523 let Latency = 4; 524 let ReleaseAtCycles = [8]; 525} 526def : WriteRes<WritePCmpEStrILd, [SBPort015, SBPort23]> { 527 let Latency = 10; 528 let ReleaseAtCycles = [7, 1]; 529} 530 531// MOVMSK Instructions. 532def : WriteRes<WriteFMOVMSK, [SBPort0]> { let Latency = 2; } 533def : WriteRes<WriteVecMOVMSK, [SBPort0]> { let Latency = 2; } 534def : WriteRes<WriteVecMOVMSKY, [SBPort0]> { let Latency = 2; } 535def : WriteRes<WriteMMXMOVMSK, [SBPort0]> { let Latency = 1; } 536 537// AES Instructions. 538def : WriteRes<WriteAESDecEnc, [SBPort5,SBPort015]> { 539 let Latency = 7; 540 let NumMicroOps = 2; 541 let ReleaseAtCycles = [1,1]; 542} 543def : WriteRes<WriteAESDecEncLd, [SBPort5,SBPort23,SBPort015]> { 544 let Latency = 13; 545 let NumMicroOps = 3; 546 let ReleaseAtCycles = [1,1,1]; 547} 548 549def : WriteRes<WriteAESIMC, [SBPort5]> { 550 let Latency = 12; 551 let NumMicroOps = 2; 552 let ReleaseAtCycles = [2]; 553} 554def : WriteRes<WriteAESIMCLd, [SBPort5,SBPort23]> { 555 let Latency = 18; 556 let NumMicroOps = 3; 557 let ReleaseAtCycles = [2,1]; 558} 559 560def : WriteRes<WriteAESKeyGen, [SBPort015]> { 561 let Latency = 8; 562 let ReleaseAtCycles = [11]; 563} 564def : WriteRes<WriteAESKeyGenLd, [SBPort015, SBPort23]> { 565 let Latency = 14; 566 let ReleaseAtCycles = [10, 1]; 567} 568 569// Carry-less multiplication instructions. 570def : WriteRes<WriteCLMul, [SBPort015]> { 571 let Latency = 14; 572 let ReleaseAtCycles = [18]; 573} 574def : WriteRes<WriteCLMulLd, [SBPort015, SBPort23]> { 575 let Latency = 20; 576 let ReleaseAtCycles = [17, 1]; 577} 578 579// Load/store MXCSR. 580// FIXME: This is probably wrong. Only STMXCSR should require Port4. 581def : WriteRes<WriteLDMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ReleaseAtCycles = [1,1,1,1]; } 582def : WriteRes<WriteSTMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ReleaseAtCycles = [1,1,1,1]; } 583 584def : WriteRes<WriteSystem, [SBPort015]> { let Latency = 100; } 585def : WriteRes<WriteMicrocoded, [SBPort015]> { let Latency = 100; } 586def : WriteRes<WriteFence, [SBPort23, SBPort4]>; 587def : WriteRes<WriteNop, []>; 588 589// AVX2/FMA is not supported on that architecture, but we should define the basic 590// scheduling resources anyway. 591defm : SBWriteResPair<WriteFShuffle256, [SBPort5], 1, [1], 1, 7>; 592defm : SBWriteResPair<WriteFVarShuffle256, [SBPort5], 1, [1], 1, 7>; 593defm : SBWriteResPair<WriteShuffle256, [SBPort5], 1, [1], 1, 7>; 594defm : SBWriteResPair<WriteVPMOV256, [SBPort5], 1, [1], 1, 7>; 595defm : SBWriteResPair<WriteVarShuffle256, [SBPort5], 1, [1], 1, 7>; 596defm : SBWriteResPair<WriteFMA, [SBPort01], 5>; 597defm : SBWriteResPair<WriteFMAX, [SBPort01], 5>; 598defm : SBWriteResPair<WriteFMAY, [SBPort01], 5>; 599defm : SBWriteResPair<WriteFMAZ, [SBPort01], 5>; // Unsupported = 1 600 601// Remaining SNB instrs. 602 603def SBWriteResGroup1 : SchedWriteRes<[SBPort1]> { 604 let Latency = 1; 605 let NumMicroOps = 1; 606 let ReleaseAtCycles = [1]; 607} 608def: InstRW<[SBWriteResGroup1], (instrs COMP_FST0r, 609 COM_FST0r, 610 UCOM_FPr, 611 UCOM_Fr)>; 612 613def SBWriteResGroup2 : SchedWriteRes<[SBPort5]> { 614 let Latency = 1; 615 let NumMicroOps = 1; 616 let ReleaseAtCycles = [1]; 617} 618def: InstRW<[SBWriteResGroup2], (instrs FDECSTP, FINCSTP, FFREE, FFREEP, FNOP, 619 LD_Frr, ST_Frr, ST_FPrr)>; 620def: InstRW<[SBWriteResGroup2], (instrs RET64)>; 621 622def SBWriteResGroup4 : SchedWriteRes<[SBPort05]> { 623 let Latency = 1; 624 let NumMicroOps = 1; 625 let ReleaseAtCycles = [1]; 626} 627def: InstRW<[SBWriteResGroup4], (instrs CDQ, CQO)>; 628 629def SBWriteResGroup5 : SchedWriteRes<[SBPort15]> { 630 let Latency = 1; 631 let NumMicroOps = 1; 632 let ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [1]; 680} 681def: InstRW<[SBWriteResGroup21], (instrs PUSHFS64)>; 682 683def SBWriteResGroup22 : SchedWriteRes<[SBPort0,SBPort5]> { 684 let Latency = 3; 685 let NumMicroOps = 2; 686 let ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [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 ReleaseAtCycles = [1,3]; 737} 738def: InstRW<[SBWriteResGroup29_2], (instrs PAUSE)>; 739 740def SBWriteResGroup30 : SchedWriteRes<[SBPort1,SBPort5,SBPort015]> { 741 let Latency = 3; 742 let NumMicroOps = 8; 743 let ReleaseAtCycles = [1,3,4]; 744} 745def: InstRW<[SBWriteResGroup30], (instrs LOOP)>; 746 747def SBWriteResGroup31 : SchedWriteRes<[SBPort1,SBPort5,SBPort015,SBPort05]> { 748 let Latency = 4; 749 let NumMicroOps = 12; 750 let ReleaseAtCycles = [1,3,6,2]; 751} 752def: InstRW<[SBWriteResGroup31], (instrs LOOPE, LOOPNE)>; 753 754def SBWriteResGroup76 : SchedWriteRes<[SBPort05]> { 755 let Latency = 5; 756 let NumMicroOps = 8; 757 let ReleaseAtCycles = [8]; 758} 759def: InstRW<[SBWriteResGroup76], (instregex "RCL(8|16|32|64)rCL", 760 "RCR(8|16|32|64)rCL")>; 761 762def SBWriteResGroup33 : SchedWriteRes<[SBPort4,SBPort23]> { 763 let Latency = 5; 764 let NumMicroOps = 2; 765 let ReleaseAtCycles = [1,1]; 766} 767def: InstRW<[SBWriteResGroup33], (instregex "PUSH(16r|32r|64r|64i8)")>; 768 769def SBWriteResGroup35 : SchedWriteRes<[SBPort1,SBPort5]> { 770 let Latency = 5; 771 let NumMicroOps = 3; 772 let ReleaseAtCycles = [1,2]; 773} 774def: InstRW<[SBWriteResGroup35], (instrs CLI)>; 775 776def SBWriteResGroup35_2 : SchedWriteRes<[SBPort1,SBPort4,SBPort23]> { 777 let Latency = 5; 778 let NumMicroOps = 3; 779 let ReleaseAtCycles = [1,1,1]; 780} 781def: InstRW<[SBWriteResGroup35_2], (instrs PUSHGS64)>; 782def: InstRW<[SBWriteResGroup35_2], (instregex "ISTT_FP(16|32|64)m")>; 783 784def SBWriteResGroup36 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 785 let Latency = 5; 786 let NumMicroOps = 3; 787 let ReleaseAtCycles = [1,1,1]; 788} 789def: InstRW<[SBWriteResGroup36], (instrs CALL64pcrel32)>; 790def: InstRW<[SBWriteResGroup36], (instregex "CALL(16|32|64)r", 791 "(V?)EXTRACTPSmr")>; 792 793def SBWriteResGroup40 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 794 let Latency = 5; 795 let NumMicroOps = 3; 796 let ReleaseAtCycles = [1,1,1]; 797} 798def: InstRW<[SBWriteResGroup40], (instrs STOSB, STOSL, STOSQ, STOSW)>; 799 800def SBWriteResGroup41 : SchedWriteRes<[SBPort5,SBPort015]> { 801 let Latency = 5; 802 let NumMicroOps = 4; 803 let ReleaseAtCycles = [1,3]; 804} 805def: InstRW<[SBWriteResGroup41], (instrs FNINIT)>; 806 807def SBWriteResGroup45 : SchedWriteRes<[SBPort0,SBPort4,SBPort23,SBPort15]> { 808 let Latency = 5; 809 let NumMicroOps = 4; 810 let ReleaseAtCycles = [1,1,1,1]; 811} 812def: InstRW<[SBWriteResGroup45], (instregex "(V?)PEXTR(D|Q)mr", 813 "PUSHF(16|64)")>; 814 815def SBWriteResGroup46 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 816 let Latency = 5; 817 let NumMicroOps = 4; 818 let ReleaseAtCycles = [1,1,1,1]; 819} 820def: InstRW<[SBWriteResGroup46], (instregex "CLFLUSH")>; 821 822def SBWriteResGroup47 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 823 let Latency = 5; 824 let NumMicroOps = 5; 825 let ReleaseAtCycles = [1,2,1,1]; 826} 827def: InstRW<[SBWriteResGroup47], (instregex "FXRSTOR")>; 828 829def SBWriteResGroup48 : SchedWriteRes<[SBPort23]> { 830 let Latency = 6; 831 let NumMicroOps = 1; 832 let ReleaseAtCycles = [1]; 833} 834def: InstRW<[SBWriteResGroup48], (instrs VBROADCASTSSrm)>; 835def: InstRW<[SBWriteResGroup48], (instregex "POP(16|32|64)r", 836 "(V?)MOV64toPQIrm", 837 "(V?)MOVDDUPrm", 838 "(V?)MOVDI2PDIrm", 839 "(V?)MOVQI2PQIrm", 840 "(V?)MOVSDrm", 841 "(V?)MOVSHDUPrm", 842 "(V?)MOVSLDUPrm", 843 "(V?)MOVSSrm")>; 844 845def SBWriteResGroup49 : SchedWriteRes<[SBPort5,SBPort23]> { 846 let Latency = 6; 847 let NumMicroOps = 2; 848 let ReleaseAtCycles = [1,1]; 849} 850def: InstRW<[SBWriteResGroup49], (instrs MOV16sm)>; 851 852def SBWriteResGroup51 : SchedWriteRes<[SBPort23,SBPort15]> { 853 let Latency = 6; 854 let NumMicroOps = 2; 855 let ReleaseAtCycles = [1,1]; 856} 857def: InstRW<[SBWriteResGroup51], (instrs MMX_PABSBrm, 858 MMX_PABSDrm, 859 MMX_PABSWrm, 860 MMX_PALIGNRrmi, 861 MMX_PSIGNBrm, 862 MMX_PSIGNDrm, 863 MMX_PSIGNWrm)>; 864 865def SBWriteResGroup52 : SchedWriteRes<[SBPort23,SBPort015]> { 866 let Latency = 6; 867 let NumMicroOps = 2; 868 let ReleaseAtCycles = [1,1]; 869} 870def: InstRW<[SBWriteResGroup52], (instrs LODSL, LODSQ)>; 871 872def SBWriteResGroup53 : SchedWriteRes<[SBPort4,SBPort23]> { 873 let Latency = 6; 874 let NumMicroOps = 3; 875 let ReleaseAtCycles = [1,2]; 876} 877def: InstRW<[SBWriteResGroup53], (instregex "ST_F(32|64)m", 878 "ST_FP(32|64|80)m")>; 879 880def SBWriteResGroup54 : SchedWriteRes<[SBPort23]> { 881 let Latency = 7; 882 let NumMicroOps = 1; 883 let ReleaseAtCycles = [1]; 884} 885def: InstRW<[SBWriteResGroup54], (instrs VMOVDDUPYrm, 886 VMOVSHDUPYrm, 887 VMOVSLDUPYrm)>; 888 889def SBWriteResGroup58 : SchedWriteRes<[SBPort23,SBPort05]> { 890 let Latency = 7; 891 let NumMicroOps = 2; 892 let ReleaseAtCycles = [1,1]; 893} 894def: InstRW<[SBWriteResGroup58], (instrs VINSERTF128rm)>; 895 896def SBWriteResGroup59 : SchedWriteRes<[SBPort23,SBPort15]> { 897 let Latency = 7; 898 let NumMicroOps = 2; 899 let ReleaseAtCycles = [1,1]; 900} 901def: InstRW<[SBWriteResGroup59], (instrs MMX_PADDQrm)>; 902 903def SBWriteResGroup62 : SchedWriteRes<[SBPort5,SBPort23]> { 904 let Latency = 7; 905 let NumMicroOps = 3; 906 let ReleaseAtCycles = [2,1]; 907} 908def: InstRW<[SBWriteResGroup62], (instrs VERRm, VERWm)>; 909 910def SBWriteResGroup63 : SchedWriteRes<[SBPort23,SBPort015]> { 911 let Latency = 7; 912 let NumMicroOps = 3; 913 let ReleaseAtCycles = [1,2]; 914} 915def: InstRW<[SBWriteResGroup63], (instrs LODSB, LODSW)>; 916 917def SBWriteResGroup64 : SchedWriteRes<[SBPort5,SBPort01,SBPort23]> { 918 let Latency = 7; 919 let NumMicroOps = 3; 920 let ReleaseAtCycles = [1,1,1]; 921} 922def: InstRW<[SBWriteResGroup64], (instrs FARJMP64m)>; 923 924def SBWriteResGroup66 : SchedWriteRes<[SBPort0,SBPort4,SBPort23]> { 925 let Latency = 7; 926 let NumMicroOps = 4; 927 let ReleaseAtCycles = [1,1,2]; 928} 929def: InstRW<[SBWriteResGroup66], (instrs FNSTSWm)>; 930 931def SBWriteResGroup67 : SchedWriteRes<[SBPort1,SBPort5,SBPort015]> { 932 let Latency = 7; 933 let NumMicroOps = 4; 934 let ReleaseAtCycles = [1,2,1]; 935} 936def: InstRW<[SBWriteResGroup67], (instregex "SLDT(16|32|64)r", 937 "STR(16|32|64)r")>; 938 939def SBWriteResGroup68 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 940 let Latency = 7; 941 let NumMicroOps = 4; 942 let ReleaseAtCycles = [1,1,2]; 943} 944def: InstRW<[SBWriteResGroup68], (instrs FNSTCW16m)>; 945def: InstRW<[SBWriteResGroup68], (instregex "CALL(16|32|64)m")>; 946 947def SBWriteResGroup69 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 948 let Latency = 7; 949 let NumMicroOps = 4; 950 let ReleaseAtCycles = [1,2,1]; 951} 952def: InstRW<[SBWriteResGroup69], (instregex "SAR(8|16|32|64)m(1|i)", 953 "SHL(8|16|32|64)m(1|i)", 954 "SHR(8|16|32|64)m(1|i)")>; 955 956def SBWriteResGroup77 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 957 let Latency = 8; 958 let NumMicroOps = 3; 959 let ReleaseAtCycles = [1,1,1]; 960} 961def: InstRW<[SBWriteResGroup77], (instregex "(V?)(U?)COMI(SD|SS)rm")>; 962 963def SBWriteResGroup81 : SchedWriteRes<[SBPort4, SBPort23, SBPort015]> { 964 let Latency = 6; 965 let NumMicroOps = 3; 966 let ReleaseAtCycles = [1, 2, 1]; 967} 968def: InstRW<[SBWriteResGroup81], (instregex "CMPXCHG(8|16)B")>; 969 970def SBWriteResGroup83 : SchedWriteRes<[SBPort23,SBPort015]> { 971 let Latency = 8; 972 let NumMicroOps = 5; 973 let ReleaseAtCycles = [2,3]; 974} 975def: InstRW<[SBWriteResGroup83], (instrs CMPSB, 976 CMPSL, 977 CMPSQ, 978 CMPSW)>; 979 980def SBWriteResGroup84 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 981 let Latency = 8; 982 let NumMicroOps = 5; 983 let ReleaseAtCycles = [1,2,2]; 984} 985def: InstRW<[SBWriteResGroup84], (instrs FLDCW16m)>; 986 987def SBWriteResGroup85 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 988 let Latency = 8; 989 let NumMicroOps = 5; 990 let ReleaseAtCycles = [1,2,2]; 991} 992def: InstRW<[SBWriteResGroup85], (instregex "ROL(8|16|32|64)m(1|i)", 993 "ROR(8|16|32|64)m(1|i)")>; 994 995def SBWriteResGroup86 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 996 let Latency = 8; 997 let NumMicroOps = 5; 998 let ReleaseAtCycles = [1,2,2]; 999} 1000def: InstRW<[SBWriteResGroup86], (instrs MOVSB, MOVSL, MOVSQ, MOVSW)>; 1001def: InstRW<[SBWriteResGroup86], (instregex "XADD(8|16|32|64)rm")>; 1002 1003def SBWriteResGroup87 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 1004 let Latency = 8; 1005 let NumMicroOps = 5; 1006 let ReleaseAtCycles = [1,1,1,2]; 1007} 1008def: InstRW<[SBWriteResGroup87], (instrs FARCALL64m)>; 1009 1010def SBWriteResGroup95 : SchedWriteRes<[SBPort5,SBPort01,SBPort23]> { 1011 let Latency = 9; 1012 let NumMicroOps = 3; 1013 let ReleaseAtCycles = [1,1,1]; 1014} 1015def: InstRW<[SBWriteResGroup95], (instregex "LD_F(32|64|80)m")>; 1016 1017def SBWriteResGroup97 : SchedWriteRes<[SBPort1,SBPort4,SBPort23]> { 1018 let Latency = 9; 1019 let NumMicroOps = 4; 1020 let ReleaseAtCycles = [1,1,2]; 1021} 1022def: InstRW<[SBWriteResGroup97], (instregex "IST_F(16|32)m", 1023 "IST_FP(16|32|64)m")>; 1024 1025def SBWriteResGroup97_2 : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 1026 let Latency = 9; 1027 let NumMicroOps = 6; 1028 let ReleaseAtCycles = [1,2,3]; 1029} 1030def: InstRW<[SBWriteResGroup97_2], (instregex "ROL(8|16|32|64)mCL", 1031 "ROR(8|16|32|64)mCL", 1032 "SAR(8|16|32|64)mCL", 1033 "SHL(8|16|32|64)mCL", 1034 "SHR(8|16|32|64)mCL")>; 1035 1036def SBWriteResGroup98 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 1037 let Latency = 9; 1038 let NumMicroOps = 4; 1039 let ReleaseAtCycles = [1,2,3]; 1040} 1041def: SchedAlias<WriteADCRMW, SBWriteResGroup98>; 1042 1043def SBWriteResGroup99 : SchedWriteRes<[SBPort4,SBPort23,SBPort05,SBPort015]> { 1044 let Latency = 9; 1045 let NumMicroOps = 4; 1046 let ReleaseAtCycles = [1,2,2,1]; 1047} 1048def: InstRW<[SBWriteResGroup99, ReadAfterLd], (instrs ADC8mr, ADC16mr, ADC32mr, ADC64mr, 1049 SBB8mr, SBB16mr, SBB32mr, SBB64mr)>; 1050 1051def SBWriteResGroup100 : SchedWriteRes<[SBPort4,SBPort5,SBPort23,SBPort05,SBPort015]> { 1052 let Latency = 9; 1053 let NumMicroOps = 6; 1054 let ReleaseAtCycles = [1,1,2,1,1]; 1055} 1056def : SchedAlias<WriteBitTestRegLd, SBWriteResGroup100>; // TODO - this is incorrect - no RMW 1057 1058def SBWriteResGroup101 : SchedWriteRes<[SBPort1,SBPort23]> { 1059 let Latency = 10; 1060 let NumMicroOps = 2; 1061 let ReleaseAtCycles = [1,1]; 1062} 1063def: InstRW<[SBWriteResGroup101], (instregex "(ADD|SUB|SUBR)_F(32|64)m", 1064 "ILD_F(16|32|64)m")>; 1065 1066def SBWriteResGroup104 : SchedWriteRes<[SBPort0,SBPort23]> { 1067 let Latency = 11; 1068 let NumMicroOps = 2; 1069 let ReleaseAtCycles = [1,1]; 1070} 1071def: InstRW<[SBWriteResGroup104], (instregex "(V?)PCMPGTQrm")>; 1072 1073def SBWriteResGroup106 : SchedWriteRes<[SBPort1,SBPort23]> { 1074 let Latency = 11; 1075 let NumMicroOps = 3; 1076 let ReleaseAtCycles = [2,1]; 1077} 1078def: InstRW<[SBWriteResGroup106], (instregex "FICOM(P?)(16|32)m")>; 1079 1080def SBWriteResGroup108 : SchedWriteRes<[SBPort05,SBPort23]> { 1081 let Latency = 11; 1082 let NumMicroOps = 11; 1083 let ReleaseAtCycles = [7,4]; 1084} 1085def: InstRW<[SBWriteResGroup108], (instregex "RCL(8|16|32|64)m", 1086 "RCR(8|16|32|64)m")>; 1087 1088def SBWriteResGroup111 : SchedWriteRes<[SBPort0,SBPort23]> { 1089 let Latency = 12; 1090 let NumMicroOps = 2; 1091 let ReleaseAtCycles = [1,1]; 1092} 1093def: InstRW<[SBWriteResGroup111], (instregex "MUL_F(32|64)m")>; 1094 1095def SBWriteResGroup114 : SchedWriteRes<[SBPort1,SBPort23]> { 1096 let Latency = 13; 1097 let NumMicroOps = 3; 1098 let ReleaseAtCycles = [2,1]; 1099} 1100def: InstRW<[SBWriteResGroup114], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>; 1101 1102def SBWriteResGroup119 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 1103 let Latency = 15; 1104 let NumMicroOps = 3; 1105 let ReleaseAtCycles = [1,1,1]; 1106} 1107def: InstRW<[SBWriteResGroup119], (instregex "MUL_FI(16|32)m")>; 1108 1109def SBWriteResGroup130 : SchedWriteRes<[SBPort0,SBPort23]> { 1110 let Latency = 31; 1111 let NumMicroOps = 2; 1112 let ReleaseAtCycles = [1,1]; 1113} 1114def: InstRW<[SBWriteResGroup130], (instregex "DIV(R?)_F(32|64)m")>; 1115 1116def SBWriteResGroup131 : SchedWriteRes<[SBPort0,SBPort1,SBPort23]> { 1117 let Latency = 34; 1118 let NumMicroOps = 3; 1119 let ReleaseAtCycles = [1,1,1]; 1120} 1121def: InstRW<[SBWriteResGroup131], (instregex "DIV(R?)_FI(16|32)m")>; 1122 1123def SBWriteResGroupVzeroall : SchedWriteRes<[SBPort5]> { 1124 let Latency = 9; 1125 let NumMicroOps = 20; 1126 let ReleaseAtCycles = [2]; 1127} 1128def: InstRW<[SBWriteResGroupVzeroall], (instrs VZEROALL)>; 1129 1130def SBWriteResGroupVzeroupper : SchedWriteRes<[]> { 1131 let Latency = 1; 1132 let NumMicroOps = 4; 1133 let ReleaseAtCycles = []; 1134} 1135def: InstRW<[SBWriteResGroupVzeroupper], (instrs VZEROUPPER)>; 1136 1137def: InstRW<[WriteZero], (instrs CLC)>; 1138 1139// Instruction variants handled by the renamer. These might not need execution 1140// ports in certain conditions. 1141// See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs", 1142// section "Sandy Bridge and Ivy Bridge Pipeline" > "Register allocation and 1143// renaming". 1144// These can be investigated with llvm-exegesis, e.g. 1145// echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1146// echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1147 1148def SBWriteZeroLatency : SchedWriteRes<[]> { 1149 let Latency = 0; 1150} 1151 1152def SBWriteZeroIdiom : SchedWriteVariant<[ 1153 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1154 SchedVar<NoSchedPred, [WriteALU]> 1155]>; 1156def : InstRW<[SBWriteZeroIdiom], (instrs SUB32rr, SUB64rr, 1157 XOR32rr, XOR64rr)>; 1158 1159def SBWriteFZeroIdiom : SchedWriteVariant<[ 1160 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1161 SchedVar<NoSchedPred, [WriteFLogic]> 1162]>; 1163def : InstRW<[SBWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr, 1164 VXORPDrr)>; 1165 1166def SBWriteFZeroIdiomY : SchedWriteVariant<[ 1167 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1168 SchedVar<NoSchedPred, [WriteFLogicY]> 1169]>; 1170def : InstRW<[SBWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>; 1171 1172def SBWriteVZeroIdiomLogicX : SchedWriteVariant<[ 1173 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1174 SchedVar<NoSchedPred, [WriteVecLogicX]> 1175]>; 1176def : InstRW<[SBWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>; 1177 1178def SBWriteVZeroIdiomALUX : SchedWriteVariant<[ 1179 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1180 SchedVar<NoSchedPred, [WriteVecALUX]> 1181]>; 1182def : InstRW<[SBWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr, 1183 PSUBDrr, VPSUBDrr, 1184 PSUBQrr, VPSUBQrr, 1185 PSUBWrr, VPSUBWrr, 1186 PCMPGTBrr, VPCMPGTBrr, 1187 PCMPGTDrr, VPCMPGTDrr, 1188 PCMPGTWrr, VPCMPGTWrr)>; 1189 1190def SBWritePCMPGTQ : SchedWriteRes<[SBPort0]> { 1191 let Latency = 5; 1192 let NumMicroOps = 1; 1193 let ReleaseAtCycles = [1]; 1194} 1195 1196def SBWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[ 1197 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SBWriteZeroLatency]>, 1198 SchedVar<NoSchedPred, [SBWritePCMPGTQ]> 1199]>; 1200def : InstRW<[SBWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr)>; 1201 1202// CMOVs that use both Z and C flag require an extra uop. 1203def SBWriteCMOVA_CMOVBErr : SchedWriteRes<[SBPort05,SBPort015]> { 1204 let Latency = 3; 1205 let ReleaseAtCycles = [2,1]; 1206 let NumMicroOps = 3; 1207} 1208 1209def SBWriteCMOVA_CMOVBErm : SchedWriteRes<[SBPort23,SBPort05,SBPort015]> { 1210 let Latency = 8; 1211 let ReleaseAtCycles = [1,2,1]; 1212 let NumMicroOps = 4; 1213} 1214 1215def SBCMOVA_CMOVBErr : SchedWriteVariant<[ 1216 SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [SBWriteCMOVA_CMOVBErr]>, 1217 SchedVar<NoSchedPred, [WriteCMOV]> 1218]>; 1219 1220def SBCMOVA_CMOVBErm : SchedWriteVariant<[ 1221 SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [SBWriteCMOVA_CMOVBErm]>, 1222 SchedVar<NoSchedPred, [WriteCMOV.Folded]> 1223]>; 1224 1225def : InstRW<[SBCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>; 1226def : InstRW<[SBCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>; 1227 1228// SETCCs that use both Z and C flag require an extra uop. 1229def SBWriteSETA_SETBEr : SchedWriteRes<[SBPort05]> { 1230 let Latency = 2; 1231 let ReleaseAtCycles = [2]; 1232 let NumMicroOps = 2; 1233} 1234 1235def SBWriteSETA_SETBEm : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 1236 let Latency = 3; 1237 let ReleaseAtCycles = [1,1,2]; 1238 let NumMicroOps = 4; 1239} 1240 1241def SBSETA_SETBErr : SchedWriteVariant<[ 1242 SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [SBWriteSETA_SETBEr]>, 1243 SchedVar<NoSchedPred, [WriteSETCC]> 1244]>; 1245 1246def SBSETA_SETBErm : SchedWriteVariant<[ 1247 SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [SBWriteSETA_SETBEm]>, 1248 SchedVar<NoSchedPred, [WriteSETCCStore]> 1249]>; 1250 1251def : InstRW<[SBSETA_SETBErr], (instrs SETCCr)>; 1252def : InstRW<[SBSETA_SETBErm], (instrs SETCCm)>; 1253 1254/////////////////////////////////////////////////////////////////////////////// 1255// Dependency breaking instructions. 1256/////////////////////////////////////////////////////////////////////////////// 1257 1258def : IsZeroIdiomFunction<[ 1259 // GPR Zero-idioms. 1260 DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>, 1261 1262 // SSE Zero-idioms. 1263 DepBreakingClass<[ 1264 // fp variants. 1265 XORPSrr, XORPDrr, 1266 1267 // int variants. 1268 PXORrr, 1269 PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr, 1270 PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr 1271 ], ZeroIdiomPredicate>, 1272 1273 // AVX Zero-idioms. 1274 DepBreakingClass<[ 1275 // xmm fp variants. 1276 VXORPSrr, VXORPDrr, 1277 1278 // xmm int variants. 1279 VPXORrr, 1280 VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr, 1281 VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr, 1282 ], ZeroIdiomPredicate>, 1283]>; 1284 1285} // SchedModel 1286