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 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, 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,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<WriteFSign, [SBPort5], 1>; 301defm : SBWriteResPair<WriteFRnd, [SBPort1], 3, [1], 1, 6>; 302defm : SBWriteResPair<WriteFRndY, [SBPort1], 3, [1], 1, 7>; 303defm : SBWriteResPair<WriteFRndZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 304defm : SBWriteResPair<WriteFLogic, [SBPort5], 1, [1], 1, 6>; 305defm : SBWriteResPair<WriteFLogicY, [SBPort5], 1, [1], 1, 7>; 306defm : SBWriteResPair<WriteFLogicZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 307defm : SBWriteResPair<WriteFTest, [SBPort0], 1, [1], 1, 6>; 308defm : SBWriteResPair<WriteFTestY, [SBPort0], 1, [1], 1, 7>; 309defm : SBWriteResPair<WriteFTestZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 310defm : SBWriteResPair<WriteFShuffle, [SBPort5], 1, [1], 1, 6>; 311defm : SBWriteResPair<WriteFShuffleY,[SBPort5], 1, [1], 1, 7>; 312defm : SBWriteResPair<WriteFShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 313defm : SBWriteResPair<WriteFVarShuffle, [SBPort5], 1, [1], 1, 6>; 314defm : SBWriteResPair<WriteFVarShuffleY,[SBPort5], 1, [1], 1, 7>; 315defm : SBWriteResPair<WriteFVarShuffleZ,[SBPort5], 1, [1], 1, 7>; // Unsupported = 1 316defm : SBWriteResPair<WriteFBlend, [SBPort05], 1, [1], 1, 6>; 317defm : SBWriteResPair<WriteFBlendY, [SBPort05], 1, [1], 1, 7>; 318defm : SBWriteResPair<WriteFBlendZ, [SBPort05], 1, [1], 1, 7>; // Unsupported = 1 319defm : SBWriteResPair<WriteFVarBlend, [SBPort05], 2, [2], 2, 6>; 320defm : SBWriteResPair<WriteFVarBlendY,[SBPort05], 2, [2], 2, 7>; 321defm : SBWriteResPair<WriteFVarBlendZ,[SBPort05], 2, [2], 2, 7>; // Unsupported = 1 322 323// Conversion between integer and float. 324defm : SBWriteResPair<WriteCvtSS2I, [SBPort0,SBPort1], 5, [1,1], 2>; 325defm : SBWriteResPair<WriteCvtPS2I, [SBPort1], 3, [1], 1, 6>; 326defm : SBWriteResPair<WriteCvtPS2IY, [SBPort1], 3, [1], 1, 7>; 327defm : SBWriteResPair<WriteCvtPS2IZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 328defm : SBWriteResPair<WriteCvtSD2I, [SBPort0,SBPort1], 5, [1,1], 2>; 329defm : SBWriteResPair<WriteCvtPD2I, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 330defm : X86WriteRes<WriteCvtPD2IY, [SBPort1,SBPort5], 4, [1,1], 2>; 331defm : X86WriteRes<WriteCvtPD2IZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 332defm : X86WriteRes<WriteCvtPD2IYLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; 333defm : X86WriteRes<WriteCvtPD2IZLd, [SBPort1,SBPort5,SBPort23], 11, [1,1,1], 3>; // Unsupported = 1 334 335defm : X86WriteRes<WriteCvtI2SS, [SBPort1,SBPort5], 5, [1,2], 3>; 336defm : X86WriteRes<WriteCvtI2SSLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 337defm : SBWriteResPair<WriteCvtI2PS, [SBPort1], 3, [1], 1, 6>; 338defm : SBWriteResPair<WriteCvtI2PSY, [SBPort1], 3, [1], 1, 7>; 339defm : SBWriteResPair<WriteCvtI2PSZ, [SBPort1], 3, [1], 1, 7>; // Unsupported = 1 340defm : X86WriteRes<WriteCvtI2SD, [SBPort1,SBPort5], 4, [1,1], 2>; 341defm : X86WriteRes<WriteCvtI2PD, [SBPort1,SBPort5], 4, [1,1], 2>; 342defm : X86WriteRes<WriteCvtI2PDY, [SBPort1,SBPort5], 4, [1,1], 2>; 343defm : X86WriteRes<WriteCvtI2PDZ, [SBPort1,SBPort5], 4, [1,1], 2>; // Unsupported = 1 344defm : X86WriteRes<WriteCvtI2SDLd, [SBPort1,SBPort23], 9, [1,1], 2>; 345defm : X86WriteRes<WriteCvtI2PDLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 346defm : X86WriteRes<WriteCvtI2PDYLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; 347defm : X86WriteRes<WriteCvtI2PDZLd, [SBPort1,SBPort5,SBPort23], 10, [1,1,1], 3>; // Unsupported = 1 348 349defm : SBWriteResPair<WriteCvtSS2SD, [SBPort0], 1, [1], 1, 6>; 350defm : X86WriteRes<WriteCvtPS2PD, [SBPort0,SBPort5], 2, [1,1], 2>; 351defm : X86WriteRes<WriteCvtPS2PDY, [SBPort0,SBPort5], 2, [1,1], 2>; 352defm : X86WriteRes<WriteCvtPS2PDZ, [SBPort0,SBPort5], 2, [1,1], 2>; // Unsupported = 1 353defm : X86WriteRes<WriteCvtPS2PDLd, [SBPort0,SBPort23], 7, [1,1], 2>; 354defm : X86WriteRes<WriteCvtPS2PDYLd, [SBPort0,SBPort23], 7, [1,1], 2>; 355defm : X86WriteRes<WriteCvtPS2PDZLd, [SBPort0,SBPort23], 7, [1,1], 2>; // Unsupported = 1 356defm : SBWriteResPair<WriteCvtSD2SS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 357defm : SBWriteResPair<WriteCvtPD2PS, [SBPort1,SBPort5], 4, [1,1], 2, 6>; 358defm : SBWriteResPair<WriteCvtPD2PSY, [SBPort1,SBPort5], 4, [1,1], 2, 7>; 359defm : SBWriteResPair<WriteCvtPD2PSZ, [SBPort1,SBPort5], 4, [1,1], 2, 7>; // Unsupported = 1 360 361defm : SBWriteResPair<WriteCvtPH2PS, [SBPort1], 3>; 362defm : SBWriteResPair<WriteCvtPH2PSY, [SBPort1], 3>; 363defm : SBWriteResPair<WriteCvtPH2PSZ, [SBPort1], 3>; // Unsupported = 1 364 365defm : X86WriteRes<WriteCvtPS2PH, [SBPort1], 3, [1], 1>; 366defm : X86WriteRes<WriteCvtPS2PHY, [SBPort1], 3, [1], 1>; 367defm : X86WriteRes<WriteCvtPS2PHZ, [SBPort1], 3, [1], 1>; // Unsupported = 1 368defm : X86WriteRes<WriteCvtPS2PHSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 369defm : X86WriteRes<WriteCvtPS2PHYSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; 370defm : X86WriteRes<WriteCvtPS2PHZSt, [SBPort1, SBPort23, SBPort4], 4, [1,1,1], 1>; // Unsupported = 1 371 372// Vector integer operations. 373defm : X86WriteRes<WriteVecLoad, [SBPort23], 5, [1], 1>; 374defm : X86WriteRes<WriteVecLoadX, [SBPort23], 6, [1], 1>; 375defm : X86WriteRes<WriteVecLoadY, [SBPort23], 7, [1], 1>; 376defm : X86WriteRes<WriteVecLoadNT, [SBPort23], 6, [1], 1>; 377defm : X86WriteRes<WriteVecLoadNTY, [SBPort23], 7, [1], 1>; 378defm : X86WriteRes<WriteVecMaskedLoad, [SBPort23,SBPort05], 8, [1,2], 3>; 379defm : X86WriteRes<WriteVecMaskedLoadY, [SBPort23,SBPort05], 9, [1,2], 3>; 380defm : X86WriteRes<WriteVecStore, [SBPort23,SBPort4], 1, [1,1], 1>; 381defm : X86WriteRes<WriteVecStoreX, [SBPort23,SBPort4], 1, [1,1], 1>; 382defm : X86WriteRes<WriteVecStoreY, [SBPort23,SBPort4], 1, [1,1], 1>; 383defm : X86WriteRes<WriteVecStoreNT, [SBPort23,SBPort4], 1, [1,1], 1>; 384defm : X86WriteRes<WriteVecStoreNTY, [SBPort23,SBPort4], 1, [1,1], 1>; 385defm : X86WriteRes<WriteVecMaskedStore32, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 386defm : X86WriteRes<WriteVecMaskedStore32Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 387defm : X86WriteRes<WriteVecMaskedStore64, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 388defm : X86WriteRes<WriteVecMaskedStore64Y, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>; 389defm : X86WriteRes<WriteVecMove, [SBPort05], 1, [1], 1>; 390defm : X86WriteRes<WriteVecMoveX, [SBPort015], 1, [1], 1>; 391defm : X86WriteRes<WriteVecMoveY, [SBPort05], 1, [1], 1>; 392defm : X86WriteRes<WriteVecMoveZ, [SBPort05], 1, [1], 1>; 393defm : X86WriteRes<WriteVecMoveToGpr, [SBPort0], 2, [1], 1>; 394defm : X86WriteRes<WriteVecMoveFromGpr, [SBPort5], 1, [1], 1>; 395 396defm : SBWriteResPair<WriteVecLogic, [SBPort015], 1, [1], 1, 5>; 397defm : SBWriteResPair<WriteVecLogicX,[SBPort015], 1, [1], 1, 6>; 398defm : SBWriteResPair<WriteVecLogicY,[SBPort015], 1, [1], 1, 7>; 399defm : SBWriteResPair<WriteVecLogicZ,[SBPort015], 1, [1], 1, 7>; // Unsupported = 1 400defm : SBWriteResPair<WriteVecTest, [SBPort0,SBPort5], 2, [1,1], 2, 6>; 401defm : SBWriteResPair<WriteVecTestY, [SBPort0,SBPort5], 2, [1,1], 2, 7>; 402defm : SBWriteResPair<WriteVecTestZ, [SBPort0,SBPort5], 2, [1,1], 2, 7>; // Unsupported = 1 403defm : SBWriteResPair<WriteVecALU, [SBPort1], 3, [1], 1, 5>; 404defm : SBWriteResPair<WriteVecALUX, [SBPort15], 1, [1], 1, 6>; 405defm : SBWriteResPair<WriteVecALUY, [SBPort15], 1, [1], 1, 7>; 406defm : SBWriteResPair<WriteVecALUZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 407defm : SBWriteResPair<WriteVecIMul, [SBPort0], 5, [1], 1, 5>; 408defm : SBWriteResPair<WriteVecIMulX, [SBPort0], 5, [1], 1, 6>; 409defm : SBWriteResPair<WriteVecIMulY, [SBPort0], 5, [1], 1, 7>; 410defm : SBWriteResPair<WriteVecIMulZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 411defm : SBWriteResPair<WritePMULLD, [SBPort0], 5, [1], 1, 6>; 412defm : SBWriteResPair<WritePMULLDY, [SBPort0], 5, [1], 1, 7>; // TODO this is probably wrong for 256/512-bit for the "generic" model 413defm : SBWriteResPair<WritePMULLDZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 414defm : SBWriteResPair<WriteShuffle, [SBPort5], 1, [1], 1, 5>; 415defm : SBWriteResPair<WriteShuffleX, [SBPort15], 1, [1], 1, 6>; 416defm : SBWriteResPair<WriteShuffleY, [SBPort5], 1, [1], 1, 7>; 417defm : SBWriteResPair<WriteShuffleZ, [SBPort5], 1, [1], 1, 7>; // Unsupported = 1 418defm : SBWriteResPair<WriteVarShuffle, [SBPort15], 1, [1], 1, 5>; 419defm : SBWriteResPair<WriteVarShuffleX, [SBPort15], 1, [1], 1, 6>; 420defm : SBWriteResPair<WriteVarShuffleY, [SBPort15], 1, [1], 1, 7>; 421defm : SBWriteResPair<WriteVarShuffleZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 422defm : SBWriteResPair<WriteBlend, [SBPort15], 1, [1], 1, 6>; 423defm : SBWriteResPair<WriteBlendY, [SBPort15], 1, [1], 1, 7>; 424defm : SBWriteResPair<WriteBlendZ, [SBPort15], 1, [1], 1, 7>; // Unsupported = 1 425defm : SBWriteResPair<WriteVarBlend, [SBPort15], 2, [2], 2, 6>; 426defm : SBWriteResPair<WriteVarBlendY,[SBPort15], 2, [2], 2, 7>; 427defm : SBWriteResPair<WriteVarBlendZ,[SBPort15], 2, [2], 2, 7>; // Unsupported = 1 428defm : SBWriteResPair<WriteMPSAD, [SBPort0, SBPort15], 7, [1,2], 3, 6>; 429defm : SBWriteResPair<WriteMPSADY, [SBPort0, SBPort15], 7, [1,2], 3, 7>; 430defm : SBWriteResPair<WriteMPSADZ, [SBPort0, SBPort15], 7, [1,2], 3, 7>; // Unsupported = 1 431defm : SBWriteResPair<WritePSADBW, [SBPort0], 5, [1], 1, 5>; 432defm : SBWriteResPair<WritePSADBWX, [SBPort0], 5, [1], 1, 6>; 433defm : SBWriteResPair<WritePSADBWY, [SBPort0], 5, [1], 1, 7>; 434defm : SBWriteResPair<WritePSADBWZ, [SBPort0], 5, [1], 1, 7>; // Unsupported = 1 435defm : SBWriteResPair<WritePHMINPOS, [SBPort0], 5, [1], 1, 6>; 436 437// Vector integer shifts. 438defm : SBWriteResPair<WriteVecShift, [SBPort5], 1, [1], 1, 5>; 439defm : SBWriteResPair<WriteVecShiftX, [SBPort0,SBPort15], 2, [1,1], 2, 6>; 440defm : SBWriteResPair<WriteVecShiftY, [SBPort0,SBPort15], 4, [1,1], 2, 7>; 441defm : SBWriteResPair<WriteVecShiftZ, [SBPort0,SBPort15], 4, [1,1], 2, 7>; // Unsupported = 1 442defm : SBWriteResPair<WriteVecShiftImm, [SBPort5], 1, [1], 1, 5>; 443defm : SBWriteResPair<WriteVecShiftImmX, [SBPort0], 1, [1], 1, 6>; 444defm : SBWriteResPair<WriteVecShiftImmY, [SBPort0], 1, [1], 1, 7>; 445defm : SBWriteResPair<WriteVecShiftImmZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 446defm : SBWriteResPair<WriteVarVecShift, [SBPort0], 1, [1], 1, 6>; 447defm : SBWriteResPair<WriteVarVecShiftY, [SBPort0], 1, [1], 1, 7>; 448defm : SBWriteResPair<WriteVarVecShiftZ, [SBPort0], 1, [1], 1, 7>; // Unsupported = 1 449 450// Vector insert/extract operations. 451def : WriteRes<WriteVecInsert, [SBPort5,SBPort15]> { 452 let Latency = 2; 453 let NumMicroOps = 2; 454} 455def : WriteRes<WriteVecInsertLd, [SBPort23,SBPort15]> { 456 let Latency = 7; 457 let NumMicroOps = 2; 458} 459 460def : WriteRes<WriteVecExtract, [SBPort0,SBPort15]> { 461 let Latency = 3; 462 let NumMicroOps = 2; 463} 464def : WriteRes<WriteVecExtractSt, [SBPort4,SBPort23,SBPort15]> { 465 let Latency = 5; 466 let NumMicroOps = 3; 467} 468 469//////////////////////////////////////////////////////////////////////////////// 470// Horizontal add/sub instructions. 471//////////////////////////////////////////////////////////////////////////////// 472 473defm : SBWriteResPair<WriteFHAdd, [SBPort1,SBPort5], 5, [1,2], 3, 6>; 474defm : SBWriteResPair<WriteFHAddY, [SBPort1,SBPort5], 5, [1,2], 3, 7>; 475defm : SBWriteResPair<WriteFHAddZ, [SBPort1,SBPort5], 5, [1,2], 3, 7>; // Unsupported = 1 476defm : SBWriteResPair<WritePHAdd, [SBPort15], 3, [3], 3, 5>; 477defm : SBWriteResPair<WritePHAddX, [SBPort15], 3, [3], 3, 6>; 478defm : SBWriteResPair<WritePHAddY, [SBPort15], 3, [3], 3, 7>; 479defm : SBWriteResPair<WritePHAddZ, [SBPort15], 3, [3], 3, 7>; // Unsupported = 1 480 481//////////////////////////////////////////////////////////////////////////////// 482// String instructions. 483//////////////////////////////////////////////////////////////////////////////// 484 485// Packed Compare Implicit Length Strings, Return Mask 486def : WriteRes<WritePCmpIStrM, [SBPort0]> { 487 let Latency = 11; 488 let NumMicroOps = 3; 489 let ResourceCycles = [3]; 490} 491def : WriteRes<WritePCmpIStrMLd, [SBPort0, SBPort23]> { 492 let Latency = 17; 493 let NumMicroOps = 4; 494 let ResourceCycles = [3,1]; 495} 496 497// Packed Compare Explicit Length Strings, Return Mask 498def : WriteRes<WritePCmpEStrM, [SBPort015]> { 499 let Latency = 11; 500 let ResourceCycles = [8]; 501} 502def : WriteRes<WritePCmpEStrMLd, [SBPort015, SBPort23]> { 503 let Latency = 17; 504 let ResourceCycles = [7, 1]; 505} 506 507// Packed Compare Implicit Length Strings, Return Index 508def : WriteRes<WritePCmpIStrI, [SBPort0]> { 509 let Latency = 11; 510 let NumMicroOps = 3; 511 let ResourceCycles = [3]; 512} 513def : WriteRes<WritePCmpIStrILd, [SBPort0,SBPort23]> { 514 let Latency = 17; 515 let NumMicroOps = 4; 516 let ResourceCycles = [3,1]; 517} 518 519// Packed Compare Explicit Length Strings, Return Index 520def : WriteRes<WritePCmpEStrI, [SBPort015]> { 521 let Latency = 4; 522 let ResourceCycles = [8]; 523} 524def : WriteRes<WritePCmpEStrILd, [SBPort015, SBPort23]> { 525 let Latency = 10; 526 let ResourceCycles = [7, 1]; 527} 528 529// MOVMSK Instructions. 530def : WriteRes<WriteFMOVMSK, [SBPort0]> { let Latency = 2; } 531def : WriteRes<WriteVecMOVMSK, [SBPort0]> { let Latency = 2; } 532def : WriteRes<WriteVecMOVMSKY, [SBPort0]> { let Latency = 2; } 533def : WriteRes<WriteMMXMOVMSK, [SBPort0]> { let Latency = 1; } 534 535// AES Instructions. 536def : WriteRes<WriteAESDecEnc, [SBPort5,SBPort015]> { 537 let Latency = 7; 538 let NumMicroOps = 2; 539 let ResourceCycles = [1,1]; 540} 541def : WriteRes<WriteAESDecEncLd, [SBPort5,SBPort23,SBPort015]> { 542 let Latency = 13; 543 let NumMicroOps = 3; 544 let ResourceCycles = [1,1,1]; 545} 546 547def : WriteRes<WriteAESIMC, [SBPort5]> { 548 let Latency = 12; 549 let NumMicroOps = 2; 550 let ResourceCycles = [2]; 551} 552def : WriteRes<WriteAESIMCLd, [SBPort5,SBPort23]> { 553 let Latency = 18; 554 let NumMicroOps = 3; 555 let ResourceCycles = [2,1]; 556} 557 558def : WriteRes<WriteAESKeyGen, [SBPort015]> { 559 let Latency = 8; 560 let ResourceCycles = [11]; 561} 562def : WriteRes<WriteAESKeyGenLd, [SBPort015, SBPort23]> { 563 let Latency = 14; 564 let ResourceCycles = [10, 1]; 565} 566 567// Carry-less multiplication instructions. 568def : WriteRes<WriteCLMul, [SBPort015]> { 569 let Latency = 14; 570 let ResourceCycles = [18]; 571} 572def : WriteRes<WriteCLMulLd, [SBPort015, SBPort23]> { 573 let Latency = 20; 574 let ResourceCycles = [17, 1]; 575} 576 577// Load/store MXCSR. 578// FIXME: This is probably wrong. Only STMXCSR should require Port4. 579def : WriteRes<WriteLDMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ResourceCycles = [1,1,1,1]; } 580def : WriteRes<WriteSTMXCSR, [SBPort0,SBPort4,SBPort5,SBPort23]> { let Latency = 5; let NumMicroOps = 4; let ResourceCycles = [1,1,1,1]; } 581 582def : WriteRes<WriteSystem, [SBPort015]> { let Latency = 100; } 583def : WriteRes<WriteMicrocoded, [SBPort015]> { let Latency = 100; } 584def : WriteRes<WriteFence, [SBPort23, SBPort4]>; 585def : WriteRes<WriteNop, []>; 586 587// AVX2/FMA is not supported on that architecture, but we should define the basic 588// scheduling resources anyway. 589defm : SBWriteResPair<WriteFShuffle256, [SBPort5], 1, [1], 1, 7>; 590defm : SBWriteResPair<WriteFVarShuffle256, [SBPort5], 1, [1], 1, 7>; 591defm : SBWriteResPair<WriteShuffle256, [SBPort5], 1, [1], 1, 7>; 592defm : SBWriteResPair<WriteVPMOV256, [SBPort5], 1, [1], 1, 7>; 593defm : SBWriteResPair<WriteVarShuffle256, [SBPort5], 1, [1], 1, 7>; 594defm : SBWriteResPair<WriteFMA, [SBPort01], 5>; 595defm : SBWriteResPair<WriteFMAX, [SBPort01], 5>; 596defm : SBWriteResPair<WriteFMAY, [SBPort01], 5>; 597defm : SBWriteResPair<WriteFMAZ, [SBPort01], 5>; // Unsupported = 1 598 599// Remaining SNB instrs. 600 601def SBWriteResGroup1 : SchedWriteRes<[SBPort1]> { 602 let Latency = 1; 603 let NumMicroOps = 1; 604 let ResourceCycles = [1]; 605} 606def: InstRW<[SBWriteResGroup1], (instrs COMP_FST0r, 607 COM_FST0r, 608 UCOM_FPr, 609 UCOM_Fr)>; 610 611def SBWriteResGroup2 : SchedWriteRes<[SBPort5]> { 612 let Latency = 1; 613 let NumMicroOps = 1; 614 let ResourceCycles = [1]; 615} 616def: InstRW<[SBWriteResGroup2], (instrs FDECSTP, FINCSTP, FFREE, FFREEP, FNOP, 617 LD_Frr, ST_Frr, ST_FPrr)>; 618def: InstRW<[SBWriteResGroup2], (instrs RET64)>; 619 620def SBWriteResGroup4 : SchedWriteRes<[SBPort05]> { 621 let Latency = 1; 622 let NumMicroOps = 1; 623 let ResourceCycles = [1]; 624} 625def: InstRW<[SBWriteResGroup4], (instrs CDQ, CQO)>; 626 627def SBWriteResGroup5 : SchedWriteRes<[SBPort15]> { 628 let Latency = 1; 629 let NumMicroOps = 1; 630 let ResourceCycles = [1]; 631} 632def: InstRW<[SBWriteResGroup5], (instrs MMX_PABSBrr, 633 MMX_PABSDrr, 634 MMX_PABSWrr, 635 MMX_PADDQrr, 636 MMX_PALIGNRrri, 637 MMX_PSIGNBrr, 638 MMX_PSIGNDrr, 639 MMX_PSIGNWrr)>; 640 641def SBWriteResGroup11 : SchedWriteRes<[SBPort015]> { 642 let Latency = 2; 643 let NumMicroOps = 2; 644 let ResourceCycles = [2]; 645} 646def: InstRW<[SBWriteResGroup11], (instrs SCASB, 647 SCASL, 648 SCASQ, 649 SCASW)>; 650 651def SBWriteResGroup12 : SchedWriteRes<[SBPort0,SBPort1]> { 652 let Latency = 2; 653 let NumMicroOps = 2; 654 let ResourceCycles = [1,1]; 655} 656def: InstRW<[SBWriteResGroup12], (instregex "(V?)(U?)COMI(SD|SS)rr")>; 657 658def SBWriteResGroup15 : SchedWriteRes<[SBPort0,SBPort015]> { 659 let Latency = 2; 660 let NumMicroOps = 2; 661 let ResourceCycles = [1,1]; 662} 663def: InstRW<[SBWriteResGroup15], (instrs CWD, 664 FNSTSW16r)>; 665 666def SBWriteResGroup18 : SchedWriteRes<[SBPort5,SBPort015]> { 667 let Latency = 2; 668 let NumMicroOps = 2; 669 let ResourceCycles = [1,1]; 670} 671def: InstRW<[SBWriteResGroup18], (instrs JCXZ, JECXZ, JRCXZ, 672 MMX_MOVDQ2Qrr)>; 673 674def SBWriteResGroup21 : SchedWriteRes<[SBPort1]> { 675 let Latency = 3; 676 let NumMicroOps = 1; 677 let ResourceCycles = [1]; 678} 679def: InstRW<[SBWriteResGroup21], (instrs PUSHFS64)>; 680 681def SBWriteResGroup22 : SchedWriteRes<[SBPort0,SBPort5]> { 682 let Latency = 3; 683 let NumMicroOps = 2; 684 let ResourceCycles = [1,1]; 685} 686def: InstRW<[SBWriteResGroup22], (instregex "(V?)EXTRACTPSrr")>; 687 688def SBWriteResGroup23 : SchedWriteRes<[SBPort05,SBPort015]> { 689 let Latency = 2; 690 let NumMicroOps = 3; 691 let ResourceCycles = [2,1]; 692} 693def: InstRW<[SBWriteResGroup23], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1, 694 RCR8r1, RCR16r1, RCR32r1, RCR64r1)>; 695 696def SBWriteResGroup24 : SchedWriteRes<[SBPort1,SBPort5,SBPort05,SBPort015]> { 697 let Latency = 3; 698 let NumMicroOps = 8; 699 let ResourceCycles = [1,1,4,2]; 700} 701def: InstRW<[SBWriteResGroup24], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>; 702 703def SBWriteResGroup24b : SchedWriteRes<[SBPort1,SBPort5,SBPort05,SBPort015]> { 704 let Latency = 4; 705 let NumMicroOps = 8; 706 let ResourceCycles = [1,1,4,2]; 707} 708def: InstRW<[SBWriteResGroup24b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>; 709 710def SBWriteResGroup25_1 : SchedWriteRes<[SBPort23,SBPort015]> { 711 let Latency = 7; 712 let NumMicroOps = 3; 713 let ResourceCycles = [1,2]; 714} 715def: InstRW<[SBWriteResGroup25_1], (instrs LEAVE, LEAVE64)>; 716 717def SBWriteResGroup26_2 : SchedWriteRes<[SBPort0,SBPort1,SBPort5]> { 718 let Latency = 3; 719 let NumMicroOps = 3; 720 let ResourceCycles = [1,1,1]; 721} 722def: InstRW<[SBWriteResGroup26_2], (instrs COM_FIPr, COM_FIr, UCOM_FIPr, UCOM_FIr)>; 723 724def SBWriteResGroup29 : SchedWriteRes<[SBPort1,SBPort015]> { 725 let Latency = 4; 726 let NumMicroOps = 2; 727 let ResourceCycles = [1,1]; 728} 729def: InstRW<[SBWriteResGroup29], (instrs MOV64sr)>; 730 731def SBWriteResGroup29_2 : SchedWriteRes<[SBPort5,SBPort015]> { 732 let Latency = 4; 733 let NumMicroOps = 4; 734 let ResourceCycles = [1,3]; 735} 736def: InstRW<[SBWriteResGroup29_2], (instrs PAUSE)>; 737 738def SBWriteResGroup30 : SchedWriteRes<[SBPort1,SBPort5,SBPort015]> { 739 let Latency = 3; 740 let NumMicroOps = 8; 741 let ResourceCycles = [1,3,4]; 742} 743def: InstRW<[SBWriteResGroup30], (instrs LOOP)>; 744 745def SBWriteResGroup31 : SchedWriteRes<[SBPort1,SBPort5,SBPort015,SBPort05]> { 746 let Latency = 4; 747 let NumMicroOps = 12; 748 let ResourceCycles = [1,3,6,2]; 749} 750def: InstRW<[SBWriteResGroup31], (instrs LOOPE, LOOPNE)>; 751 752def SBWriteResGroup76 : SchedWriteRes<[SBPort05]> { 753 let Latency = 5; 754 let NumMicroOps = 8; 755 let ResourceCycles = [8]; 756} 757def: InstRW<[SBWriteResGroup76], (instregex "RCL(8|16|32|64)rCL", 758 "RCR(8|16|32|64)rCL")>; 759 760def SBWriteResGroup33 : SchedWriteRes<[SBPort4,SBPort23]> { 761 let Latency = 5; 762 let NumMicroOps = 2; 763 let ResourceCycles = [1,1]; 764} 765def: InstRW<[SBWriteResGroup33], (instregex "PUSH(16r|32r|64r|64i8)")>; 766 767def SBWriteResGroup35 : SchedWriteRes<[SBPort1,SBPort5]> { 768 let Latency = 5; 769 let NumMicroOps = 3; 770 let ResourceCycles = [1,2]; 771} 772def: InstRW<[SBWriteResGroup35], (instrs CLI)>; 773 774def SBWriteResGroup35_2 : SchedWriteRes<[SBPort1,SBPort4,SBPort23]> { 775 let Latency = 5; 776 let NumMicroOps = 3; 777 let ResourceCycles = [1,1,1]; 778} 779def: InstRW<[SBWriteResGroup35_2], (instrs PUSHGS64)>; 780def: InstRW<[SBWriteResGroup35_2], (instregex "ISTT_FP(16|32|64)m")>; 781 782def SBWriteResGroup36 : SchedWriteRes<[SBPort4,SBPort5,SBPort23]> { 783 let Latency = 5; 784 let NumMicroOps = 3; 785 let ResourceCycles = [1,1,1]; 786} 787def: InstRW<[SBWriteResGroup36], (instrs CALL64pcrel32)>; 788def: InstRW<[SBWriteResGroup36], (instregex "CALL(16|32|64)r", 789 "(V?)EXTRACTPSmr")>; 790 791def SBWriteResGroup40 : SchedWriteRes<[SBPort4,SBPort23,SBPort015]> { 792 let Latency = 5; 793 let NumMicroOps = 3; 794 let ResourceCycles = [1,1,1]; 795} 796def: InstRW<[SBWriteResGroup40], (instrs STOSB, STOSL, STOSQ, STOSW)>; 797 798def SBWriteResGroup41 : SchedWriteRes<[SBPort5,SBPort015]> { 799 let Latency = 5; 800 let NumMicroOps = 4; 801 let ResourceCycles = [1,3]; 802} 803def: InstRW<[SBWriteResGroup41], (instrs FNINIT)>; 804 805def SBWriteResGroup45 : SchedWriteRes<[SBPort0,SBPort4,SBPort23,SBPort15]> { 806 let Latency = 5; 807 let NumMicroOps = 4; 808 let ResourceCycles = [1,1,1,1]; 809} 810def: InstRW<[SBWriteResGroup45], (instregex "(V?)PEXTR(D|Q)mr", 811 "PUSHF(16|64)")>; 812 813def SBWriteResGroup46 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 814 let Latency = 5; 815 let NumMicroOps = 4; 816 let ResourceCycles = [1,1,1,1]; 817} 818def: InstRW<[SBWriteResGroup46], (instregex "CLFLUSH")>; 819 820def SBWriteResGroup47 : SchedWriteRes<[SBPort4,SBPort5,SBPort01,SBPort23]> { 821 let Latency = 5; 822 let NumMicroOps = 5; 823 let ResourceCycles = [1,2,1,1]; 824} 825def: InstRW<[SBWriteResGroup47], (instregex "FXRSTOR")>; 826 827def SBWriteResGroup48 : SchedWriteRes<[SBPort23]> { 828 let Latency = 6; 829 let NumMicroOps = 1; 830 let ResourceCycles = [1]; 831} 832def: InstRW<[SBWriteResGroup48], (instrs VBROADCASTSSrm)>; 833def: InstRW<[SBWriteResGroup48], (instregex "POP(16|32|64)r", 834 "(V?)MOV64toPQIrm", 835 "(V?)MOVDDUPrm", 836 "(V?)MOVDI2PDIrm", 837 "(V?)MOVQI2PQIrm", 838 "(V?)MOVSDrm", 839 "(V?)MOVSHDUPrm", 840 "(V?)MOVSLDUPrm", 841 "(V?)MOVSSrm")>; 842 843def SBWriteResGroup49 : SchedWriteRes<[SBPort5,SBPort23]> { 844 let Latency = 6; 845 let NumMicroOps = 2; 846 let ResourceCycles = [1,1]; 847} 848def: InstRW<[SBWriteResGroup49], (instrs MOV16sm)>; 849 850def SBWriteResGroup51 : SchedWriteRes<[SBPort23,SBPort15]> { 851 let Latency = 6; 852 let NumMicroOps = 2; 853 let ResourceCycles = [1,1]; 854} 855def: InstRW<[SBWriteResGroup51], (instrs MMX_PABSBrm, 856 MMX_PABSDrm, 857 MMX_PABSWrm, 858 MMX_PALIGNRrmi, 859 MMX_PSIGNBrm, 860 MMX_PSIGNDrm, 861 MMX_PSIGNWrm)>; 862 863def SBWriteResGroup52 : SchedWriteRes<[SBPort23,SBPort015]> { 864 let Latency = 6; 865 let NumMicroOps = 2; 866 let ResourceCycles = [1,1]; 867} 868def: InstRW<[SBWriteResGroup52], (instrs LODSL, LODSQ)>; 869 870def SBWriteResGroup53 : SchedWriteRes<[SBPort4,SBPort23]> { 871 let Latency = 6; 872 let NumMicroOps = 3; 873 let ResourceCycles = [1,2]; 874} 875def: InstRW<[SBWriteResGroup53], (instregex "ST_F(32|64)m", 876 "ST_FP(32|64|80)m")>; 877 878def SBWriteResGroup54 : SchedWriteRes<[SBPort23]> { 879 let Latency = 7; 880 let NumMicroOps = 1; 881 let ResourceCycles = [1]; 882} 883def: InstRW<[SBWriteResGroup54], (instrs VBROADCASTSDYrm, 884 VBROADCASTSSYrm, 885 VMOVDDUPYrm, 886 VMOVSHDUPYrm, 887 VMOVSLDUPYrm)>; 888 889def SBWriteResGroup58 : SchedWriteRes<[SBPort23,SBPort05]> { 890 let Latency = 7; 891 let NumMicroOps = 2; 892 let ResourceCycles = [1,1]; 893} 894def: InstRW<[SBWriteResGroup58], (instrs VINSERTF128rm)>; 895 896def SBWriteResGroup59 : SchedWriteRes<[SBPort23,SBPort15]> { 897 let Latency = 7; 898 let NumMicroOps = 2; 899 let ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [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 ResourceCycles = [2]; 1127} 1128def: InstRW<[SBWriteResGroupVzeroall], (instrs VZEROALL)>; 1129 1130def SBWriteResGroupVzeroupper : SchedWriteRes<[]> { 1131 let Latency = 1; 1132 let NumMicroOps = 4; 1133 let ResourceCycles = []; 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 ResourceCycles = [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 ResourceCycles = [2,1]; 1206 let NumMicroOps = 3; 1207} 1208 1209def SBWriteCMOVA_CMOVBErm : SchedWriteRes<[SBPort23,SBPort05,SBPort015]> { 1210 let Latency = 8; 1211 let ResourceCycles = [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 ResourceCycles = [2]; 1232 let NumMicroOps = 2; 1233} 1234 1235def SBWriteSETA_SETBEm : SchedWriteRes<[SBPort4,SBPort23,SBPort05]> { 1236 let Latency = 3; 1237 let ResourceCycles = [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