1//=- X86SchedHaswell.td - X86 Haswell 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 Haswell to support instruction 10// scheduling and other instruction cost heuristics. 11// 12// Note that we define some instructions here that are not supported by haswell, 13// but we still have to define them because KNL uses the HSW model. 14// They are currently tagged with a comment `Unsupported = 1`. 15// FIXME: Use Unsupported = 1 once KNL has its own model. 16// 17//===----------------------------------------------------------------------===// 18 19def HaswellModel : SchedMachineModel { 20 // All x86 instructions are modeled as a single micro-op, and HW can decode 4 21 // instructions per cycle. 22 let IssueWidth = 4; 23 let MicroOpBufferSize = 192; // Based on the reorder buffer. 24 let LoadLatency = 5; 25 let MispredictPenalty = 16; 26 27 // Based on the LSD (loop-stream detector) queue size and benchmarking data. 28 let LoopMicroOpBufferSize = 50; 29 30 // This flag is set to allow the scheduler to assign a default model to 31 // unrecognized opcodes. 32 let CompleteModel = 0; 33} 34 35let SchedModel = HaswellModel in { 36 37// Haswell can issue micro-ops to 8 different ports in one cycle. 38 39// Ports 0, 1, 5, and 6 handle all computation. 40// Port 4 gets the data half of stores. Store data can be available later than 41// the store address, but since we don't model the latency of stores, we can 42// ignore that. 43// Ports 2 and 3 are identical. They handle loads and the address half of 44// stores. Port 7 can handle address calculations. 45def HWPort0 : ProcResource<1>; 46def HWPort1 : ProcResource<1>; 47def HWPort2 : ProcResource<1>; 48def HWPort3 : ProcResource<1>; 49def HWPort4 : ProcResource<1>; 50def HWPort5 : ProcResource<1>; 51def HWPort6 : ProcResource<1>; 52def HWPort7 : ProcResource<1>; 53 54// Many micro-ops are capable of issuing on multiple ports. 55def HWPort01 : ProcResGroup<[HWPort0, HWPort1]>; 56def HWPort23 : ProcResGroup<[HWPort2, HWPort3]>; 57def HWPort237 : ProcResGroup<[HWPort2, HWPort3, HWPort7]>; 58def HWPort04 : ProcResGroup<[HWPort0, HWPort4]>; 59def HWPort05 : ProcResGroup<[HWPort0, HWPort5]>; 60def HWPort06 : ProcResGroup<[HWPort0, HWPort6]>; 61def HWPort15 : ProcResGroup<[HWPort1, HWPort5]>; 62def HWPort16 : ProcResGroup<[HWPort1, HWPort6]>; 63def HWPort56 : ProcResGroup<[HWPort5, HWPort6]>; 64def HWPort015 : ProcResGroup<[HWPort0, HWPort1, HWPort5]>; 65def HWPort056 : ProcResGroup<[HWPort0, HWPort5, HWPort6]>; 66def HWPort0156: ProcResGroup<[HWPort0, HWPort1, HWPort5, HWPort6]>; 67 68// 60 Entry Unified Scheduler 69def HWPortAny : ProcResGroup<[HWPort0, HWPort1, HWPort2, HWPort3, HWPort4, 70 HWPort5, HWPort6, HWPort7]> { 71 let BufferSize=60; 72} 73 74// Integer division issued on port 0. 75def HWDivider : ProcResource<1>; 76// FP division and sqrt on port 0. 77def HWFPDivider : ProcResource<1>; 78 79// Integer loads are 5 cycles, so ReadAfterLd registers needn't be available until 5 80// cycles after the memory operand. 81def : ReadAdvance<ReadAfterLd, 5>; 82 83// Vector loads are 5/6/7 cycles, so ReadAfterVec*Ld registers needn't be available 84// until 5/6/7 cycles after the memory operand. 85def : ReadAdvance<ReadAfterVecLd, 5>; 86def : ReadAdvance<ReadAfterVecXLd, 6>; 87def : ReadAdvance<ReadAfterVecYLd, 7>; 88 89def : ReadAdvance<ReadInt2Fpu, 0>; 90 91// Many SchedWrites are defined in pairs with and without a folded load. 92// Instructions with folded loads are usually micro-fused, so they only appear 93// as two micro-ops when queued in the reservation station. 94// This multiclass defines the resource usage for variants with and without 95// folded loads. 96multiclass HWWriteResPair<X86FoldableSchedWrite SchedRW, 97 list<ProcResourceKind> ExePorts, 98 int Lat, list<int> Res = [1], int UOps = 1, 99 int LoadLat = 5> { 100 // Register variant is using a single cycle on ExePort. 101 def : WriteRes<SchedRW, ExePorts> { 102 let Latency = Lat; 103 let ResourceCycles = Res; 104 let NumMicroOps = UOps; 105 } 106 107 // Memory variant also uses a cycle on port 2/3 and adds LoadLat cycles to 108 // the latency (default = 5). 109 def : WriteRes<SchedRW.Folded, !listconcat([HWPort23], ExePorts)> { 110 let Latency = !add(Lat, LoadLat); 111 let ResourceCycles = !listconcat([1], Res); 112 let NumMicroOps = !add(UOps, 1); 113 } 114} 115 116// A folded store needs a cycle on port 4 for the store data, and an extra port 117// 2/3/7 cycle to recompute the address. 118def : WriteRes<WriteRMW, [HWPort237,HWPort4]>; 119 120// Loads, stores, and moves, not folded with other operations. 121// Store_addr on 237. 122// Store_data on 4. 123defm : X86WriteRes<WriteStore, [HWPort237, HWPort4], 1, [1,1], 1>; 124defm : X86WriteRes<WriteStoreNT, [HWPort237, HWPort4], 1, [1,1], 2>; 125defm : X86WriteRes<WriteLoad, [HWPort23], 5, [1], 1>; 126defm : X86WriteRes<WriteMove, [HWPort0156], 1, [1], 1>; 127 128// Idioms that clear a register, like xorps %xmm0, %xmm0. 129// These can often bypass execution ports completely. 130def : WriteRes<WriteZero, []>; 131 132// Model the effect of clobbering the read-write mask operand of the GATHER operation. 133// Does not cost anything by itself, only has latency, matching that of the WriteLoad, 134defm : X86WriteRes<WriteVecMaskedGatherWriteback, [], 5, [], 0>; 135 136// Arithmetic. 137defm : HWWriteResPair<WriteALU, [HWPort0156], 1>; 138defm : HWWriteResPair<WriteADC, [HWPort06, HWPort0156], 2, [1,1], 2>; 139 140// Integer multiplication. 141defm : HWWriteResPair<WriteIMul8, [HWPort1], 3>; 142defm : HWWriteResPair<WriteIMul16, [HWPort1,HWPort06,HWPort0156], 4, [1,1,2], 4>; 143defm : X86WriteRes<WriteIMul16Imm, [HWPort1,HWPort0156], 4, [1,1], 2>; 144defm : X86WriteRes<WriteIMul16ImmLd, [HWPort1,HWPort0156,HWPort23], 8, [1,1,1], 3>; 145defm : HWWriteResPair<WriteIMul16Reg, [HWPort1], 3>; 146defm : HWWriteResPair<WriteIMul32, [HWPort1,HWPort06,HWPort0156], 4, [1,1,1], 3>; 147defm : HWWriteResPair<WriteMULX32, [HWPort1,HWPort06,HWPort0156], 3, [1,1,1], 3>; 148defm : HWWriteResPair<WriteIMul32Imm, [HWPort1], 3>; 149defm : HWWriteResPair<WriteIMul32Reg, [HWPort1], 3>; 150defm : HWWriteResPair<WriteIMul64, [HWPort1,HWPort6], 4, [1,1], 2>; 151defm : HWWriteResPair<WriteMULX64, [HWPort1,HWPort6], 3, [1,1], 2>; 152defm : HWWriteResPair<WriteIMul64Imm, [HWPort1], 3>; 153defm : HWWriteResPair<WriteIMul64Reg, [HWPort1], 3>; 154def HWWriteIMulH : WriteRes<WriteIMulH, []> { let Latency = 4; } 155def : WriteRes<WriteIMulHLd, []> { 156 let Latency = !add(HWWriteIMulH.Latency, HaswellModel.LoadLatency); 157} 158 159defm : X86WriteRes<WriteBSWAP32, [HWPort15], 1, [1], 1>; 160defm : X86WriteRes<WriteBSWAP64, [HWPort06, HWPort15], 2, [1,1], 2>; 161defm : X86WriteRes<WriteCMPXCHG,[HWPort06, HWPort0156], 5, [2,3], 5>; 162defm : X86WriteRes<WriteCMPXCHGRMW,[HWPort23,HWPort06,HWPort0156,HWPort237,HWPort4], 9, [1,2,1,1,1], 6>; 163defm : X86WriteRes<WriteXCHG, [HWPort0156], 2, [3], 3>; 164 165// Integer shifts and rotates. 166defm : HWWriteResPair<WriteShift, [HWPort06], 1>; 167defm : HWWriteResPair<WriteShiftCL, [HWPort06, HWPort0156], 3, [2,1], 3>; 168defm : HWWriteResPair<WriteRotate, [HWPort06], 1, [1], 1>; 169defm : HWWriteResPair<WriteRotateCL, [HWPort06, HWPort0156], 3, [2,1], 3>; 170 171// SHLD/SHRD. 172defm : X86WriteRes<WriteSHDrri, [HWPort1], 3, [1], 1>; 173defm : X86WriteRes<WriteSHDrrcl,[HWPort1, HWPort06, HWPort0156], 6, [1, 1, 2], 4>; 174defm : X86WriteRes<WriteSHDmri, [HWPort1, HWPort23, HWPort237, HWPort0156], 10, [1, 1, 1, 1], 4>; 175defm : X86WriteRes<WriteSHDmrcl,[HWPort1, HWPort23, HWPort237, HWPort06, HWPort0156], 12, [1, 1, 1, 1, 2], 6>; 176 177// Branches don't produce values, so they have no latency, but they still 178// consume resources. Indirect branches can fold loads. 179defm : HWWriteResPair<WriteJump, [HWPort06], 1>; 180 181defm : HWWriteResPair<WriteCRC32, [HWPort1], 3>; 182 183defm : HWWriteResPair<WriteCMOV, [HWPort06,HWPort0156], 2, [1,1], 2>; // Conditional move. 184defm : X86WriteRes<WriteFCMOV, [HWPort1], 3, [1], 1>; // x87 conditional move. 185 186def : WriteRes<WriteSETCC, [HWPort06]>; // Setcc. 187def : WriteRes<WriteSETCCStore, [HWPort06,HWPort4,HWPort237]> { 188 let Latency = 2; 189 let NumMicroOps = 3; 190} 191 192defm : X86WriteRes<WriteLAHFSAHF, [HWPort06], 1, [1], 1>; 193defm : X86WriteRes<WriteBitTest, [HWPort06], 1, [1], 1>; 194defm : X86WriteRes<WriteBitTestImmLd, [HWPort06,HWPort23], 6, [1,1], 2>; 195defm : X86WriteRes<WriteBitTestRegLd, [], 1, [], 10>; 196defm : X86WriteRes<WriteBitTestSet, [HWPort06], 1, [1], 1>; 197defm : X86WriteRes<WriteBitTestSetImmLd, [HWPort06,HWPort23], 6, [1,1], 3>; 198//defm : X86WriteRes<WriteBitTestSetRegLd, [], 1, [], 11>; 199 200// This is for simple LEAs with one or two input operands. 201// The complex ones can only execute on port 1, and they require two cycles on 202// the port to read all inputs. We don't model that. 203def : WriteRes<WriteLEA, [HWPort15]>; 204 205// Bit counts. 206defm : HWWriteResPair<WriteBSF, [HWPort1], 3>; 207defm : HWWriteResPair<WriteBSR, [HWPort1], 3>; 208defm : HWWriteResPair<WriteLZCNT, [HWPort1], 3>; 209defm : HWWriteResPair<WriteTZCNT, [HWPort1], 3>; 210defm : HWWriteResPair<WritePOPCNT, [HWPort1], 3>; 211 212// BMI1 BEXTR/BLS, BMI2 BZHI 213defm : HWWriteResPair<WriteBEXTR, [HWPort06,HWPort15], 2, [1,1], 2>; 214defm : HWWriteResPair<WriteBLS, [HWPort15], 1>; 215defm : HWWriteResPair<WriteBZHI, [HWPort15], 1>; 216 217// TODO: Why isn't the HWDivider used? 218defm : X86WriteRes<WriteDiv8, [HWPort0,HWPort1,HWPort5,HWPort6], 22, [], 9>; 219defm : X86WriteRes<WriteDiv16, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>; 220defm : X86WriteRes<WriteDiv32, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>; 221defm : X86WriteRes<WriteDiv64, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156], 98, [7,7,3,3,1,11], 32>; 222defm : X86WriteRes<WriteDiv8Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 223defm : X86WriteRes<WriteDiv16Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 224defm : X86WriteRes<WriteDiv32Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 225defm : X86WriteRes<WriteDiv64Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 226 227defm : X86WriteRes<WriteIDiv8, [HWPort0,HWPort1,HWPort5,HWPort6], 23, [], 9>; 228defm : X86WriteRes<WriteIDiv16, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>; 229defm : X86WriteRes<WriteIDiv32, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>; 230defm : X86WriteRes<WriteIDiv64, [HWPort0,HWPort1,HWPort5,HWPort6,HWPort06,HWPort0156], 112, [4,2,4,8,14,34], 66>; 231defm : X86WriteRes<WriteIDiv8Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 232defm : X86WriteRes<WriteIDiv16Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 233defm : X86WriteRes<WriteIDiv32Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 234defm : X86WriteRes<WriteIDiv64Ld, [HWPort0,HWPort23,HWDivider], 29, [1,1,10], 2>; 235 236// Floating point. This covers both scalar and vector operations. 237defm : X86WriteRes<WriteFLD0, [HWPort01], 1, [1], 1>; 238defm : X86WriteRes<WriteFLD1, [HWPort01], 1, [2], 2>; 239defm : X86WriteRes<WriteFLDC, [HWPort01], 1, [2], 2>; 240defm : X86WriteRes<WriteFLoad, [HWPort23], 5, [1], 1>; 241defm : X86WriteRes<WriteFLoadX, [HWPort23], 6, [1], 1>; 242defm : X86WriteRes<WriteFLoadY, [HWPort23], 7, [1], 1>; 243defm : X86WriteRes<WriteFMaskedLoad, [HWPort23,HWPort5], 8, [1,2], 3>; 244defm : X86WriteRes<WriteFMaskedLoadY, [HWPort23,HWPort5], 9, [1,2], 3>; 245defm : X86WriteRes<WriteFStore, [HWPort237,HWPort4], 1, [1,1], 2>; 246defm : X86WriteRes<WriteFStoreX, [HWPort237,HWPort4], 1, [1,1], 2>; 247defm : X86WriteRes<WriteFStoreY, [HWPort237,HWPort4], 1, [1,1], 2>; 248defm : X86WriteRes<WriteFStoreNT, [HWPort237,HWPort4], 1, [1,1], 2>; 249defm : X86WriteRes<WriteFStoreNTX, [HWPort237,HWPort4], 1, [1,1], 2>; 250defm : X86WriteRes<WriteFStoreNTY, [HWPort237,HWPort4], 1, [1,1], 2>; 251 252defm : X86WriteRes<WriteFMaskedStore32, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 253defm : X86WriteRes<WriteFMaskedStore32Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 254defm : X86WriteRes<WriteFMaskedStore64, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 255defm : X86WriteRes<WriteFMaskedStore64Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 256 257defm : X86WriteRes<WriteFMove, [HWPort5], 1, [1], 1>; 258defm : X86WriteRes<WriteFMoveX, [HWPort5], 1, [1], 1>; 259defm : X86WriteRes<WriteFMoveY, [HWPort5], 1, [1], 1>; 260defm : X86WriteResUnsupported<WriteFMoveZ>; 261defm : X86WriteRes<WriteEMMS, [HWPort01,HWPort15,HWPort015,HWPort0156], 31, [8,1,21,1], 31>; 262 263defm : HWWriteResPair<WriteFAdd, [HWPort1], 3, [1], 1, 5>; 264defm : HWWriteResPair<WriteFAddX, [HWPort1], 3, [1], 1, 6>; 265defm : HWWriteResPair<WriteFAddY, [HWPort1], 3, [1], 1, 7>; 266defm : HWWriteResPair<WriteFAddZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 267defm : HWWriteResPair<WriteFAdd64, [HWPort1], 3, [1], 1, 5>; 268defm : HWWriteResPair<WriteFAdd64X, [HWPort1], 3, [1], 1, 6>; 269defm : HWWriteResPair<WriteFAdd64Y, [HWPort1], 3, [1], 1, 7>; 270defm : HWWriteResPair<WriteFAdd64Z, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 271 272defm : HWWriteResPair<WriteFCmp, [HWPort1], 3, [1], 1, 5>; 273defm : HWWriteResPair<WriteFCmpX, [HWPort1], 3, [1], 1, 6>; 274defm : HWWriteResPair<WriteFCmpY, [HWPort1], 3, [1], 1, 7>; 275defm : HWWriteResPair<WriteFCmpZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 276defm : HWWriteResPair<WriteFCmp64, [HWPort1], 3, [1], 1, 5>; 277defm : HWWriteResPair<WriteFCmp64X, [HWPort1], 3, [1], 1, 6>; 278defm : HWWriteResPair<WriteFCmp64Y, [HWPort1], 3, [1], 1, 7>; 279defm : HWWriteResPair<WriteFCmp64Z, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 280 281defm : HWWriteResPair<WriteFCom, [HWPort1], 3>; 282defm : HWWriteResPair<WriteFComX, [HWPort1], 3>; 283 284defm : HWWriteResPair<WriteFMul, [HWPort01], 5, [1], 1, 5>; 285defm : HWWriteResPair<WriteFMulX, [HWPort01], 5, [1], 1, 6>; 286defm : HWWriteResPair<WriteFMulY, [HWPort01], 5, [1], 1, 7>; 287defm : HWWriteResPair<WriteFMulZ, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1 288defm : HWWriteResPair<WriteFMul64, [HWPort01], 5, [1], 1, 5>; 289defm : HWWriteResPair<WriteFMul64X, [HWPort01], 5, [1], 1, 6>; 290defm : HWWriteResPair<WriteFMul64Y, [HWPort01], 5, [1], 1, 7>; 291defm : HWWriteResPair<WriteFMul64Z, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1 292 293defm : HWWriteResPair<WriteFDiv, [HWPort0,HWFPDivider], 13, [1,7], 1, 5>; 294defm : HWWriteResPair<WriteFDivX, [HWPort0,HWFPDivider], 13, [1,7], 1, 6>; 295defm : HWWriteResPair<WriteFDivY, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; 296defm : HWWriteResPair<WriteFDivZ, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; // Unsupported = 1 297defm : HWWriteResPair<WriteFDiv64, [HWPort0,HWFPDivider], 20, [1,14], 1, 5>; 298defm : HWWriteResPair<WriteFDiv64X, [HWPort0,HWFPDivider], 20, [1,14], 1, 6>; 299defm : HWWriteResPair<WriteFDiv64Y, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; 300defm : HWWriteResPair<WriteFDiv64Z, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; // Unsupported = 1 301 302defm : HWWriteResPair<WriteFRcp, [HWPort0], 5, [1], 1, 5>; 303defm : HWWriteResPair<WriteFRcpX, [HWPort0], 5, [1], 1, 6>; 304defm : HWWriteResPair<WriteFRcpY, [HWPort0,HWPort015], 11, [2,1], 3, 7>; 305defm : HWWriteResPair<WriteFRcpZ, [HWPort0,HWPort015], 11, [2,1], 3, 7>; // Unsupported = 1 306 307defm : HWWriteResPair<WriteFRsqrt, [HWPort0], 5, [1], 1, 5>; 308defm : HWWriteResPair<WriteFRsqrtX,[HWPort0], 5, [1], 1, 6>; 309defm : HWWriteResPair<WriteFRsqrtY,[HWPort0,HWPort015], 11, [2,1], 3, 7>; 310defm : HWWriteResPair<WriteFRsqrtZ,[HWPort0,HWPort015], 11, [2,1], 3, 7>; // Unsupported = 1 311 312defm : HWWriteResPair<WriteFSqrt, [HWPort0,HWFPDivider], 11, [1,7], 1, 5>; 313defm : HWWriteResPair<WriteFSqrtX, [HWPort0,HWFPDivider], 11, [1,7], 1, 6>; 314defm : HWWriteResPair<WriteFSqrtY, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; 315defm : HWWriteResPair<WriteFSqrtZ, [HWPort0,HWPort15,HWFPDivider], 21, [2,1,14], 3, 7>; // Unsupported = 1 316defm : HWWriteResPair<WriteFSqrt64, [HWPort0,HWFPDivider], 16, [1,14], 1, 5>; 317defm : HWWriteResPair<WriteFSqrt64X, [HWPort0,HWFPDivider], 16, [1,14], 1, 6>; 318defm : HWWriteResPair<WriteFSqrt64Y, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; 319defm : HWWriteResPair<WriteFSqrt64Z, [HWPort0,HWPort15,HWFPDivider], 35, [2,1,28], 3, 7>; // Unsupported = 1 320defm : HWWriteResPair<WriteFSqrt80, [HWPort0,HWFPDivider], 23, [1,17]>; 321 322defm : HWWriteResPair<WriteFMA, [HWPort01], 5, [1], 1, 5>; 323defm : HWWriteResPair<WriteFMAX, [HWPort01], 5, [1], 1, 6>; 324defm : HWWriteResPair<WriteFMAY, [HWPort01], 5, [1], 1, 7>; 325defm : HWWriteResPair<WriteFMAZ, [HWPort01], 5, [1], 1, 7>; // Unsupported = 1 326defm : HWWriteResPair<WriteDPPD, [HWPort0,HWPort1,HWPort5], 9, [1,1,1], 3, 6>; 327defm : HWWriteResPair<WriteDPPS, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 6>; 328defm : HWWriteResPair<WriteDPPSY, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 7>; 329defm : HWWriteResPair<WriteDPPSZ, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4, 7>; // Unsupported = 1 330defm : HWWriteResPair<WriteFSign, [HWPort0], 1>; 331defm : X86WriteRes<WriteFRnd, [HWPort23], 6, [1], 1>; 332defm : X86WriteRes<WriteFRndY, [HWPort23], 6, [1], 1>; 333defm : X86WriteRes<WriteFRndZ, [HWPort23], 6, [1], 1>; // Unsupported = 1 334defm : X86WriteRes<WriteFRndLd, [HWPort1,HWPort23], 12, [2,1], 3>; 335defm : X86WriteRes<WriteFRndYLd, [HWPort1,HWPort23], 13, [2,1], 3>; 336defm : X86WriteRes<WriteFRndZLd, [HWPort1,HWPort23], 13, [2,1], 3>; // Unsupported = 1 337defm : HWWriteResPair<WriteFLogic, [HWPort5], 1, [1], 1, 6>; 338defm : HWWriteResPair<WriteFLogicY, [HWPort5], 1, [1], 1, 7>; 339defm : HWWriteResPair<WriteFLogicZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 340defm : HWWriteResPair<WriteFTest, [HWPort0], 1, [1], 1, 6>; 341defm : HWWriteResPair<WriteFTestY, [HWPort0], 1, [1], 1, 7>; 342defm : HWWriteResPair<WriteFTestZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1 343defm : HWWriteResPair<WriteFShuffle, [HWPort5], 1, [1], 1, 6>; 344defm : HWWriteResPair<WriteFShuffleY, [HWPort5], 1, [1], 1, 7>; 345defm : HWWriteResPair<WriteFShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 346defm : HWWriteResPair<WriteFVarShuffle, [HWPort5], 1, [1], 1, 6>; 347defm : HWWriteResPair<WriteFVarShuffleY, [HWPort5], 1, [1], 1, 7>; 348defm : HWWriteResPair<WriteFVarShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 349defm : HWWriteResPair<WriteFBlend, [HWPort015], 1, [1], 1, 6>; 350defm : HWWriteResPair<WriteFBlendY, [HWPort015], 1, [1], 1, 7>; 351defm : HWWriteResPair<WriteFBlendZ, [HWPort015], 1, [1], 1, 7>; // Unsupported = 1 352defm : HWWriteResPair<WriteFShuffle256, [HWPort5], 3, [1], 1, 7>; 353defm : HWWriteResPair<WriteFVarShuffle256, [HWPort5], 3, [1], 1, 7>; 354defm : HWWriteResPair<WriteFVarBlend, [HWPort5], 2, [2], 2, 6>; 355defm : HWWriteResPair<WriteFVarBlendY, [HWPort5], 2, [2], 2, 7>; 356defm : HWWriteResPair<WriteFVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1 357 358// Conversion between integer and float. 359defm : HWWriteResPair<WriteCvtSD2I, [HWPort1], 3>; 360defm : HWWriteResPair<WriteCvtPD2I, [HWPort1], 3>; 361defm : HWWriteResPair<WriteCvtPD2IY, [HWPort1], 3>; 362defm : HWWriteResPair<WriteCvtPD2IZ, [HWPort1], 3>; // Unsupported = 1 363defm : HWWriteResPair<WriteCvtSS2I, [HWPort1], 3>; 364defm : HWWriteResPair<WriteCvtPS2I, [HWPort1], 3>; 365defm : HWWriteResPair<WriteCvtPS2IY, [HWPort1], 3>; 366defm : HWWriteResPair<WriteCvtPS2IZ, [HWPort1], 3>; // Unsupported = 1 367 368defm : HWWriteResPair<WriteCvtI2SD, [HWPort1], 4>; 369defm : HWWriteResPair<WriteCvtI2PD, [HWPort1], 4>; 370defm : HWWriteResPair<WriteCvtI2PDY, [HWPort1], 4>; 371defm : HWWriteResPair<WriteCvtI2PDZ, [HWPort1], 4>; // Unsupported = 1 372defm : HWWriteResPair<WriteCvtI2SS, [HWPort1], 4>; 373defm : HWWriteResPair<WriteCvtI2PS, [HWPort1], 4>; 374defm : HWWriteResPair<WriteCvtI2PSY, [HWPort1], 4>; 375defm : HWWriteResPair<WriteCvtI2PSZ, [HWPort1], 4>; // Unsupported = 1 376 377defm : HWWriteResPair<WriteCvtSS2SD, [HWPort1], 3>; 378defm : HWWriteResPair<WriteCvtPS2PD, [HWPort1], 3>; 379defm : HWWriteResPair<WriteCvtPS2PDY, [HWPort1], 3>; 380defm : HWWriteResPair<WriteCvtPS2PDZ, [HWPort1], 3>; // Unsupported = 1 381defm : HWWriteResPair<WriteCvtSD2SS, [HWPort1], 3>; 382defm : HWWriteResPair<WriteCvtPD2PS, [HWPort1], 3>; 383defm : HWWriteResPair<WriteCvtPD2PSY, [HWPort1], 3>; 384defm : HWWriteResPair<WriteCvtPD2PSZ, [HWPort1], 3>; // Unsupported = 1 385 386defm : X86WriteRes<WriteCvtPH2PS, [HWPort0,HWPort5], 2, [1,1], 2>; 387defm : X86WriteRes<WriteCvtPH2PSY, [HWPort0,HWPort5], 2, [1,1], 2>; 388defm : X86WriteRes<WriteCvtPH2PSZ, [HWPort0,HWPort5], 2, [1,1], 2>; // Unsupported = 1 389defm : X86WriteRes<WriteCvtPH2PSLd, [HWPort0,HWPort23], 6, [1,1], 2>; 390defm : X86WriteRes<WriteCvtPH2PSYLd, [HWPort0,HWPort23], 7, [1,1], 2>; 391defm : X86WriteRes<WriteCvtPH2PSZLd, [HWPort0,HWPort23], 7, [1,1], 2>; // Unsupported = 1 392 393defm : X86WriteRes<WriteCvtPS2PH, [HWPort1,HWPort5], 4, [1,1], 2>; 394defm : X86WriteRes<WriteCvtPS2PHY, [HWPort1,HWPort5], 6, [1,1], 2>; 395defm : X86WriteRes<WriteCvtPS2PHZ, [HWPort1,HWPort5], 6, [1,1], 2>; // Unsupported = 1 396defm : X86WriteRes<WriteCvtPS2PHSt, [HWPort1,HWPort4,HWPort5,HWPort237], 5, [1,1,1,1], 4>; 397defm : X86WriteRes<WriteCvtPS2PHYSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>; 398defm : X86WriteRes<WriteCvtPS2PHZSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>; // Unsupported = 1 399 400// Vector integer operations. 401defm : X86WriteRes<WriteVecLoad, [HWPort23], 5, [1], 1>; 402defm : X86WriteRes<WriteVecLoadX, [HWPort23], 6, [1], 1>; 403defm : X86WriteRes<WriteVecLoadY, [HWPort23], 7, [1], 1>; 404defm : X86WriteRes<WriteVecLoadNT, [HWPort23], 6, [1], 1>; 405defm : X86WriteRes<WriteVecLoadNTY, [HWPort23], 7, [1], 1>; 406defm : X86WriteRes<WriteVecMaskedLoad, [HWPort23,HWPort5], 8, [1,2], 3>; 407defm : X86WriteRes<WriteVecMaskedLoadY, [HWPort23,HWPort5], 9, [1,2], 3>; 408defm : X86WriteRes<WriteVecStore, [HWPort237,HWPort4], 1, [1,1], 2>; 409defm : X86WriteRes<WriteVecStoreX, [HWPort237,HWPort4], 1, [1,1], 2>; 410defm : X86WriteRes<WriteVecStoreY, [HWPort237,HWPort4], 1, [1,1], 2>; 411defm : X86WriteRes<WriteVecStoreNT, [HWPort237,HWPort4], 1, [1,1], 2>; 412defm : X86WriteRes<WriteVecStoreNTY, [HWPort237,HWPort4], 1, [1,1], 2>; 413defm : X86WriteRes<WriteVecMaskedStore32, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 414defm : X86WriteRes<WriteVecMaskedStore32Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 415defm : X86WriteRes<WriteVecMaskedStore64, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 416defm : X86WriteRes<WriteVecMaskedStore64Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 417defm : X86WriteRes<WriteVecMove, [HWPort015], 1, [1], 1>; 418defm : X86WriteRes<WriteVecMoveX, [HWPort015], 1, [1], 1>; 419defm : X86WriteRes<WriteVecMoveY, [HWPort015], 1, [1], 1>; 420defm : X86WriteResUnsupported<WriteVecMoveZ>; 421defm : X86WriteRes<WriteVecMoveToGpr, [HWPort0], 1, [1], 1>; 422defm : X86WriteRes<WriteVecMoveFromGpr, [HWPort5], 1, [1], 1>; 423 424defm : HWWriteResPair<WriteVecLogic, [HWPort015], 1, [1], 1, 5>; 425defm : HWWriteResPair<WriteVecLogicX,[HWPort015], 1, [1], 1, 6>; 426defm : HWWriteResPair<WriteVecLogicY,[HWPort015], 1, [1], 1, 7>; 427defm : HWWriteResPair<WriteVecLogicZ,[HWPort015], 1, [1], 1, 7>; // Unsupported = 1 428defm : HWWriteResPair<WriteVecTest, [HWPort0,HWPort5], 2, [1,1], 2, 6>; 429defm : HWWriteResPair<WriteVecTestY, [HWPort0,HWPort5], 4, [1,1], 2, 7>; 430defm : HWWriteResPair<WriteVecTestZ, [HWPort0,HWPort5], 4, [1,1], 2, 7>; // Unsupported = 1 431defm : HWWriteResPair<WriteVecALU, [HWPort15], 1, [1], 1, 5>; 432defm : HWWriteResPair<WriteVecALUX, [HWPort15], 1, [1], 1, 6>; 433defm : HWWriteResPair<WriteVecALUY, [HWPort15], 1, [1], 1, 7>; 434defm : HWWriteResPair<WriteVecALUZ, [HWPort15], 1, [1], 1, 7>; // Unsupported = 1 435defm : HWWriteResPair<WriteVecIMul, [HWPort0], 5, [1], 1, 5>; 436defm : HWWriteResPair<WriteVecIMulX, [HWPort0], 5, [1], 1, 6>; 437defm : HWWriteResPair<WriteVecIMulY, [HWPort0], 5, [1], 1, 7>; 438defm : HWWriteResPair<WriteVecIMulZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1 439defm : HWWriteResPair<WritePMULLD, [HWPort0], 10, [2], 2, 6>; 440defm : HWWriteResPair<WritePMULLDY, [HWPort0], 10, [2], 2, 7>; 441defm : HWWriteResPair<WritePMULLDZ, [HWPort0], 10, [2], 2, 7>; // Unsupported = 1 442defm : HWWriteResPair<WriteShuffle, [HWPort5], 1, [1], 1, 5>; 443defm : HWWriteResPair<WriteShuffleX, [HWPort5], 1, [1], 1, 6>; 444defm : HWWriteResPair<WriteShuffleY, [HWPort5], 1, [1], 1, 7>; 445defm : HWWriteResPair<WriteShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 446defm : HWWriteResPair<WriteVarShuffle, [HWPort5], 1, [1], 1, 5>; 447defm : HWWriteResPair<WriteVarShuffleX,[HWPort5], 1, [1], 1, 6>; 448defm : HWWriteResPair<WriteVarShuffleY,[HWPort5], 1, [1], 1, 7>; 449defm : HWWriteResPair<WriteVarShuffleZ,[HWPort5], 1, [1], 1, 7>; // Unsupported = 1 450defm : HWWriteResPair<WriteBlend, [HWPort5], 1, [1], 1, 6>; 451defm : HWWriteResPair<WriteBlendY, [HWPort5], 1, [1], 1, 7>; 452defm : HWWriteResPair<WriteBlendZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 453defm : HWWriteResPair<WriteShuffle256, [HWPort5], 3, [1], 1, 7>; 454defm : HWWriteResPair<WriteVPMOV256, [HWPort5], 3, [1], 1, 7>; 455defm : HWWriteResPair<WriteVarShuffle256, [HWPort5], 3, [1], 1, 7>; 456defm : HWWriteResPair<WriteVarBlend, [HWPort5], 2, [2], 2, 6>; 457defm : HWWriteResPair<WriteVarBlendY, [HWPort5], 2, [2], 2, 7>; 458defm : HWWriteResPair<WriteVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1 459defm : HWWriteResPair<WriteMPSAD, [HWPort0, HWPort5], 7, [1, 2], 3, 6>; 460defm : HWWriteResPair<WriteMPSADY, [HWPort0, HWPort5], 7, [1, 2], 3, 7>; 461defm : HWWriteResPair<WriteMPSADZ, [HWPort0, HWPort5], 7, [1, 2], 3, 7>; // Unsupported = 1 462defm : HWWriteResPair<WritePSADBW, [HWPort0], 5, [1], 1, 5>; 463defm : HWWriteResPair<WritePSADBWX, [HWPort0], 5, [1], 1, 6>; 464defm : HWWriteResPair<WritePSADBWY, [HWPort0], 5, [1], 1, 7>; 465defm : HWWriteResPair<WritePSADBWZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1 466defm : HWWriteResPair<WritePHMINPOS, [HWPort0], 5, [1], 1, 6>; 467 468// Vector integer shifts. 469defm : HWWriteResPair<WriteVecShift, [HWPort0], 1, [1], 1, 5>; 470defm : HWWriteResPair<WriteVecShiftX, [HWPort0,HWPort5], 2, [1,1], 2, 6>; 471defm : X86WriteRes<WriteVecShiftY, [HWPort0,HWPort5], 4, [1,1], 2>; 472defm : X86WriteRes<WriteVecShiftZ, [HWPort0,HWPort5], 4, [1,1], 2>; // Unsupported = 1 473defm : X86WriteRes<WriteVecShiftYLd, [HWPort0,HWPort23], 8, [1,1], 2>; 474defm : X86WriteRes<WriteVecShiftZLd, [HWPort0,HWPort23], 8, [1,1], 2>; // Unsupported = 1 475 476defm : HWWriteResPair<WriteVecShiftImm, [HWPort0], 1, [1], 1, 5>; 477defm : HWWriteResPair<WriteVecShiftImmX, [HWPort0], 1, [1], 1, 6>; 478defm : HWWriteResPair<WriteVecShiftImmY, [HWPort0], 1, [1], 1, 7>; 479defm : HWWriteResPair<WriteVecShiftImmZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1 480defm : HWWriteResPair<WriteVarVecShift, [HWPort0, HWPort5], 3, [2,1], 3, 6>; 481defm : HWWriteResPair<WriteVarVecShiftY, [HWPort0, HWPort5], 3, [2,1], 3, 7>; 482defm : HWWriteResPair<WriteVarVecShiftZ, [HWPort0, HWPort5], 3, [2,1], 3, 7>; // Unsupported = 1 483 484// Vector insert/extract operations. 485def : WriteRes<WriteVecInsert, [HWPort5]> { 486 let Latency = 2; 487 let NumMicroOps = 2; 488 let ResourceCycles = [2]; 489} 490def : WriteRes<WriteVecInsertLd, [HWPort5,HWPort23]> { 491 let Latency = 6; 492 let NumMicroOps = 2; 493} 494def: InstRW<[WriteVecInsertLd], (instregex "(V?)MOV(H|L)(PD|PS)rm")>; 495 496def : WriteRes<WriteVecExtract, [HWPort0,HWPort5]> { 497 let Latency = 2; 498 let NumMicroOps = 2; 499} 500def : WriteRes<WriteVecExtractSt, [HWPort4,HWPort5,HWPort237]> { 501 let Latency = 2; 502 let NumMicroOps = 3; 503} 504 505// String instructions. 506 507// Packed Compare Implicit Length Strings, Return Mask 508def : WriteRes<WritePCmpIStrM, [HWPort0]> { 509 let Latency = 11; 510 let NumMicroOps = 3; 511 let ResourceCycles = [3]; 512} 513def : WriteRes<WritePCmpIStrMLd, [HWPort0, HWPort23]> { 514 let Latency = 17; 515 let NumMicroOps = 4; 516 let ResourceCycles = [3,1]; 517} 518 519// Packed Compare Explicit Length Strings, Return Mask 520def : WriteRes<WritePCmpEStrM, [HWPort0, HWPort5, HWPort015, HWPort0156]> { 521 let Latency = 19; 522 let NumMicroOps = 9; 523 let ResourceCycles = [4,3,1,1]; 524} 525def : WriteRes<WritePCmpEStrMLd, [HWPort0, HWPort5, HWPort23, HWPort015, HWPort0156]> { 526 let Latency = 25; 527 let NumMicroOps = 10; 528 let ResourceCycles = [4,3,1,1,1]; 529} 530 531// Packed Compare Implicit Length Strings, Return Index 532def : WriteRes<WritePCmpIStrI, [HWPort0]> { 533 let Latency = 11; 534 let NumMicroOps = 3; 535 let ResourceCycles = [3]; 536} 537def : WriteRes<WritePCmpIStrILd, [HWPort0, HWPort23]> { 538 let Latency = 17; 539 let NumMicroOps = 4; 540 let ResourceCycles = [3,1]; 541} 542 543// Packed Compare Explicit Length Strings, Return Index 544def : WriteRes<WritePCmpEStrI, [HWPort0, HWPort5, HWPort0156]> { 545 let Latency = 18; 546 let NumMicroOps = 8; 547 let ResourceCycles = [4,3,1]; 548} 549def : WriteRes<WritePCmpEStrILd, [HWPort0, HWPort5, HWPort23, HWPort0156]> { 550 let Latency = 24; 551 let NumMicroOps = 9; 552 let ResourceCycles = [4,3,1,1]; 553} 554 555// MOVMSK Instructions. 556def : WriteRes<WriteFMOVMSK, [HWPort0]> { let Latency = 3; } 557def : WriteRes<WriteVecMOVMSK, [HWPort0]> { let Latency = 3; } 558def : WriteRes<WriteVecMOVMSKY, [HWPort0]> { let Latency = 3; } 559def : WriteRes<WriteMMXMOVMSK, [HWPort0]> { let Latency = 1; } 560 561// AES Instructions. 562def : WriteRes<WriteAESDecEnc, [HWPort5]> { 563 let Latency = 7; 564 let NumMicroOps = 1; 565 let ResourceCycles = [1]; 566} 567def : WriteRes<WriteAESDecEncLd, [HWPort5, HWPort23]> { 568 let Latency = 13; 569 let NumMicroOps = 2; 570 let ResourceCycles = [1,1]; 571} 572 573def : WriteRes<WriteAESIMC, [HWPort5]> { 574 let Latency = 14; 575 let NumMicroOps = 2; 576 let ResourceCycles = [2]; 577} 578def : WriteRes<WriteAESIMCLd, [HWPort5, HWPort23]> { 579 let Latency = 20; 580 let NumMicroOps = 3; 581 let ResourceCycles = [2,1]; 582} 583 584def : WriteRes<WriteAESKeyGen, [HWPort0,HWPort5,HWPort015]> { 585 let Latency = 29; 586 let NumMicroOps = 11; 587 let ResourceCycles = [2,7,2]; 588} 589def : WriteRes<WriteAESKeyGenLd, [HWPort0,HWPort5,HWPort23,HWPort015]> { 590 let Latency = 34; 591 let NumMicroOps = 11; 592 let ResourceCycles = [2,7,1,1]; 593} 594 595// Carry-less multiplication instructions. 596def : WriteRes<WriteCLMul, [HWPort0, HWPort5]> { 597 let Latency = 11; 598 let NumMicroOps = 3; 599 let ResourceCycles = [2,1]; 600} 601def : WriteRes<WriteCLMulLd, [HWPort0, HWPort5, HWPort23]> { 602 let Latency = 17; 603 let NumMicroOps = 4; 604 let ResourceCycles = [2,1,1]; 605} 606 607// Load/store MXCSR. 608def : WriteRes<WriteLDMXCSR, [HWPort0,HWPort23,HWPort0156]> { let Latency = 7; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; } 609def : WriteRes<WriteSTMXCSR, [HWPort4,HWPort5,HWPort237]> { let Latency = 2; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; } 610 611// Catch-all for expensive system instructions. 612def : WriteRes<WriteSystem, [HWPort0156]> { let Latency = 100; } 613 614// Old microcoded instructions that nobody use. 615def : WriteRes<WriteMicrocoded, [HWPort0156]> { let Latency = 100; } 616 617// Fence instructions. 618def : WriteRes<WriteFence, [HWPort23, HWPort4]>; 619 620// Nop, not very useful expect it provides a model for nops! 621def : WriteRes<WriteNop, []>; 622 623//////////////////////////////////////////////////////////////////////////////// 624// Horizontal add/sub instructions. 625//////////////////////////////////////////////////////////////////////////////// 626 627defm : HWWriteResPair<WriteFHAdd, [HWPort1, HWPort5], 5, [1,2], 3, 6>; 628defm : HWWriteResPair<WriteFHAddY, [HWPort1, HWPort5], 5, [1,2], 3, 7>; 629defm : HWWriteResPair<WritePHAdd, [HWPort5, HWPort15], 3, [2,1], 3, 5>; 630defm : HWWriteResPair<WritePHAddX, [HWPort5, HWPort15], 3, [2,1], 3, 6>; 631defm : HWWriteResPair<WritePHAddY, [HWPort5, HWPort15], 3, [2,1], 3, 7>; 632 633//================ Exceptions ================// 634 635//-- Specific Scheduling Models --// 636 637// Starting with P0. 638def HWWriteP0 : SchedWriteRes<[HWPort0]>; 639 640def HWWriteP01 : SchedWriteRes<[HWPort01]>; 641 642def HWWrite2P01 : SchedWriteRes<[HWPort01]> { 643 let NumMicroOps = 2; 644} 645def HWWrite3P01 : SchedWriteRes<[HWPort01]> { 646 let NumMicroOps = 3; 647} 648 649def HWWriteP0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> { 650 let NumMicroOps = 2; 651} 652 653def HWWrite2P0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> { 654 let NumMicroOps = 3; 655 let ResourceCycles = [2, 1]; 656} 657 658// Starting with P1. 659def HWWriteP1 : SchedWriteRes<[HWPort1]>; 660 661 662def HWWrite2P1 : SchedWriteRes<[HWPort1]> { 663 let NumMicroOps = 2; 664 let ResourceCycles = [2]; 665} 666 667// Notation: 668// - r: register. 669// - mm: 64 bit mmx register. 670// - x = 128 bit xmm register. 671// - (x)mm = mmx or xmm register. 672// - y = 256 bit ymm register. 673// - v = any vector register. 674// - m = memory. 675 676//=== Integer Instructions ===// 677//-- Move instructions --// 678 679// XLAT. 680def HWWriteXLAT : SchedWriteRes<[]> { 681 let Latency = 7; 682 let NumMicroOps = 3; 683} 684def : InstRW<[HWWriteXLAT], (instrs XLAT)>; 685 686// PUSHA. 687def HWWritePushA : SchedWriteRes<[]> { 688 let NumMicroOps = 19; 689} 690def : InstRW<[HWWritePushA], (instregex "PUSHA(16|32)")>; 691 692// POPA. 693def HWWritePopA : SchedWriteRes<[]> { 694 let NumMicroOps = 18; 695} 696def : InstRW<[HWWritePopA], (instregex "POPA(16|32)")>; 697 698//-- Arithmetic instructions --// 699 700// BTR BTS BTC. 701// m,r. 702def HWWriteBTRSCmr : SchedWriteRes<[]> { 703 let NumMicroOps = 11; 704} 705def : SchedAlias<WriteBitTestSetRegRMW, HWWriteBTRSCmr>; 706 707//-- Control transfer instructions --// 708 709// CALL. 710// i. 711def HWWriteRETI : SchedWriteRes<[HWPort23, HWPort6, HWPort015]> { 712 let NumMicroOps = 4; 713 let ResourceCycles = [1, 2, 1]; 714} 715def : InstRW<[HWWriteRETI], (instregex "RETI(16|32|64)", "LRETI(16|32|64)")>; 716 717// BOUND. 718// r,m. 719def HWWriteBOUND : SchedWriteRes<[]> { 720 let NumMicroOps = 15; 721} 722def : InstRW<[HWWriteBOUND], (instregex "BOUNDS(16|32)rm")>; 723 724// INTO. 725def HWWriteINTO : SchedWriteRes<[]> { 726 let NumMicroOps = 4; 727} 728def : InstRW<[HWWriteINTO], (instrs INTO)>; 729 730//-- String instructions --// 731 732// LODSB/W. 733def : InstRW<[HWWrite2P0156_P23], (instregex "LODS(B|W)")>; 734 735// LODSD/Q. 736def : InstRW<[HWWriteP0156_P23], (instregex "LODS(L|Q)")>; 737 738// MOVS. 739def HWWriteMOVS : SchedWriteRes<[HWPort23, HWPort4, HWPort0156]> { 740 let Latency = 4; 741 let NumMicroOps = 5; 742 let ResourceCycles = [2, 1, 2]; 743} 744def : InstRW<[HWWriteMOVS], (instrs MOVSB, MOVSL, MOVSQ, MOVSW)>; 745 746// CMPS. 747def HWWriteCMPS : SchedWriteRes<[HWPort23, HWPort0156]> { 748 let Latency = 4; 749 let NumMicroOps = 5; 750 let ResourceCycles = [2, 3]; 751} 752def : InstRW<[HWWriteCMPS], (instregex "CMPS(B|L|Q|W)")>; 753 754//-- Other --// 755 756// RDPMC.f 757def HWWriteRDPMC : SchedWriteRes<[]> { 758 let NumMicroOps = 34; 759} 760def : InstRW<[HWWriteRDPMC], (instrs RDPMC)>; 761 762// RDRAND. 763def HWWriteRDRAND : SchedWriteRes<[HWPort23, HWPort015]> { 764 let NumMicroOps = 17; 765 let ResourceCycles = [1, 16]; 766} 767def : InstRW<[HWWriteRDRAND], (instrs RDRAND16r, RDRAND32r, RDRAND64r)>; 768 769//=== Floating Point x87 Instructions ===// 770//-- Move instructions --// 771 772// FLD. 773// m80. 774def : InstRW<[HWWriteP01], (instrs LD_Frr)>; 775 776// FBLD. 777// m80. 778def HWWriteFBLD : SchedWriteRes<[]> { 779 let Latency = 47; 780 let NumMicroOps = 43; 781} 782def : InstRW<[HWWriteFBLD], (instrs FBLDm)>; 783 784// FST(P). 785// r. 786def : InstRW<[HWWriteP01], (instregex "ST_(F|FP)rr")>; 787 788// FFREE. 789def : InstRW<[HWWriteP01], (instregex "FFREE")>; 790 791// FNSAVE. 792def HWWriteFNSAVE : SchedWriteRes<[]> { 793 let NumMicroOps = 147; 794} 795def : InstRW<[HWWriteFNSAVE], (instrs FSAVEm)>; 796 797// FRSTOR. 798def HWWriteFRSTOR : SchedWriteRes<[]> { 799 let NumMicroOps = 90; 800} 801def : InstRW<[HWWriteFRSTOR], (instrs FRSTORm)>; 802 803//-- Arithmetic instructions --// 804 805// FCOMPP FUCOMPP. 806// r. 807def : InstRW<[HWWrite2P01], (instrs FCOMPP, UCOM_FPPr)>; 808 809// FCOMI(P) FUCOMI(P). 810// m. 811def : InstRW<[HWWrite3P01], (instrs COM_FIPr, COM_FIr, UCOM_FIPr, UCOM_FIr)>; 812 813// FTST. 814def : InstRW<[HWWriteP1], (instregex "TST_F")>; 815 816// FXAM. 817def : InstRW<[HWWrite2P1], (instrs XAM_F)>; 818 819// FPREM. 820def HWWriteFPREM : SchedWriteRes<[]> { 821 let Latency = 19; 822 let NumMicroOps = 28; 823} 824def : InstRW<[HWWriteFPREM], (instrs FPREM)>; 825 826// FPREM1. 827def HWWriteFPREM1 : SchedWriteRes<[]> { 828 let Latency = 27; 829 let NumMicroOps = 41; 830} 831def : InstRW<[HWWriteFPREM1], (instrs FPREM1)>; 832 833// FRNDINT. 834def HWWriteFRNDINT : SchedWriteRes<[]> { 835 let Latency = 11; 836 let NumMicroOps = 17; 837} 838def : InstRW<[HWWriteFRNDINT], (instrs FRNDINT)>; 839 840//-- Math instructions --// 841 842// FSCALE. 843def HWWriteFSCALE : SchedWriteRes<[]> { 844 let Latency = 75; // 49-125 845 let NumMicroOps = 50; // 25-75 846} 847def : InstRW<[HWWriteFSCALE], (instrs FSCALE)>; 848 849// FXTRACT. 850def HWWriteFXTRACT : SchedWriteRes<[]> { 851 let Latency = 15; 852 let NumMicroOps = 17; 853} 854def : InstRW<[HWWriteFXTRACT], (instrs FXTRACT)>; 855 856//=== Floating Point XMM and YMM Instructions ===// 857 858// Remaining instrs. 859 860def HWWriteResGroup0 : SchedWriteRes<[HWPort23]> { 861 let Latency = 6; 862 let NumMicroOps = 1; 863 let ResourceCycles = [1]; 864} 865def: InstRW<[HWWriteResGroup0], (instrs VBROADCASTSSrm)>; 866def: InstRW<[HWWriteResGroup0], (instregex "(V?)MOVSHDUPrm", 867 "(V?)MOVSLDUPrm", 868 "VPBROADCAST(D|Q)rm")>; 869 870def HWWriteResGroup0_1 : SchedWriteRes<[HWPort23]> { 871 let Latency = 7; 872 let NumMicroOps = 1; 873 let ResourceCycles = [1]; 874} 875def: InstRW<[HWWriteResGroup0_1], (instrs VBROADCASTF128, 876 VBROADCASTI128, 877 VBROADCASTSDYrm, 878 VBROADCASTSSYrm, 879 VMOVDDUPYrm, 880 VMOVSHDUPYrm, 881 VMOVSLDUPYrm)>; 882def: InstRW<[HWWriteResGroup0_1], (instregex "LD_F(32|64|80)m", 883 "VPBROADCAST(D|Q)Yrm")>; 884 885def HWWriteResGroup0_2 : SchedWriteRes<[HWPort23]> { 886 let Latency = 5; 887 let NumMicroOps = 1; 888 let ResourceCycles = [1]; 889} 890def: InstRW<[HWWriteResGroup0_2], (instregex "MOVSX(16|32|64)rm(8|16|32)", 891 "MOVZX(16|32|64)rm(8|16)", 892 "(V?)MOVDDUPrm")>; 893 894def HWWriteResGroup1 : SchedWriteRes<[HWPort4,HWPort237]> { 895 let Latency = 1; 896 let NumMicroOps = 2; 897 let ResourceCycles = [1,1]; 898} 899def: InstRW<[HWWriteResGroup1], (instrs FBSTPm, VMPTRSTm)>; 900def: InstRW<[HWWriteResGroup1], (instregex "ST_FP(32|64|80)m")>; 901 902def HWWriteResGroup2 : SchedWriteRes<[HWPort0]> { 903 let Latency = 1; 904 let NumMicroOps = 1; 905 let ResourceCycles = [1]; 906} 907def: InstRW<[HWWriteResGroup2], (instregex "VPSLLVQ(Y?)rr", 908 "VPSRLVQ(Y?)rr")>; 909 910def HWWriteResGroup3 : SchedWriteRes<[HWPort1]> { 911 let Latency = 1; 912 let NumMicroOps = 1; 913 let ResourceCycles = [1]; 914} 915def: InstRW<[HWWriteResGroup3], (instregex "COM(P?)_FST0r", 916 "UCOM_F(P?)r")>; 917 918def HWWriteResGroup4 : SchedWriteRes<[HWPort5]> { 919 let Latency = 1; 920 let NumMicroOps = 1; 921 let ResourceCycles = [1]; 922} 923def: InstRW<[HWWriteResGroup4], (instrs MMX_MOVQ2DQrr)>; 924 925def HWWriteResGroup5 : SchedWriteRes<[HWPort6]> { 926 let Latency = 1; 927 let NumMicroOps = 1; 928 let ResourceCycles = [1]; 929} 930def: InstRW<[HWWriteResGroup5], (instregex "JMP(16|32|64)r")>; 931 932def HWWriteResGroup6 : SchedWriteRes<[HWPort01]> { 933 let Latency = 1; 934 let NumMicroOps = 1; 935 let ResourceCycles = [1]; 936} 937def: InstRW<[HWWriteResGroup6], (instrs FINCSTP, FNOP)>; 938 939def HWWriteResGroup7 : SchedWriteRes<[HWPort06]> { 940 let Latency = 1; 941 let NumMicroOps = 1; 942 let ResourceCycles = [1]; 943} 944def: InstRW<[HWWriteResGroup7], (instrs CDQ, CQO)>; 945 946def HWWriteResGroup8 : SchedWriteRes<[HWPort15]> { 947 let Latency = 1; 948 let NumMicroOps = 1; 949 let ResourceCycles = [1]; 950} 951def: InstRW<[HWWriteResGroup8], (instregex "ANDN(32|64)rr")>; 952 953def HWWriteResGroup9 : SchedWriteRes<[HWPort015]> { 954 let Latency = 1; 955 let NumMicroOps = 1; 956 let ResourceCycles = [1]; 957} 958def: InstRW<[HWWriteResGroup9], (instregex "VPBLENDD(Y?)rri")>; 959 960def HWWriteResGroup10 : SchedWriteRes<[HWPort0156]> { 961 let Latency = 1; 962 let NumMicroOps = 1; 963 let ResourceCycles = [1]; 964} 965def: InstRW<[HWWriteResGroup10], (instrs CBW, CWDE, CDQE, 966 CMC, STC, 967 SGDT64m, 968 SIDT64m, 969 SMSW16m, 970 STRm, 971 SYSCALL)>; 972 973def HWWriteResGroup11 : SchedWriteRes<[HWPort0,HWPort23]> { 974 let Latency = 6; 975 let NumMicroOps = 2; 976 let ResourceCycles = [1,1]; 977} 978def: InstRW<[HWWriteResGroup11], (instregex "(V?)CVTPS2PDrm")>; 979 980def HWWriteResGroup11_1 : SchedWriteRes<[HWPort0,HWPort23]> { 981 let Latency = 7; 982 let NumMicroOps = 2; 983 let ResourceCycles = [1,1]; 984} 985def: InstRW<[HWWriteResGroup11_1], (instrs VPSLLVQrm, VPSRLVQrm)>; 986def: InstRW<[HWWriteResGroup11_1], (instregex "(V?)CVTSS2SDrm")>; 987 988def HWWriteResGroup11_2 : SchedWriteRes<[HWPort0,HWPort23]> { 989 let Latency = 8; 990 let NumMicroOps = 2; 991 let ResourceCycles = [1,1]; 992} 993def: InstRW<[HWWriteResGroup11_2], (instrs VPSLLVQYrm, VPSRLVQYrm)>; 994 995def HWWriteResGroup12 : SchedWriteRes<[HWPort1,HWPort23]> { 996 let Latency = 8; 997 let NumMicroOps = 2; 998 let ResourceCycles = [1,1]; 999} 1000def: InstRW<[HWWriteResGroup12], (instrs MMX_CVTPI2PSrm)>; 1001def: InstRW<[HWWriteResGroup12], (instregex "P(DEP|EXT)(32|64)rm")>; 1002 1003def HWWriteResGroup13 : SchedWriteRes<[HWPort5,HWPort23]> { 1004 let Latency = 6; 1005 let NumMicroOps = 2; 1006 let ResourceCycles = [1,1]; 1007} 1008def: InstRW<[HWWriteResGroup13], (instregex "(V?)PMOV(SX|ZX)BDrm", 1009 "(V?)PMOV(SX|ZX)BQrm", 1010 "(V?)PMOV(SX|ZX)BWrm", 1011 "(V?)PMOV(SX|ZX)DQrm", 1012 "(V?)PMOV(SX|ZX)WDrm", 1013 "(V?)PMOV(SX|ZX)WQrm")>; 1014 1015def HWWriteResGroup13_1 : SchedWriteRes<[HWPort5,HWPort23]> { 1016 let Latency = 8; 1017 let NumMicroOps = 2; 1018 let ResourceCycles = [1,1]; 1019} 1020def: InstRW<[HWWriteResGroup13_1], (instrs VPMOVSXBDYrm, 1021 VPMOVSXBQYrm, 1022 VPMOVSXWQYrm)>; 1023 1024def HWWriteResGroup14 : SchedWriteRes<[HWPort6,HWPort23]> { 1025 let Latency = 6; 1026 let NumMicroOps = 2; 1027 let ResourceCycles = [1,1]; 1028} 1029def: InstRW<[HWWriteResGroup14], (instrs FARJMP64m)>; 1030def: InstRW<[HWWriteResGroup14], (instregex "JMP(16|32|64)m")>; 1031 1032def HWWriteResGroup16 : SchedWriteRes<[HWPort23,HWPort15]> { 1033 let Latency = 6; 1034 let NumMicroOps = 2; 1035 let ResourceCycles = [1,1]; 1036} 1037def: InstRW<[HWWriteResGroup16], (instregex "ANDN(32|64)rm", 1038 "MOVBE(16|32|64)rm")>; 1039 1040def HWWriteResGroup17 : SchedWriteRes<[HWPort23,HWPort015]> { 1041 let Latency = 7; 1042 let NumMicroOps = 2; 1043 let ResourceCycles = [1,1]; 1044} 1045def: InstRW<[HWWriteResGroup17], (instrs VINSERTF128rm, 1046 VINSERTI128rm, 1047 VPBLENDDrmi)>; 1048 1049def HWWriteResGroup17_2 : SchedWriteRes<[HWPort23,HWPort015]> { 1050 let Latency = 8; 1051 let NumMicroOps = 2; 1052 let ResourceCycles = [1,1]; 1053} 1054def: InstRW<[HWWriteResGroup17_2], (instrs VPBLENDDYrmi)>; 1055 1056def HWWriteResGroup18 : SchedWriteRes<[HWPort23,HWPort0156]> { 1057 let Latency = 6; 1058 let NumMicroOps = 2; 1059 let ResourceCycles = [1,1]; 1060} 1061def: InstRW<[HWWriteResGroup18], (instrs POP16r, POP32r, POP64r)>; 1062def: InstRW<[HWWriteResGroup18], (instregex "POP(16|32|64)rmr")>; 1063 1064def HWWriteResGroup19 : SchedWriteRes<[HWPort237,HWPort0156]> { 1065 let Latency = 2; 1066 let NumMicroOps = 2; 1067 let ResourceCycles = [1,1]; 1068} 1069def: InstRW<[HWWriteResGroup19], (instrs SFENCE)>; 1070 1071def HWWriteResGroup21 : SchedWriteRes<[HWPort4,HWPort6,HWPort237]> { 1072 let Latency = 2; 1073 let NumMicroOps = 3; 1074 let ResourceCycles = [1,1,1]; 1075} 1076def: InstRW<[HWWriteResGroup21], (instrs FNSTCW16m)>; 1077 1078def HWWriteResGroup23 : SchedWriteRes<[HWPort4,HWPort237,HWPort15]> { 1079 let Latency = 2; 1080 let NumMicroOps = 3; 1081 let ResourceCycles = [1,1,1]; 1082} 1083def: InstRW<[HWWriteResGroup23], (instregex "MOVBE(32|64)mr")>; 1084 1085def HWWriteResGroup23_16 : SchedWriteRes<[HWPort06, HWPort237, HWPort4]> { 1086 let Latency = 2; 1087 let NumMicroOps = 3; 1088 let ResourceCycles = [1,1,1]; 1089} 1090def: InstRW<[HWWriteResGroup23_16], (instrs MOVBE16mr)>; 1091 1092def HWWriteResGroup24 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> { 1093 let Latency = 2; 1094 let NumMicroOps = 3; 1095 let ResourceCycles = [1,1,1]; 1096} 1097def: InstRW<[HWWriteResGroup24], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8, 1098 STOSB, STOSL, STOSQ, STOSW)>; 1099def: InstRW<[HWWriteResGroup24], (instregex "PUSH(16|32|64)rmr")>; 1100 1101def HWWriteResGroup25 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> { 1102 let Latency = 7; 1103 let NumMicroOps = 4; 1104 let ResourceCycles = [1,1,1,1]; 1105} 1106def: InstRW<[HWWriteResGroup25], (instregex "SAR(8|16|32|64)m(1|i)", 1107 "SHL(8|16|32|64)m(1|i)", 1108 "SHR(8|16|32|64)m(1|i)")>; 1109 1110def HWWriteResGroup26 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1111 let Latency = 7; 1112 let NumMicroOps = 4; 1113 let ResourceCycles = [1,1,1,1]; 1114} 1115def: InstRW<[HWWriteResGroup26], (instregex "POP(16|32|64)rmm", 1116 "PUSH(16|32|64)rmm")>; 1117 1118def HWWriteResGroup28 : SchedWriteRes<[HWPort01]> { 1119 let Latency = 2; 1120 let NumMicroOps = 2; 1121 let ResourceCycles = [2]; 1122} 1123def: InstRW<[HWWriteResGroup28], (instrs FDECSTP)>; 1124 1125def HWWriteResGroup30 : SchedWriteRes<[HWPort0156]> { 1126 let Latency = 2; 1127 let NumMicroOps = 2; 1128 let ResourceCycles = [2]; 1129} 1130def: InstRW<[HWWriteResGroup30], (instrs LFENCE, 1131 MFENCE, 1132 WAIT, 1133 XGETBV)>; 1134 1135def HWWriteResGroup31 : SchedWriteRes<[HWPort0,HWPort5]> { 1136 let Latency = 2; 1137 let NumMicroOps = 2; 1138 let ResourceCycles = [1,1]; 1139} 1140def: InstRW<[HWWriteResGroup31], (instregex "(V?)CVTPS2PDrr", 1141 "(V?)CVTSS2SDrr")>; 1142 1143def HWWriteResGroup32 : SchedWriteRes<[HWPort6,HWPort0156]> { 1144 let Latency = 2; 1145 let NumMicroOps = 2; 1146 let ResourceCycles = [1,1]; 1147} 1148def: InstRW<[HWWriteResGroup32], (instregex "CLFLUSH")>; 1149 1150def HWWriteResGroup33 : SchedWriteRes<[HWPort01,HWPort015]> { 1151 let Latency = 2; 1152 let NumMicroOps = 2; 1153 let ResourceCycles = [1,1]; 1154} 1155def: InstRW<[HWWriteResGroup33], (instrs MMX_MOVDQ2Qrr)>; 1156 1157def HWWriteResGroup35 : SchedWriteRes<[HWPort06,HWPort0156]> { 1158 let Latency = 2; 1159 let NumMicroOps = 2; 1160 let ResourceCycles = [1,1]; 1161} 1162def: InstRW<[HWWriteResGroup35], (instrs CWD, JCXZ, JECXZ, JRCXZ)>; 1163 1164def HWWriteResGroup36_2 : SchedWriteRes<[HWPort5,HWPort23]> { 1165 let Latency = 7; 1166 let NumMicroOps = 3; 1167 let ResourceCycles = [2,1]; 1168} 1169def: InstRW<[HWWriteResGroup36_2], (instrs MMX_PACKSSDWrm, 1170 MMX_PACKSSWBrm, 1171 MMX_PACKUSWBrm)>; 1172 1173def HWWriteResGroup37 : SchedWriteRes<[HWPort23,HWPort0156]> { 1174 let Latency = 7; 1175 let NumMicroOps = 3; 1176 let ResourceCycles = [1,2]; 1177} 1178def: InstRW<[HWWriteResGroup37], (instrs LEAVE, LEAVE64, 1179 SCASB, SCASL, SCASQ, SCASW)>; 1180 1181def HWWriteResGroup39 : SchedWriteRes<[HWPort0,HWPort01,HWPort23]> { 1182 let Latency = 7; 1183 let NumMicroOps = 3; 1184 let ResourceCycles = [1,1,1]; 1185} 1186def: InstRW<[HWWriteResGroup39], (instrs FLDCW16m)>; 1187 1188def HWWriteResGroup41 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> { 1189 let Latency = 7; 1190 let NumMicroOps = 3; 1191 let ResourceCycles = [1,1,1]; 1192} 1193def: InstRW<[HWWriteResGroup41], (instrs LRET64, RET32, RET64)>; 1194 1195def HWWriteResGroup44 : SchedWriteRes<[HWPort4,HWPort6,HWPort237,HWPort0156]> { 1196 let Latency = 3; 1197 let NumMicroOps = 4; 1198 let ResourceCycles = [1,1,1,1]; 1199} 1200def: InstRW<[HWWriteResGroup44], (instregex "CALL(16|32|64)r")>; 1201 1202def HWWriteResGroup45 : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> { 1203 let Latency = 3; 1204 let NumMicroOps = 4; 1205 let ResourceCycles = [1,1,1,1]; 1206} 1207def: InstRW<[HWWriteResGroup45], (instrs CALL64pcrel32)>; 1208 1209def HWWriteResGroup46 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> { 1210 let Latency = 8; 1211 let NumMicroOps = 5; 1212 let ResourceCycles = [1,1,1,2]; 1213} 1214def: InstRW<[HWWriteResGroup46], (instregex "ROL(8|16|32|64)m(1|i)", 1215 "ROR(8|16|32|64)m(1|i)")>; 1216 1217def HWWriteResGroup46_1 : SchedWriteRes<[HWPort06]> { 1218 let Latency = 2; 1219 let NumMicroOps = 2; 1220 let ResourceCycles = [2]; 1221} 1222def: InstRW<[HWWriteResGroup46_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1, 1223 ROR8r1, ROR16r1, ROR32r1, ROR64r1)>; 1224 1225def HWWriteResGroup47 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1226 let Latency = 8; 1227 let NumMicroOps = 5; 1228 let ResourceCycles = [1,1,1,2]; 1229} 1230def: InstRW<[HWWriteResGroup47], (instregex "XADD(8|16|32|64)rm")>; 1231 1232def HWWriteResGroup48 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1233 let Latency = 8; 1234 let NumMicroOps = 5; 1235 let ResourceCycles = [1,1,1,1,1]; 1236} 1237def: InstRW<[HWWriteResGroup48], (instregex "CALL(16|32|64)m")>; 1238def: InstRW<[HWWriteResGroup48], (instrs FARCALL64m)>; 1239 1240def HWWriteResGroup50 : SchedWriteRes<[HWPort1]> { 1241 let Latency = 3; 1242 let NumMicroOps = 1; 1243 let ResourceCycles = [1]; 1244} 1245def: InstRW<[HWWriteResGroup50], (instrs MMX_CVTPI2PSrr)>; 1246def: InstRW<[HWWriteResGroup50], (instregex "P(DEP|EXT)(32|64)rr", 1247 "(V?)CVTDQ2PS(Y?)rr")>; 1248 1249def HWWriteResGroup51 : SchedWriteRes<[HWPort5]> { 1250 let Latency = 3; 1251 let NumMicroOps = 1; 1252 let ResourceCycles = [1]; 1253} 1254def: InstRW<[HWWriteResGroup51], (instregex "VPBROADCAST(B|W)rr")>; 1255 1256def HWWriteResGroup52 : SchedWriteRes<[HWPort1,HWPort23]> { 1257 let Latency = 9; 1258 let NumMicroOps = 2; 1259 let ResourceCycles = [1,1]; 1260} 1261def: InstRW<[HWWriteResGroup52], (instregex "(V?)CVTPS2DQrm", 1262 "(V?)CVTTPS2DQrm")>; 1263 1264def HWWriteResGroup52_1 : SchedWriteRes<[HWPort1,HWPort23]> { 1265 let Latency = 10; 1266 let NumMicroOps = 2; 1267 let ResourceCycles = [1,1]; 1268} 1269def: InstRW<[HWWriteResGroup52_1], (instregex "(ADD|SUB|SUBR)_F(32|64)m", 1270 "ILD_F(16|32|64)m")>; 1271def: InstRW<[HWWriteResGroup52_1], (instrs VCVTDQ2PSYrm, 1272 VCVTPS2DQYrm, 1273 VCVTTPS2DQYrm)>; 1274 1275def HWWriteResGroup53_1 : SchedWriteRes<[HWPort5,HWPort23]> { 1276 let Latency = 9; 1277 let NumMicroOps = 2; 1278 let ResourceCycles = [1,1]; 1279} 1280def: InstRW<[HWWriteResGroup53_1], (instrs VPMOVSXBWYrm, 1281 VPMOVSXDQYrm, 1282 VPMOVSXWDYrm, 1283 VPMOVZXWDYrm)>; 1284 1285def HWWriteResGroup57 : SchedWriteRes<[HWPort5,HWPort0156]> { 1286 let Latency = 3; 1287 let NumMicroOps = 3; 1288 let ResourceCycles = [2,1]; 1289} 1290def: InstRW<[HWWriteResGroup57], (instrs MMX_PACKSSDWrr, 1291 MMX_PACKSSWBrr, 1292 MMX_PACKUSWBrr)>; 1293 1294def HWWriteResGroup58 : SchedWriteRes<[HWPort6,HWPort0156]> { 1295 let Latency = 3; 1296 let NumMicroOps = 3; 1297 let ResourceCycles = [1,2]; 1298} 1299def: InstRW<[HWWriteResGroup58], (instregex "CLD")>; 1300 1301def HWWriteResGroup59 : SchedWriteRes<[HWPort06,HWPort0156]> { 1302 let Latency = 2; 1303 let NumMicroOps = 3; 1304 let ResourceCycles = [1,2]; 1305} 1306def: InstRW<[HWWriteResGroup59], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1, 1307 RCR8r1, RCR16r1, RCR32r1, RCR64r1)>; 1308 1309def HWWriteResGroup60 : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1310 let Latency = 5; 1311 let NumMicroOps = 8; 1312 let ResourceCycles = [2,4,2]; 1313} 1314def: InstRW<[HWWriteResGroup60], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>; 1315 1316def HWWriteResGroup60b : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1317 let Latency = 6; 1318 let NumMicroOps = 8; 1319 let ResourceCycles = [2,4,2]; 1320} 1321def: InstRW<[HWWriteResGroup60b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>; 1322 1323def HWWriteResGroup61 : SchedWriteRes<[HWPort0,HWPort4,HWPort237]> { 1324 let Latency = 4; 1325 let NumMicroOps = 3; 1326 let ResourceCycles = [1,1,1]; 1327} 1328def: InstRW<[HWWriteResGroup61], (instrs FNSTSWm)>; 1329 1330def HWWriteResGroup62 : SchedWriteRes<[HWPort1,HWPort4,HWPort237]> { 1331 let Latency = 4; 1332 let NumMicroOps = 3; 1333 let ResourceCycles = [1,1,1]; 1334} 1335def: InstRW<[HWWriteResGroup62], (instregex "IST(T?)_FP(16|32|64)m", 1336 "IST_F(16|32)m")>; 1337 1338def HWWriteResGroup66 : SchedWriteRes<[HWPort23,HWPort237,HWPort06,HWPort0156]> { 1339 let Latency = 9; 1340 let NumMicroOps = 5; 1341 let ResourceCycles = [1,1,1,2]; 1342} 1343def: InstRW<[HWWriteResGroup66], (instregex "RCL(8|16|32|64)m(1|i)", 1344 "RCR(8|16|32|64)m(1|i)")>; 1345 1346def HWWriteResGroup68 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1347 let Latency = 9; 1348 let NumMicroOps = 6; 1349 let ResourceCycles = [1,1,1,3]; 1350} 1351def: InstRW<[HWWriteResGroup68], (instregex "XCHG(8|16|32|64)rm")>; 1352 1353def HWWriteResGroup69 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1354 let Latency = 9; 1355 let NumMicroOps = 6; 1356 let ResourceCycles = [1,1,1,2,1]; 1357} 1358def: InstRW<[HWWriteResGroup69], (instregex "ROL(8|16|32|64)mCL", 1359 "ROR(8|16|32|64)mCL", 1360 "SAR(8|16|32|64)mCL", 1361 "SHL(8|16|32|64)mCL", 1362 "SHR(8|16|32|64)mCL")>; 1363def: SchedAlias<WriteADCRMW, HWWriteResGroup69>; 1364 1365def HWWriteResGroup70 : SchedWriteRes<[HWPort0,HWPort1]> { 1366 let Latency = 4; 1367 let NumMicroOps = 2; 1368 let ResourceCycles = [1,1]; 1369} 1370def: InstRW<[HWWriteResGroup70], (instregex "(V?)CVT(T?)SD2SI(64)?rr", 1371 "(V?)CVT(T?)SS2SI(64)?rr")>; 1372 1373def HWWriteResGroup71 : SchedWriteRes<[HWPort0,HWPort5]> { 1374 let Latency = 4; 1375 let NumMicroOps = 2; 1376 let ResourceCycles = [1,1]; 1377} 1378def: InstRW<[HWWriteResGroup71], (instrs VCVTPS2PDYrr)>; 1379 1380def HWWriteResGroup72 : SchedWriteRes<[HWPort0,HWPort0156]> { 1381 let Latency = 4; 1382 let NumMicroOps = 2; 1383 let ResourceCycles = [1,1]; 1384} 1385def: InstRW<[HWWriteResGroup72], (instrs FNSTSW16r)>; 1386 1387def HWWriteResGroup73 : SchedWriteRes<[HWPort1,HWPort5]> { 1388 let Latency = 4; 1389 let NumMicroOps = 2; 1390 let ResourceCycles = [1,1]; 1391} 1392def: InstRW<[HWWriteResGroup73], (instrs MMX_CVTPI2PDrr, 1393 MMX_CVTPD2PIrr, 1394 MMX_CVTPS2PIrr, 1395 MMX_CVTTPD2PIrr, 1396 MMX_CVTTPS2PIrr)>; 1397def: InstRW<[HWWriteResGroup73], (instregex "(V?)CVTDQ2PDrr", 1398 "(V?)CVTPD2PSrr", 1399 "(V?)CVTSD2SSrr", 1400 "(V?)CVTSI(64)?2SDrr", 1401 "(V?)CVTSI2SSrr", 1402 "(V?)CVT(T?)PD2DQrr")>; 1403 1404def HWWriteResGroup75 : SchedWriteRes<[HWPort1,HWPort23]> { 1405 let Latency = 11; 1406 let NumMicroOps = 3; 1407 let ResourceCycles = [2,1]; 1408} 1409def: InstRW<[HWWriteResGroup75], (instregex "FICOM(P?)(16|32)m")>; 1410 1411def HWWriteResGroup76 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1412 let Latency = 9; 1413 let NumMicroOps = 3; 1414 let ResourceCycles = [1,1,1]; 1415} 1416def: InstRW<[HWWriteResGroup76], (instregex "(V?)CVTSD2SI(64)?rm", 1417 "(V?)CVTSS2SI(64)?rm", 1418 "(V?)CVTTSD2SI(64)?rm", 1419 "VCVTTSS2SI64rm", 1420 "(V?)CVTTSS2SIrm")>; 1421 1422def HWWriteResGroup77 : SchedWriteRes<[HWPort0,HWPort5,HWPort23]> { 1423 let Latency = 10; 1424 let NumMicroOps = 3; 1425 let ResourceCycles = [1,1,1]; 1426} 1427def: InstRW<[HWWriteResGroup77], (instrs VCVTPS2PDYrm)>; 1428 1429def HWWriteResGroup78 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> { 1430 let Latency = 10; 1431 let NumMicroOps = 3; 1432 let ResourceCycles = [1,1,1]; 1433} 1434def: InstRW<[HWWriteResGroup78], (instrs CVTPD2PSrm, 1435 CVTPD2DQrm, 1436 CVTTPD2DQrm, 1437 MMX_CVTPD2PIrm, 1438 MMX_CVTTPD2PIrm, 1439 CVTDQ2PDrm, 1440 VCVTDQ2PDrm)>; 1441 1442def HWWriteResGroup78_1 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> { 1443 let Latency = 9; 1444 let NumMicroOps = 3; 1445 let ResourceCycles = [1,1,1]; 1446} 1447def: InstRW<[HWWriteResGroup78_1], (instrs MMX_CVTPI2PDrm, 1448 CVTSD2SSrm, CVTSD2SSrm_Int, 1449 VCVTSD2SSrm, VCVTSD2SSrm_Int)>; 1450 1451def HWWriteResGroup80 : SchedWriteRes<[HWPort5,HWPort23,HWPort015]> { 1452 let Latency = 9; 1453 let NumMicroOps = 3; 1454 let ResourceCycles = [1,1,1]; 1455} 1456def: InstRW<[HWWriteResGroup80], (instregex "VPBROADCAST(B|W)(Y?)rm")>; 1457 1458def HWWriteResGroup81 : SchedWriteRes<[HWPort0156]> { 1459 let Latency = 4; 1460 let NumMicroOps = 4; 1461 let ResourceCycles = [4]; 1462} 1463def: InstRW<[HWWriteResGroup81], (instrs FNCLEX)>; 1464 1465def HWWriteResGroup82 : SchedWriteRes<[]> { 1466 let Latency = 0; 1467 let NumMicroOps = 4; 1468 let ResourceCycles = []; 1469} 1470def: InstRW<[HWWriteResGroup82], (instrs VZEROUPPER)>; 1471 1472def HWWriteResGroup83 : SchedWriteRes<[HWPort1,HWPort6,HWPort0156]> { 1473 let Latency = 4; 1474 let NumMicroOps = 4; 1475 let ResourceCycles = [1,1,2]; 1476} 1477def: InstRW<[HWWriteResGroup83], (instregex "LAR(16|32|64)rr")>; 1478 1479def HWWriteResGroup87 : SchedWriteRes<[HWPort1,HWPort6,HWPort23,HWPort0156]> { 1480 let Latency = 9; 1481 let NumMicroOps = 5; 1482 let ResourceCycles = [1,2,1,1]; 1483} 1484def: InstRW<[HWWriteResGroup87], (instregex "LAR(16|32|64)rm", 1485 "LSL(16|32|64)rm")>; 1486 1487def HWWriteResGroup88 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> { 1488 let Latency = 5; 1489 let NumMicroOps = 6; 1490 let ResourceCycles = [1,1,4]; 1491} 1492def: InstRW<[HWWriteResGroup88], (instregex "PUSHF(16|64)")>; 1493 1494def HWWriteResGroup89 : SchedWriteRes<[HWPort0]> { 1495 let Latency = 5; 1496 let NumMicroOps = 1; 1497 let ResourceCycles = [1]; 1498} 1499def: InstRW<[HWWriteResGroup89], (instregex "MUL_(FPrST0|FST0r|FrST0)")>; 1500 1501def HWWriteResGroup91_2 : SchedWriteRes<[HWPort0,HWPort23]> { 1502 let Latency = 11; 1503 let NumMicroOps = 2; 1504 let ResourceCycles = [1,1]; 1505} 1506def: InstRW<[HWWriteResGroup91_2], (instregex "(V?)PCMPGTQrm")>; 1507 1508def HWWriteResGroup91_3 : SchedWriteRes<[HWPort0,HWPort23]> { 1509 let Latency = 12; 1510 let NumMicroOps = 2; 1511 let ResourceCycles = [1,1]; 1512} 1513def: InstRW<[HWWriteResGroup91_3], (instregex "MUL_F(32|64)m")>; 1514def: InstRW<[HWWriteResGroup91_3], (instrs VPCMPGTQYrm)>; 1515 1516def HWWriteResGroup93 : SchedWriteRes<[HWPort1,HWPort5]> { 1517 let Latency = 5; 1518 let NumMicroOps = 3; 1519 let ResourceCycles = [1,2]; 1520} 1521def: InstRW<[HWWriteResGroup93], (instregex "(V?)CVTSI642SSrr")>; 1522 1523def HWWriteResGroup94 : SchedWriteRes<[HWPort1,HWPort6,HWPort06]> { 1524 let Latency = 5; 1525 let NumMicroOps = 3; 1526 let ResourceCycles = [1,1,1]; 1527} 1528def: InstRW<[HWWriteResGroup94], (instregex "STR(16|32|64)r")>; 1529 1530def HWWriteResGroup97 : SchedWriteRes<[HWPort0,HWPort1,HWPort5,HWPort23]> { 1531 let Latency = 10; 1532 let NumMicroOps = 4; 1533 let ResourceCycles = [1,1,1,1]; 1534} 1535def: InstRW<[HWWriteResGroup97], (instregex "CVTTSS2SI64rm")>; 1536 1537def HWWriteResGroup99 : SchedWriteRes<[HWPort6,HWPort0156]> { 1538 let Latency = 5; 1539 let NumMicroOps = 5; 1540 let ResourceCycles = [1,4]; 1541} 1542def: InstRW<[HWWriteResGroup99], (instrs PAUSE)>; 1543 1544def HWWriteResGroup100 : SchedWriteRes<[HWPort06,HWPort0156]> { 1545 let Latency = 5; 1546 let NumMicroOps = 5; 1547 let ResourceCycles = [1,4]; 1548} 1549def: InstRW<[HWWriteResGroup100], (instrs XSETBV)>; 1550 1551def HWWriteResGroup102 : SchedWriteRes<[HWPort1,HWPort5]> { 1552 let Latency = 6; 1553 let NumMicroOps = 2; 1554 let ResourceCycles = [1,1]; 1555} 1556def: InstRW<[HWWriteResGroup102], (instrs VCVTDQ2PDYrr, 1557 VCVTPD2PSYrr, 1558 VCVTPD2DQYrr, 1559 VCVTTPD2DQYrr)>; 1560 1561def HWWriteResGroup103 : SchedWriteRes<[HWPort1,HWPort23]> { 1562 let Latency = 13; 1563 let NumMicroOps = 3; 1564 let ResourceCycles = [2,1]; 1565} 1566def: InstRW<[HWWriteResGroup103], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>; 1567 1568def HWWriteResGroup104 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> { 1569 let Latency = 12; 1570 let NumMicroOps = 3; 1571 let ResourceCycles = [1,1,1]; 1572} 1573def: InstRW<[HWWriteResGroup104], (instrs VCVTDQ2PDYrm)>; 1574 1575def HWWriteResGroup107 : SchedWriteRes<[HWPort1,HWPort6,HWPort06,HWPort0156]> { 1576 let Latency = 6; 1577 let NumMicroOps = 4; 1578 let ResourceCycles = [1,1,1,1]; 1579} 1580def: InstRW<[HWWriteResGroup107], (instregex "SLDT(16|32|64)r")>; 1581 1582def HWWriteResGroup108 : SchedWriteRes<[HWPort6,HWPort0156]> { 1583 let Latency = 6; 1584 let NumMicroOps = 6; 1585 let ResourceCycles = [1,5]; 1586} 1587def: InstRW<[HWWriteResGroup108], (instrs STD)>; 1588 1589def HWWriteResGroup114 : SchedWriteRes<[HWPort6,HWPort06,HWPort15,HWPort0156]> { 1590 let Latency = 7; 1591 let NumMicroOps = 7; 1592 let ResourceCycles = [2,2,1,2]; 1593} 1594def: InstRW<[HWWriteResGroup114], (instrs LOOP)>; 1595 1596def HWWriteResGroup115 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1597 let Latency = 15; 1598 let NumMicroOps = 3; 1599 let ResourceCycles = [1,1,1]; 1600} 1601def: InstRW<[HWWriteResGroup115], (instregex "MUL_FI(16|32)m")>; 1602 1603def HWWriteResGroup120 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1604 let Latency = 16; 1605 let NumMicroOps = 10; 1606 let ResourceCycles = [1,1,1,4,1,2]; 1607} 1608def: InstRW<[HWWriteResGroup120], (instregex "RCL(8|16|32|64)mCL")>; 1609 1610def HWWriteResGroup129 : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1611 let Latency = 11; 1612 let NumMicroOps = 7; 1613 let ResourceCycles = [2,2,3]; 1614} 1615def: InstRW<[HWWriteResGroup129], (instregex "RCL(16|32|64)rCL", 1616 "RCR(16|32|64)rCL")>; 1617 1618def HWWriteResGroup130 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> { 1619 let Latency = 11; 1620 let NumMicroOps = 9; 1621 let ResourceCycles = [1,4,1,3]; 1622} 1623def: InstRW<[HWWriteResGroup130], (instrs RCL8rCL)>; 1624 1625def HWWriteResGroup131 : SchedWriteRes<[HWPort06,HWPort0156]> { 1626 let Latency = 11; 1627 let NumMicroOps = 11; 1628 let ResourceCycles = [2,9]; 1629} 1630def: InstRW<[HWWriteResGroup131], (instrs LOOPE, LOOPNE)>; 1631 1632def HWWriteResGroup132 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1633 let Latency = 17; 1634 let NumMicroOps = 14; 1635 let ResourceCycles = [1,1,1,4,2,5]; 1636} 1637def: InstRW<[HWWriteResGroup132], (instrs CMPXCHG8B)>; 1638 1639def HWWriteResGroup135 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1640 let Latency = 19; 1641 let NumMicroOps = 11; 1642 let ResourceCycles = [2,1,1,3,1,3]; 1643} 1644def: InstRW<[HWWriteResGroup135], (instregex "RCR(8|16|32|64)mCL")>; 1645 1646def HWWriteResGroup142 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> { 1647 let Latency = 14; 1648 let NumMicroOps = 10; 1649 let ResourceCycles = [2,3,1,4]; 1650} 1651def: InstRW<[HWWriteResGroup142], (instrs RCR8rCL)>; 1652 1653def HWWriteResGroup143 : SchedWriteRes<[HWPort23,HWPort0156]> { 1654 let Latency = 19; 1655 let NumMicroOps = 15; 1656 let ResourceCycles = [1,14]; 1657} 1658def: InstRW<[HWWriteResGroup143], (instrs POPF16)>; 1659 1660def HWWriteResGroup144 : SchedWriteRes<[HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1661 let Latency = 21; 1662 let NumMicroOps = 8; 1663 let ResourceCycles = [1,1,1,1,1,1,2]; 1664} 1665def: InstRW<[HWWriteResGroup144], (instrs INSB, INSL, INSW)>; 1666 1667def HWWriteResGroup145 : SchedWriteRes<[HWPort5, HWPort6]> { 1668 let Latency = 8; 1669 let NumMicroOps = 20; 1670 let ResourceCycles = [1,1]; 1671} 1672def: InstRW<[HWWriteResGroup145], (instrs VZEROALL)>; 1673 1674def HWWriteResGroup146 : SchedWriteRes<[HWPort0,HWPort4,HWPort5,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1675 let Latency = 22; 1676 let NumMicroOps = 19; 1677 let ResourceCycles = [2,1,4,1,1,4,6]; 1678} 1679def: InstRW<[HWWriteResGroup146], (instrs CMPXCHG16B)>; 1680 1681def HWWriteResGroup147 : SchedWriteRes<[HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156]> { 1682 let Latency = 17; 1683 let NumMicroOps = 15; 1684 let ResourceCycles = [2,1,2,4,2,4]; 1685} 1686def: InstRW<[HWWriteResGroup147], (instrs XCH_F)>; 1687 1688def HWWriteResGroup149 : SchedWriteRes<[HWPort5,HWPort6,HWPort06,HWPort0156]> { 1689 let Latency = 18; 1690 let NumMicroOps = 8; 1691 let ResourceCycles = [1,1,1,5]; 1692} 1693def: InstRW<[HWWriteResGroup149], (instrs CPUID, RDTSC)>; 1694 1695def HWWriteResGroup151 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> { 1696 let Latency = 23; 1697 let NumMicroOps = 19; 1698 let ResourceCycles = [3,1,15]; 1699} 1700def: InstRW<[HWWriteResGroup151], (instregex "XRSTOR(64)?")>; 1701 1702def HWWriteResGroup154 : SchedWriteRes<[HWPort0]> { 1703 let Latency = 20; 1704 let NumMicroOps = 1; 1705 let ResourceCycles = [1]; 1706} 1707def: InstRW<[HWWriteResGroup154], (instregex "DIV_(FPrST0|FST0r|FrST0)")>; 1708 1709def HWWriteResGroup155 : SchedWriteRes<[HWPort0,HWPort23]> { 1710 let Latency = 27; 1711 let NumMicroOps = 2; 1712 let ResourceCycles = [1,1]; 1713} 1714def: InstRW<[HWWriteResGroup155], (instregex "DIVR_F(32|64)m")>; 1715 1716def HWWriteResGroup156 : SchedWriteRes<[HWPort5,HWPort6,HWPort0156]> { 1717 let Latency = 20; 1718 let NumMicroOps = 10; 1719 let ResourceCycles = [1,2,7]; 1720} 1721def: InstRW<[HWWriteResGroup156], (instrs MWAITrr)>; 1722 1723def HWWriteResGroup161 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1724 let Latency = 30; 1725 let NumMicroOps = 3; 1726 let ResourceCycles = [1,1,1]; 1727} 1728def: InstRW<[HWWriteResGroup161], (instregex "DIVR_FI(16|32)m")>; 1729 1730def HWWriteResGroup162 : SchedWriteRes<[HWPort0]> { 1731 let Latency = 24; 1732 let NumMicroOps = 1; 1733 let ResourceCycles = [1]; 1734} 1735def: InstRW<[HWWriteResGroup162], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>; 1736 1737def HWWriteResGroup163 : SchedWriteRes<[HWPort0,HWPort23]> { 1738 let Latency = 31; 1739 let NumMicroOps = 2; 1740 let ResourceCycles = [1,1]; 1741} 1742def: InstRW<[HWWriteResGroup163], (instregex "DIV_F(32|64)m")>; 1743 1744def HWWriteResGroup164 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1745 let Latency = 30; 1746 let NumMicroOps = 27; 1747 let ResourceCycles = [1,5,1,1,19]; 1748} 1749def: InstRW<[HWWriteResGroup164], (instrs XSAVE64)>; 1750 1751def HWWriteResGroup165 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1752 let Latency = 31; 1753 let NumMicroOps = 28; 1754 let ResourceCycles = [1,6,1,1,19]; 1755} 1756def: InstRW<[HWWriteResGroup165], (instrs XSAVE)>; 1757def: InstRW<[HWWriteResGroup165], (instregex "XSAVEC", "XSAVES", "XSAVEOPT")>; 1758 1759def HWWriteResGroup166 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1760 let Latency = 34; 1761 let NumMicroOps = 3; 1762 let ResourceCycles = [1,1,1]; 1763} 1764def: InstRW<[HWWriteResGroup166], (instregex "DIV_FI(16|32)m")>; 1765 1766def HWWriteResGroup170 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort06,HWPort0156]> { 1767 let Latency = 35; 1768 let NumMicroOps = 23; 1769 let ResourceCycles = [1,5,3,4,10]; 1770} 1771def: InstRW<[HWWriteResGroup170], (instregex "IN(8|16|32)ri", 1772 "IN(8|16|32)rr")>; 1773 1774def HWWriteResGroup171 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1775 let Latency = 36; 1776 let NumMicroOps = 23; 1777 let ResourceCycles = [1,5,2,1,4,10]; 1778} 1779def: InstRW<[HWWriteResGroup171], (instregex "OUT(8|16|32)ir", 1780 "OUT(8|16|32)rr")>; 1781 1782def HWWriteResGroup175 : SchedWriteRes<[HWPort1,HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort15,HWPort0156]> { 1783 let Latency = 41; 1784 let NumMicroOps = 18; 1785 let ResourceCycles = [1,1,2,3,1,1,1,8]; 1786} 1787def: InstRW<[HWWriteResGroup175], (instrs VMCLEARm)>; 1788 1789def HWWriteResGroup176 : SchedWriteRes<[HWPort5,HWPort0156]> { 1790 let Latency = 42; 1791 let NumMicroOps = 22; 1792 let ResourceCycles = [2,20]; 1793} 1794def: InstRW<[HWWriteResGroup176], (instrs RDTSCP)>; 1795 1796def HWWriteResGroup177 : SchedWriteRes<[HWPort0,HWPort01,HWPort23,HWPort05,HWPort06,HWPort015,HWPort0156]> { 1797 let Latency = 61; 1798 let NumMicroOps = 64; 1799 let ResourceCycles = [2,2,8,1,10,2,39]; 1800} 1801def: InstRW<[HWWriteResGroup177], (instrs FLDENVm)>; 1802 1803def HWWriteResGroup178 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> { 1804 let Latency = 64; 1805 let NumMicroOps = 88; 1806 let ResourceCycles = [4,4,31,1,2,1,45]; 1807} 1808def: InstRW<[HWWriteResGroup178], (instrs FXRSTOR64)>; 1809 1810def HWWriteResGroup179 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> { 1811 let Latency = 64; 1812 let NumMicroOps = 90; 1813 let ResourceCycles = [4,2,33,1,2,1,47]; 1814} 1815def: InstRW<[HWWriteResGroup179], (instrs FXRSTOR)>; 1816 1817def HWWriteResGroup180 : SchedWriteRes<[HWPort5,HWPort01,HWPort0156]> { 1818 let Latency = 75; 1819 let NumMicroOps = 15; 1820 let ResourceCycles = [6,3,6]; 1821} 1822def: InstRW<[HWWriteResGroup180], (instrs FNINIT)>; 1823 1824def HWWriteResGroup183 : SchedWriteRes<[HWPort0,HWPort1,HWPort4,HWPort5,HWPort6,HWPort237,HWPort06,HWPort0156]> { 1825 let Latency = 115; 1826 let NumMicroOps = 100; 1827 let ResourceCycles = [9,9,11,8,1,11,21,30]; 1828} 1829def: InstRW<[HWWriteResGroup183], (instrs FSTENVm)>; 1830 1831def HWWriteResGroup184 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1832 let Latency = 14; 1833 let NumMicroOps = 12; 1834 let ResourceCycles = [2,2,2,1,3,2]; 1835} 1836def: InstRW<[HWWriteResGroup184], (instrs VGATHERDPDrm, VPGATHERDQrm)>; 1837 1838def HWWriteResGroup185 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1839 let Latency = 17; 1840 let NumMicroOps = 20; 1841 let ResourceCycles = [3,3,4,1,5,4]; 1842} 1843def: InstRW<[HWWriteResGroup185], (instrs VGATHERDPDYrm, VPGATHERDQYrm)>; 1844 1845def HWWriteResGroup186 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1846 let Latency = 16; 1847 let NumMicroOps = 20; 1848 let ResourceCycles = [3,3,4,1,5,4]; 1849} 1850def: InstRW<[HWWriteResGroup186], (instrs VGATHERDPSrm, VPGATHERDDrm)>; 1851 1852def HWWriteResGroup187 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1853 let Latency = 22; 1854 let NumMicroOps = 34; 1855 let ResourceCycles = [5,3,8,1,9,8]; 1856} 1857def: InstRW<[HWWriteResGroup187], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>; 1858 1859def HWWriteResGroup188 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1860 let Latency = 15; 1861 let NumMicroOps = 14; 1862 let ResourceCycles = [3,3,2,1,3,2]; 1863} 1864def: InstRW<[HWWriteResGroup188], (instrs VGATHERQPDrm, VPGATHERQQrm)>; 1865 1866def HWWriteResGroup189 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1867 let Latency = 17; 1868 let NumMicroOps = 22; 1869 let ResourceCycles = [5,3,4,1,5,4]; 1870} 1871def: InstRW<[HWWriteResGroup189], (instrs VGATHERQPDYrm, VPGATHERQQYrm, 1872 VGATHERQPSYrm, VPGATHERQDYrm)>; 1873 1874def HWWriteResGroup190 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1875 let Latency = 16; 1876 let NumMicroOps = 15; 1877 let ResourceCycles = [3,3,2,1,4,2]; 1878} 1879def: InstRW<[HWWriteResGroup190], (instrs VGATHERQPSrm, VPGATHERQDrm)>; 1880 1881def: InstRW<[WriteZero], (instrs CLC)>; 1882 1883 1884// Instruction variants handled by the renamer. These might not need execution 1885// ports in certain conditions. 1886// See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs", 1887// section "Haswell and Broadwell Pipeline" > "Register allocation and 1888// renaming". 1889// These can be investigated with llvm-exegesis, e.g. 1890// echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1891// echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1892 1893def HWWriteZeroLatency : SchedWriteRes<[]> { 1894 let Latency = 0; 1895} 1896 1897def HWWriteZeroIdiom : SchedWriteVariant<[ 1898 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1899 SchedVar<NoSchedPred, [WriteALU]> 1900]>; 1901def : InstRW<[HWWriteZeroIdiom], (instrs SUB32rr, SUB64rr, 1902 XOR32rr, XOR64rr)>; 1903 1904def HWWriteFZeroIdiom : SchedWriteVariant<[ 1905 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1906 SchedVar<NoSchedPred, [WriteFLogic]> 1907]>; 1908def : InstRW<[HWWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr, 1909 VXORPDrr)>; 1910 1911def HWWriteFZeroIdiomY : SchedWriteVariant<[ 1912 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1913 SchedVar<NoSchedPred, [WriteFLogicY]> 1914]>; 1915def : InstRW<[HWWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>; 1916 1917def HWWriteVZeroIdiomLogicX : SchedWriteVariant<[ 1918 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1919 SchedVar<NoSchedPred, [WriteVecLogicX]> 1920]>; 1921def : InstRW<[HWWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>; 1922 1923def HWWriteVZeroIdiomLogicY : SchedWriteVariant<[ 1924 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1925 SchedVar<NoSchedPred, [WriteVecLogicY]> 1926]>; 1927def : InstRW<[HWWriteVZeroIdiomLogicY], (instrs VPXORYrr)>; 1928 1929def HWWriteVZeroIdiomALUX : SchedWriteVariant<[ 1930 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1931 SchedVar<NoSchedPred, [WriteVecALUX]> 1932]>; 1933def : InstRW<[HWWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr, 1934 PSUBDrr, VPSUBDrr, 1935 PSUBQrr, VPSUBQrr, 1936 PSUBWrr, VPSUBWrr, 1937 PCMPGTBrr, VPCMPGTBrr, 1938 PCMPGTDrr, VPCMPGTDrr, 1939 PCMPGTWrr, VPCMPGTWrr)>; 1940 1941def HWWriteVZeroIdiomALUY : SchedWriteVariant<[ 1942 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1943 SchedVar<NoSchedPred, [WriteVecALUY]> 1944]>; 1945def : InstRW<[HWWriteVZeroIdiomALUY], (instrs VPSUBBYrr, 1946 VPSUBDYrr, 1947 VPSUBQYrr, 1948 VPSUBWYrr, 1949 VPCMPGTBYrr, 1950 VPCMPGTDYrr, 1951 VPCMPGTWYrr)>; 1952 1953def HWWritePCMPGTQ : SchedWriteRes<[HWPort0]> { 1954 let Latency = 5; 1955 let NumMicroOps = 1; 1956 let ResourceCycles = [1]; 1957} 1958 1959def HWWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[ 1960 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1961 SchedVar<NoSchedPred, [HWWritePCMPGTQ]> 1962]>; 1963def : InstRW<[HWWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr, 1964 VPCMPGTQYrr)>; 1965 1966 1967// The 0x83 ADC/SBB opcodes have special support for immediate 0 to only require 1968// a single uop. It does not apply to the GR8 encoding. And only applies to the 1969// 8-bit immediate since using larger immediate for 0 would be silly. 1970// Unfortunately, this optimization does not apply to the AX/EAX/RAX short 1971// encodings we convert to in MCInstLowering so we exclude AX/EAX/RAX here since 1972// we schedule before that point. 1973// TODO: Should we disable using the short encodings on these CPUs? 1974def HWFastADC0 : MCSchedPredicate< 1975 CheckAll<[ 1976 CheckImmOperand<2, 0>, // Second MCOperand is Imm and has value 0. 1977 CheckNot<CheckRegOperand<1, AX>>, // First MCOperand is not register AX 1978 CheckNot<CheckRegOperand<1, EAX>>, // First MCOperand is not register EAX 1979 CheckNot<CheckRegOperand<1, RAX>> // First MCOperand is not register RAX 1980 ]> 1981>; 1982 1983def HWWriteADC0 : SchedWriteRes<[HWPort06]> { 1984 let Latency = 1; 1985 let NumMicroOps = 1; 1986 let ResourceCycles = [1]; 1987} 1988 1989def HWWriteADC : SchedWriteVariant<[ 1990 SchedVar<HWFastADC0, [HWWriteADC0]>, 1991 SchedVar<NoSchedPred, [WriteADC]> 1992]>; 1993 1994def : InstRW<[HWWriteADC], (instrs ADC16ri8, ADC32ri8, ADC64ri8, 1995 SBB16ri8, SBB32ri8, SBB64ri8)>; 1996 1997// CMOVs that use both Z and C flag require an extra uop. 1998def HWWriteCMOVA_CMOVBErr : SchedWriteRes<[HWPort06,HWPort0156]> { 1999 let Latency = 3; 2000 let ResourceCycles = [1,2]; 2001 let NumMicroOps = 3; 2002} 2003 2004def HWWriteCMOVA_CMOVBErm : SchedWriteRes<[HWPort23,HWPort06,HWPort0156]> { 2005 let Latency = 8; 2006 let ResourceCycles = [1,1,2]; 2007 let NumMicroOps = 4; 2008} 2009 2010def HWCMOVA_CMOVBErr : SchedWriteVariant<[ 2011 SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [HWWriteCMOVA_CMOVBErr]>, 2012 SchedVar<NoSchedPred, [WriteCMOV]> 2013]>; 2014 2015def HWCMOVA_CMOVBErm : SchedWriteVariant<[ 2016 SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [HWWriteCMOVA_CMOVBErm]>, 2017 SchedVar<NoSchedPred, [WriteCMOV.Folded]> 2018]>; 2019 2020def : InstRW<[HWCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>; 2021def : InstRW<[HWCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>; 2022 2023// SETCCs that use both Z and C flag require an extra uop. 2024def HWWriteSETA_SETBEr : SchedWriteRes<[HWPort06,HWPort0156]> { 2025 let Latency = 2; 2026 let ResourceCycles = [1,1]; 2027 let NumMicroOps = 2; 2028} 2029 2030def HWWriteSETA_SETBEm : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> { 2031 let Latency = 3; 2032 let ResourceCycles = [1,1,1,1]; 2033 let NumMicroOps = 4; 2034} 2035 2036def HWSETA_SETBErr : SchedWriteVariant<[ 2037 SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [HWWriteSETA_SETBEr]>, 2038 SchedVar<NoSchedPred, [WriteSETCC]> 2039]>; 2040 2041def HWSETA_SETBErm : SchedWriteVariant<[ 2042 SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [HWWriteSETA_SETBEm]>, 2043 SchedVar<NoSchedPred, [WriteSETCCStore]> 2044]>; 2045 2046def : InstRW<[HWSETA_SETBErr], (instrs SETCCr)>; 2047def : InstRW<[HWSETA_SETBErm], (instrs SETCCm)>; 2048 2049/////////////////////////////////////////////////////////////////////////////// 2050// Dependency breaking instructions. 2051/////////////////////////////////////////////////////////////////////////////// 2052 2053def : IsZeroIdiomFunction<[ 2054 // GPR Zero-idioms. 2055 DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>, 2056 2057 // SSE Zero-idioms. 2058 DepBreakingClass<[ 2059 // fp variants. 2060 XORPSrr, XORPDrr, 2061 2062 // int variants. 2063 PXORrr, 2064 PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr, 2065 PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr 2066 ], ZeroIdiomPredicate>, 2067 2068 // AVX Zero-idioms. 2069 DepBreakingClass<[ 2070 // xmm fp variants. 2071 VXORPSrr, VXORPDrr, 2072 2073 // xmm int variants. 2074 VPXORrr, 2075 VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr, 2076 VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr, 2077 2078 // ymm variants. 2079 VXORPSYrr, VXORPDYrr, VPXORYrr, 2080 VPSUBBYrr, VPSUBWYrr, VPSUBDYrr, VPSUBQYrr, 2081 VPCMPGTBYrr, VPCMPGTWYrr, VPCMPGTDYrr 2082 ], ZeroIdiomPredicate>, 2083]>; 2084 2085} // SchedModel 2086