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, int LoadUOps = 1> { 100 // Register variant is using a single cycle on ExePort. 101 def : WriteRes<SchedRW, ExePorts> { 102 let Latency = Lat; 103 let ReleaseAtCycles = 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 ReleaseAtCycles = !listconcat([1], Res); 112 let NumMicroOps = !add(UOps, LoadUOps); 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 : X86WriteRes<WriteFMoveZ, [HWPort5], 1, [1], 1>; // Unsupported = 1 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 : X86WriteRes<WriteDPPS, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4>; 328defm : X86WriteRes<WriteDPPSY, [HWPort0,HWPort1,HWPort5], 14, [2,1,1], 4>; 329defm : X86WriteRes<WriteDPPSLd, [HWPort0,HWPort1,HWPort5,HWPort06,HWPort23], 20, [2,1,1,1,1], 6>; 330defm : X86WriteRes<WriteDPPSYLd, [HWPort0,HWPort1,HWPort5,HWPort06,HWPort23], 21, [2,1,1,1,1], 6>; 331defm : HWWriteResPair<WriteFSign, [HWPort0], 1>; 332defm : HWWriteResPair<WriteFRnd, [HWPort1], 6, [2], 2, 6>; 333defm : HWWriteResPair<WriteFRndY, [HWPort1], 6, [2], 2, 7>; 334defm : HWWriteResPair<WriteFRndZ, [HWPort1], 6, [2], 2, 7>; // Unsupported = 1 335defm : HWWriteResPair<WriteFLogic, [HWPort5], 1, [1], 1, 6>; 336defm : HWWriteResPair<WriteFLogicY, [HWPort5], 1, [1], 1, 7>; 337defm : HWWriteResPair<WriteFLogicZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 338defm : HWWriteResPair<WriteFTest, [HWPort0], 1, [1], 1, 6>; 339defm : HWWriteResPair<WriteFTestY, [HWPort0], 1, [1], 1, 7>; 340defm : HWWriteResPair<WriteFTestZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1 341defm : HWWriteResPair<WriteFShuffle, [HWPort5], 1, [1], 1, 6>; 342defm : HWWriteResPair<WriteFShuffleY, [HWPort5], 1, [1], 1, 7>; 343defm : HWWriteResPair<WriteFShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 344defm : HWWriteResPair<WriteFVarShuffle, [HWPort5], 1, [1], 1, 6>; 345defm : HWWriteResPair<WriteFVarShuffleY, [HWPort5], 1, [1], 1, 7>; 346defm : HWWriteResPair<WriteFVarShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 347defm : HWWriteResPair<WriteFBlend, [HWPort015], 1, [1], 1, 6>; 348defm : HWWriteResPair<WriteFBlendY, [HWPort015], 1, [1], 1, 7>; 349defm : HWWriteResPair<WriteFBlendZ, [HWPort015], 1, [1], 1, 7>; // Unsupported = 1 350defm : HWWriteResPair<WriteFShuffle256, [HWPort5], 3, [1], 1, 7>; 351defm : HWWriteResPair<WriteFVarShuffle256, [HWPort5], 3, [1], 1, 7>; 352defm : HWWriteResPair<WriteFVarBlend, [HWPort5], 2, [2], 2, 6>; 353defm : HWWriteResPair<WriteFVarBlendY, [HWPort5], 2, [2], 2, 7>; 354defm : HWWriteResPair<WriteFVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1 355 356// Conversion between integer and float. 357defm : HWWriteResPair<WriteCvtSD2I, [HWPort1,HWPort0], 4, [1,1], 2, 5>; 358defm : HWWriteResPair<WriteCvtPD2I, [HWPort1,HWPort5], 4, [1,1], 2, 6>; 359defm : HWWriteResPair<WriteCvtPD2IY, [HWPort1,HWPort5], 6, [1,1], 2, 6>; 360defm : HWWriteResPair<WriteCvtPD2IZ, [HWPort1,HWPort5], 6, [1,1], 2, 6>; // Unsupported = 1 361defm : HWWriteResPair<WriteCvtSS2I, [HWPort1,HWPort0], 4, [1,1], 2, 5>; 362defm : HWWriteResPair<WriteCvtPS2I, [HWPort1], 3, [1], 1, 6>; 363defm : HWWriteResPair<WriteCvtPS2IY, [HWPort1], 3, [1], 1, 7>; 364defm : HWWriteResPair<WriteCvtPS2IZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 365 366defm : X86WriteRes<WriteCvtI2SD, [HWPort1,HWPort5], 4, [1,1], 2>; 367defm : X86WriteRes<WriteCvtI2SDLd, [HWPort1,HWPort23], 9, [1,1], 2>; 368defm : HWWriteResPair<WriteCvtI2PD, [HWPort1,HWPort5], 4, [1,1], 2, 6>; 369defm : HWWriteResPair<WriteCvtI2PDY, [HWPort1,HWPort5], 6, [1,1], 2, 6>; 370defm : HWWriteResPair<WriteCvtI2PDZ, [HWPort1,HWPort5], 6, [1,1], 2, 6>; // Unsupported = 1 371defm : X86WriteRes<WriteCvtI2SS, [HWPort1,HWPort5], 4, [1,1], 2>; 372defm : X86WriteRes<WriteCvtI2SSLd, [HWPort1,HWPort23], 9, [1,1], 2>; 373defm : HWWriteResPair<WriteCvtI2PS, [HWPort1], 3, [1], 1, 6>; 374defm : HWWriteResPair<WriteCvtI2PSY, [HWPort1], 3, [1], 1, 7>; 375defm : HWWriteResPair<WriteCvtI2PSZ, [HWPort1], 3, [1], 1, 7>; // Unsupported = 1 376 377defm : X86WriteRes<WriteCvtSS2SD, [HWPort0,HWPort5], 2, [1,1], 2>; 378defm : X86WriteRes<WriteCvtSS2SDLd, [HWPort0,HWPort23], 7, [1,1], 2>; 379defm : X86WriteRes<WriteCvtPS2PD, [HWPort0,HWPort5], 2, [1,1], 2>; 380defm : X86WriteRes<WriteCvtPS2PDLd, [HWPort0,HWPort23], 6, [1,1], 2>; 381defm : HWWriteResPair<WriteCvtPS2PDY, [HWPort0,HWPort5], 4, [1,1], 2, 6>; 382defm : HWWriteResPair<WriteCvtPS2PDZ, [HWPort0,HWPort5], 4, [1,1], 2, 6>; // Unsupported = 1 383defm : HWWriteResPair<WriteCvtSD2SS, [HWPort1,HWPort5], 4, [1,1], 2, 5>; 384defm : HWWriteResPair<WriteCvtPD2PS, [HWPort1,HWPort5], 4, [1,1], 2, 6>; 385defm : HWWriteResPair<WriteCvtPD2PSY, [HWPort1,HWPort5], 6, [1,1], 2, 6>; 386defm : HWWriteResPair<WriteCvtPD2PSZ, [HWPort1,HWPort5], 4, [1,1], 2, 6>; // Unsupported = 1 387 388defm : X86WriteRes<WriteCvtPH2PS, [HWPort0,HWPort5], 2, [1,1], 2>; 389defm : X86WriteRes<WriteCvtPH2PSY, [HWPort0,HWPort5], 2, [1,1], 2>; 390defm : X86WriteRes<WriteCvtPH2PSZ, [HWPort0,HWPort5], 2, [1,1], 2>; // Unsupported = 1 391defm : X86WriteRes<WriteCvtPH2PSLd, [HWPort0,HWPort23], 6, [1,1], 2>; 392defm : X86WriteRes<WriteCvtPH2PSYLd, [HWPort0,HWPort23], 7, [1,1], 2>; 393defm : X86WriteRes<WriteCvtPH2PSZLd, [HWPort0,HWPort23], 7, [1,1], 2>; // Unsupported = 1 394 395defm : X86WriteRes<WriteCvtPS2PH, [HWPort1,HWPort5], 4, [1,1], 2>; 396defm : X86WriteRes<WriteCvtPS2PHY, [HWPort1,HWPort5], 6, [1,1], 2>; 397defm : X86WriteRes<WriteCvtPS2PHZ, [HWPort1,HWPort5], 6, [1,1], 2>; // Unsupported = 1 398defm : X86WriteRes<WriteCvtPS2PHSt, [HWPort1,HWPort4,HWPort5,HWPort237], 5, [1,1,1,1], 4>; 399defm : X86WriteRes<WriteCvtPS2PHYSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>; 400defm : X86WriteRes<WriteCvtPS2PHZSt, [HWPort1,HWPort4,HWPort5,HWPort237], 7, [1,1,1,1], 4>; // Unsupported = 1 401 402// Vector integer operations. 403defm : X86WriteRes<WriteVecLoad, [HWPort23], 5, [1], 1>; 404defm : X86WriteRes<WriteVecLoadX, [HWPort23], 6, [1], 1>; 405defm : X86WriteRes<WriteVecLoadY, [HWPort23], 7, [1], 1>; 406defm : X86WriteRes<WriteVecLoadNT, [HWPort23], 6, [1], 1>; 407defm : X86WriteRes<WriteVecLoadNTY, [HWPort23], 7, [1], 1>; 408defm : X86WriteRes<WriteVecMaskedLoad, [HWPort23,HWPort5], 8, [1,2], 3>; 409defm : X86WriteRes<WriteVecMaskedLoadY, [HWPort23,HWPort5], 9, [1,2], 3>; 410defm : X86WriteRes<WriteVecStore, [HWPort237,HWPort4], 1, [1,1], 2>; 411defm : X86WriteRes<WriteVecStoreX, [HWPort237,HWPort4], 1, [1,1], 2>; 412defm : X86WriteRes<WriteVecStoreY, [HWPort237,HWPort4], 1, [1,1], 2>; 413defm : X86WriteRes<WriteVecStoreNT, [HWPort237,HWPort4], 1, [1,1], 2>; 414defm : X86WriteRes<WriteVecStoreNTY, [HWPort237,HWPort4], 1, [1,1], 2>; 415defm : X86WriteRes<WriteVecMaskedStore32, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 416defm : X86WriteRes<WriteVecMaskedStore32Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 417defm : X86WriteRes<WriteVecMaskedStore64, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 418defm : X86WriteRes<WriteVecMaskedStore64Y, [HWPort0,HWPort4,HWPort237,HWPort15], 5, [1,1,1,1], 4>; 419defm : X86WriteRes<WriteVecMove, [HWPort015], 1, [1], 1>; 420defm : X86WriteRes<WriteVecMoveX, [HWPort015], 1, [1], 1>; 421defm : X86WriteRes<WriteVecMoveY, [HWPort015], 1, [1], 1>; 422defm : X86WriteRes<WriteVecMoveZ, [HWPort015], 1, [1], 1>; // Unsupported = 1 423defm : X86WriteRes<WriteVecMoveToGpr, [HWPort0], 1, [1], 1>; 424defm : X86WriteRes<WriteVecMoveFromGpr, [HWPort5], 1, [1], 1>; 425 426defm : HWWriteResPair<WriteVecLogic, [HWPort015], 1, [1], 1, 5>; 427defm : HWWriteResPair<WriteVecLogicX,[HWPort015], 1, [1], 1, 6>; 428defm : HWWriteResPair<WriteVecLogicY,[HWPort015], 1, [1], 1, 7>; 429defm : HWWriteResPair<WriteVecLogicZ,[HWPort015], 1, [1], 1, 7>; // Unsupported = 1 430defm : HWWriteResPair<WriteVecTest, [HWPort0,HWPort5], 2, [1,1], 2, 6>; 431defm : HWWriteResPair<WriteVecTestY, [HWPort0,HWPort5], 4, [1,1], 2, 7>; 432defm : HWWriteResPair<WriteVecTestZ, [HWPort0,HWPort5], 4, [1,1], 2, 7>; // Unsupported = 1 433defm : HWWriteResPair<WriteVecALU, [HWPort15], 1, [1], 1, 5>; 434defm : HWWriteResPair<WriteVecALUX, [HWPort15], 1, [1], 1, 6>; 435defm : HWWriteResPair<WriteVecALUY, [HWPort15], 1, [1], 1, 7>; 436defm : HWWriteResPair<WriteVecALUZ, [HWPort15], 1, [1], 1, 7>; // Unsupported = 1 437defm : HWWriteResPair<WriteVecIMul, [HWPort0], 5, [1], 1, 5>; 438defm : HWWriteResPair<WriteVecIMulX, [HWPort0], 5, [1], 1, 6>; 439defm : HWWriteResPair<WriteVecIMulY, [HWPort0], 5, [1], 1, 7>; 440defm : HWWriteResPair<WriteVecIMulZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1 441defm : HWWriteResPair<WritePMULLD, [HWPort0], 10, [2], 2, 6>; 442defm : HWWriteResPair<WritePMULLDY, [HWPort0], 10, [2], 2, 7>; 443defm : HWWriteResPair<WritePMULLDZ, [HWPort0], 10, [2], 2, 7>; // Unsupported = 1 444defm : HWWriteResPair<WriteShuffle, [HWPort5], 1, [1], 1, 5>; 445defm : HWWriteResPair<WriteShuffleX, [HWPort5], 1, [1], 1, 6>; 446defm : HWWriteResPair<WriteShuffleY, [HWPort5], 1, [1], 1, 7>; 447defm : HWWriteResPair<WriteShuffleZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 448defm : HWWriteResPair<WriteVarShuffle, [HWPort5], 1, [1], 1, 5>; 449defm : HWWriteResPair<WriteVarShuffleX,[HWPort5], 1, [1], 1, 6>; 450defm : HWWriteResPair<WriteVarShuffleY,[HWPort5], 1, [1], 1, 7>; 451defm : HWWriteResPair<WriteVarShuffleZ,[HWPort5], 1, [1], 1, 7>; // Unsupported = 1 452defm : HWWriteResPair<WriteBlend, [HWPort5], 1, [1], 1, 6>; 453defm : HWWriteResPair<WriteBlendY, [HWPort5], 1, [1], 1, 7>; 454defm : HWWriteResPair<WriteBlendZ, [HWPort5], 1, [1], 1, 7>; // Unsupported = 1 455defm : HWWriteResPair<WriteShuffle256, [HWPort5], 3, [1], 1, 7>; 456defm : HWWriteResPair<WriteVPMOV256, [HWPort5], 3, [1], 1, 7>; 457defm : HWWriteResPair<WriteVarShuffle256, [HWPort5], 3, [1], 1, 7>; 458defm : HWWriteResPair<WriteVarBlend, [HWPort5], 2, [2], 2, 6>; 459defm : HWWriteResPair<WriteVarBlendY, [HWPort5], 2, [2], 2, 7>; 460defm : HWWriteResPair<WriteVarBlendZ, [HWPort5], 2, [2], 2, 7>; // Unsupported = 1 461defm : HWWriteResPair<WriteMPSAD, [HWPort0, HWPort5], 7, [1, 2], 3, 6>; 462defm : HWWriteResPair<WriteMPSADY, [HWPort0, HWPort5], 7, [1, 2], 3, 7>; 463defm : HWWriteResPair<WriteMPSADZ, [HWPort0, HWPort5], 7, [1, 2], 3, 7>; // Unsupported = 1 464defm : HWWriteResPair<WritePSADBW, [HWPort0], 5, [1], 1, 5>; 465defm : HWWriteResPair<WritePSADBWX, [HWPort0], 5, [1], 1, 6>; 466defm : HWWriteResPair<WritePSADBWY, [HWPort0], 5, [1], 1, 7>; 467defm : HWWriteResPair<WritePSADBWZ, [HWPort0], 5, [1], 1, 7>; // Unsupported = 1 468defm : HWWriteResPair<WritePHMINPOS, [HWPort0], 5, [1], 1, 6>; 469 470// Vector integer shifts. 471defm : X86WriteRes<WriteVecShift, [HWPort0], 1, [1], 1>; 472defm : X86WriteRes<WriteVecShiftX, [HWPort0,HWPort5], 2, [1,1], 2>; 473defm : X86WriteRes<WriteVecShiftY, [HWPort0,HWPort5], 4, [1,1], 2>; 474defm : X86WriteRes<WriteVecShiftZ, [HWPort0,HWPort5], 4, [1,1], 2>; // Unsupported = 1 475defm : X86WriteRes<WriteVecShiftLd, [HWPort0,HWPort23], 6, [1,1], 2>; 476defm : X86WriteRes<WriteVecShiftXLd, [HWPort0,HWPort23], 8, [1,1], 2>; 477defm : X86WriteRes<WriteVecShiftYLd, [HWPort0,HWPort23], 8, [1,1], 2>; 478defm : X86WriteRes<WriteVecShiftZLd, [HWPort0,HWPort23], 8, [1,1], 2>; // Unsupported = 1 479 480defm : HWWriteResPair<WriteVecShiftImm, [HWPort0], 1, [1], 1, 5>; 481defm : HWWriteResPair<WriteVecShiftImmX, [HWPort0], 1, [1], 1, 6>; 482defm : HWWriteResPair<WriteVecShiftImmY, [HWPort0], 1, [1], 1, 7>; 483defm : HWWriteResPair<WriteVecShiftImmZ, [HWPort0], 1, [1], 1, 7>; // Unsupported = 1 484defm : HWWriteResPair<WriteVarVecShift, [HWPort0, HWPort5], 3, [2,1], 3, 6>; 485defm : HWWriteResPair<WriteVarVecShiftY, [HWPort0, HWPort5], 3, [2,1], 3, 7>; 486defm : HWWriteResPair<WriteVarVecShiftZ, [HWPort0, HWPort5], 3, [2,1], 3, 7>; // Unsupported = 1 487 488// Vector insert/extract operations. 489def : WriteRes<WriteVecInsert, [HWPort5]> { 490 let Latency = 2; 491 let NumMicroOps = 2; 492 let ReleaseAtCycles = [2]; 493} 494def : WriteRes<WriteVecInsertLd, [HWPort5,HWPort23]> { 495 let Latency = 6; 496 let NumMicroOps = 2; 497} 498def: InstRW<[WriteVecInsertLd], (instregex "(V?)MOV(H|L)(PD|PS)rm")>; 499 500def : WriteRes<WriteVecExtract, [HWPort0,HWPort5]> { 501 let Latency = 2; 502 let NumMicroOps = 2; 503} 504def : WriteRes<WriteVecExtractSt, [HWPort4,HWPort5,HWPort237]> { 505 let Latency = 2; 506 let NumMicroOps = 3; 507} 508 509// String instructions. 510 511// Packed Compare Implicit Length Strings, Return Mask 512def : WriteRes<WritePCmpIStrM, [HWPort0]> { 513 let Latency = 11; 514 let NumMicroOps = 3; 515 let ReleaseAtCycles = [3]; 516} 517def : WriteRes<WritePCmpIStrMLd, [HWPort0, HWPort23]> { 518 let Latency = 17; 519 let NumMicroOps = 4; 520 let ReleaseAtCycles = [3,1]; 521} 522 523// Packed Compare Explicit Length Strings, Return Mask 524def : WriteRes<WritePCmpEStrM, [HWPort0, HWPort5, HWPort015, HWPort0156]> { 525 let Latency = 19; 526 let NumMicroOps = 9; 527 let ReleaseAtCycles = [4,3,1,1]; 528} 529def : WriteRes<WritePCmpEStrMLd, [HWPort0, HWPort5, HWPort23, HWPort015, HWPort0156]> { 530 let Latency = 25; 531 let NumMicroOps = 10; 532 let ReleaseAtCycles = [4,3,1,1,1]; 533} 534 535// Packed Compare Implicit Length Strings, Return Index 536def : WriteRes<WritePCmpIStrI, [HWPort0]> { 537 let Latency = 11; 538 let NumMicroOps = 3; 539 let ReleaseAtCycles = [3]; 540} 541def : WriteRes<WritePCmpIStrILd, [HWPort0, HWPort23]> { 542 let Latency = 17; 543 let NumMicroOps = 4; 544 let ReleaseAtCycles = [3,1]; 545} 546 547// Packed Compare Explicit Length Strings, Return Index 548def : WriteRes<WritePCmpEStrI, [HWPort0, HWPort5, HWPort0156]> { 549 let Latency = 18; 550 let NumMicroOps = 8; 551 let ReleaseAtCycles = [4,3,1]; 552} 553def : WriteRes<WritePCmpEStrILd, [HWPort0, HWPort5, HWPort23, HWPort0156]> { 554 let Latency = 24; 555 let NumMicroOps = 9; 556 let ReleaseAtCycles = [4,3,1,1]; 557} 558 559// MOVMSK Instructions. 560def : WriteRes<WriteFMOVMSK, [HWPort0]> { let Latency = 3; } 561def : WriteRes<WriteVecMOVMSK, [HWPort0]> { let Latency = 3; } 562def : WriteRes<WriteVecMOVMSKY, [HWPort0]> { let Latency = 3; } 563def : WriteRes<WriteMMXMOVMSK, [HWPort0]> { let Latency = 1; } 564 565// AES Instructions. 566def : WriteRes<WriteAESDecEnc, [HWPort5]> { 567 let Latency = 7; 568 let NumMicroOps = 1; 569 let ReleaseAtCycles = [1]; 570} 571def : WriteRes<WriteAESDecEncLd, [HWPort5, HWPort23]> { 572 let Latency = 13; 573 let NumMicroOps = 2; 574 let ReleaseAtCycles = [1,1]; 575} 576 577def : WriteRes<WriteAESIMC, [HWPort5]> { 578 let Latency = 14; 579 let NumMicroOps = 2; 580 let ReleaseAtCycles = [2]; 581} 582def : WriteRes<WriteAESIMCLd, [HWPort5, HWPort23]> { 583 let Latency = 20; 584 let NumMicroOps = 3; 585 let ReleaseAtCycles = [2,1]; 586} 587 588def : WriteRes<WriteAESKeyGen, [HWPort0,HWPort5,HWPort015]> { 589 let Latency = 29; 590 let NumMicroOps = 11; 591 let ReleaseAtCycles = [2,7,2]; 592} 593def : WriteRes<WriteAESKeyGenLd, [HWPort0,HWPort5,HWPort23,HWPort015]> { 594 let Latency = 34; 595 let NumMicroOps = 11; 596 let ReleaseAtCycles = [2,7,1,1]; 597} 598 599// Carry-less multiplication instructions. 600def : WriteRes<WriteCLMul, [HWPort0, HWPort5]> { 601 let Latency = 11; 602 let NumMicroOps = 3; 603 let ReleaseAtCycles = [2,1]; 604} 605def : WriteRes<WriteCLMulLd, [HWPort0, HWPort5, HWPort23]> { 606 let Latency = 17; 607 let NumMicroOps = 4; 608 let ReleaseAtCycles = [2,1,1]; 609} 610 611// Load/store MXCSR. 612def : WriteRes<WriteLDMXCSR, [HWPort0,HWPort23,HWPort0156]> { let Latency = 7; let NumMicroOps = 3; let ReleaseAtCycles = [1,1,1]; } 613def : WriteRes<WriteSTMXCSR, [HWPort4,HWPort5,HWPort237]> { let Latency = 2; let NumMicroOps = 3; let ReleaseAtCycles = [1,1,1]; } 614 615// Catch-all for expensive system instructions. 616def : WriteRes<WriteSystem, [HWPort0156]> { let Latency = 100; } 617 618// Old microcoded instructions that nobody use. 619def : WriteRes<WriteMicrocoded, [HWPort0156]> { let Latency = 100; } 620 621// Fence instructions. 622def : WriteRes<WriteFence, [HWPort23, HWPort4]>; 623 624// Nop, not very useful expect it provides a model for nops! 625def : WriteRes<WriteNop, []>; 626 627//////////////////////////////////////////////////////////////////////////////// 628// Horizontal add/sub instructions. 629//////////////////////////////////////////////////////////////////////////////// 630 631defm : HWWriteResPair<WriteFHAdd, [HWPort1, HWPort5], 5, [1,2], 3, 6>; 632defm : HWWriteResPair<WriteFHAddY, [HWPort1, HWPort5], 5, [1,2], 3, 7>; 633defm : HWWriteResPair<WritePHAdd, [HWPort5, HWPort15], 3, [2,1], 3, 5>; 634defm : HWWriteResPair<WritePHAddX, [HWPort5, HWPort15], 3, [2,1], 3, 6>; 635defm : HWWriteResPair<WritePHAddY, [HWPort5, HWPort15], 3, [2,1], 3, 7>; 636 637//================ Exceptions ================// 638 639//-- Specific Scheduling Models --// 640 641// Starting with P0. 642def HWWriteP0 : SchedWriteRes<[HWPort0]>; 643 644def HWWriteP01 : SchedWriteRes<[HWPort01]>; 645 646def HWWrite2P01 : SchedWriteRes<[HWPort01]> { 647 let NumMicroOps = 2; 648} 649def HWWrite3P01 : SchedWriteRes<[HWPort01]> { 650 let NumMicroOps = 3; 651} 652 653def HWWriteP0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> { 654 let NumMicroOps = 2; 655} 656 657def HWWrite2P0156_P23 : SchedWriteRes<[HWPort0156, HWPort23]> { 658 let NumMicroOps = 3; 659 let ReleaseAtCycles = [2, 1]; 660} 661 662// Starting with P1. 663def HWWriteP1 : SchedWriteRes<[HWPort1]>; 664 665 666def HWWrite2P1 : SchedWriteRes<[HWPort1]> { 667 let NumMicroOps = 2; 668 let ReleaseAtCycles = [2]; 669} 670 671// Notation: 672// - r: register. 673// - mm: 64 bit mmx register. 674// - x = 128 bit xmm register. 675// - (x)mm = mmx or xmm register. 676// - y = 256 bit ymm register. 677// - v = any vector register. 678// - m = memory. 679 680//=== Integer Instructions ===// 681//-- Move instructions --// 682 683// XLAT. 684def HWWriteXLAT : SchedWriteRes<[]> { 685 let Latency = 7; 686 let NumMicroOps = 3; 687} 688def : InstRW<[HWWriteXLAT], (instrs XLAT)>; 689 690// PUSHA. 691def HWWritePushA : SchedWriteRes<[]> { 692 let NumMicroOps = 19; 693} 694def : InstRW<[HWWritePushA], (instregex "PUSHA(16|32)")>; 695 696// POPA. 697def HWWritePopA : SchedWriteRes<[]> { 698 let NumMicroOps = 18; 699} 700def : InstRW<[HWWritePopA], (instregex "POPA(16|32)")>; 701 702//-- Arithmetic instructions --// 703 704// BTR BTS BTC. 705// m,r. 706def HWWriteBTRSCmr : SchedWriteRes<[]> { 707 let NumMicroOps = 11; 708} 709def : SchedAlias<WriteBitTestSetRegRMW, HWWriteBTRSCmr>; 710 711//-- Control transfer instructions --// 712 713// CALL. 714// i. 715def HWWriteRETI : SchedWriteRes<[HWPort23, HWPort6, HWPort015]> { 716 let NumMicroOps = 4; 717 let ReleaseAtCycles = [1, 2, 1]; 718} 719def : InstRW<[HWWriteRETI], (instregex "RETI(16|32|64)", "LRETI(16|32|64)")>; 720 721// BOUND. 722// r,m. 723def HWWriteBOUND : SchedWriteRes<[]> { 724 let NumMicroOps = 15; 725} 726def : InstRW<[HWWriteBOUND], (instregex "BOUNDS(16|32)rm")>; 727 728// INTO. 729def HWWriteINTO : SchedWriteRes<[]> { 730 let NumMicroOps = 4; 731} 732def : InstRW<[HWWriteINTO], (instrs INTO)>; 733 734//-- String instructions --// 735 736// LODSB/W. 737def : InstRW<[HWWrite2P0156_P23], (instregex "LODS(B|W)")>; 738 739// LODSD/Q. 740def : InstRW<[HWWriteP0156_P23], (instregex "LODS(L|Q)")>; 741 742// MOVS. 743def HWWriteMOVS : SchedWriteRes<[HWPort23, HWPort4, HWPort0156]> { 744 let Latency = 4; 745 let NumMicroOps = 5; 746 let ReleaseAtCycles = [2, 1, 2]; 747} 748def : InstRW<[HWWriteMOVS], (instrs MOVSB, MOVSL, MOVSQ, MOVSW)>; 749 750// CMPS. 751def HWWriteCMPS : SchedWriteRes<[HWPort23, HWPort0156]> { 752 let Latency = 4; 753 let NumMicroOps = 5; 754 let ReleaseAtCycles = [2, 3]; 755} 756def : InstRW<[HWWriteCMPS], (instregex "CMPS(B|L|Q|W)")>; 757 758//-- Other --// 759 760// RDPMC.f 761def HWWriteRDPMC : SchedWriteRes<[]> { 762 let NumMicroOps = 34; 763} 764def : InstRW<[HWWriteRDPMC], (instrs RDPMC)>; 765 766// RDRAND. 767def HWWriteRDRAND : SchedWriteRes<[HWPort23, HWPort015]> { 768 let NumMicroOps = 17; 769 let ReleaseAtCycles = [1, 16]; 770} 771def : InstRW<[HWWriteRDRAND], (instrs RDRAND16r, RDRAND32r, RDRAND64r)>; 772 773//=== Floating Point x87 Instructions ===// 774//-- Move instructions --// 775 776// FLD. 777// m80. 778def : InstRW<[HWWriteP01], (instrs LD_Frr)>; 779 780// FBLD. 781// m80. 782def HWWriteFBLD : SchedWriteRes<[]> { 783 let Latency = 47; 784 let NumMicroOps = 43; 785} 786def : InstRW<[HWWriteFBLD], (instrs FBLDm)>; 787 788// FST(P). 789// r. 790def : InstRW<[HWWriteP01], (instregex "ST_(F|FP)rr")>; 791 792// FFREE. 793def : InstRW<[HWWriteP01], (instregex "FFREE")>; 794 795// FNSAVE. 796def HWWriteFNSAVE : SchedWriteRes<[]> { 797 let NumMicroOps = 147; 798} 799def : InstRW<[HWWriteFNSAVE], (instrs FSAVEm)>; 800 801// FRSTOR. 802def HWWriteFRSTOR : SchedWriteRes<[]> { 803 let NumMicroOps = 90; 804} 805def : InstRW<[HWWriteFRSTOR], (instrs FRSTORm)>; 806 807//-- Arithmetic instructions --// 808 809// FCOMPP FUCOMPP. 810// r. 811def : InstRW<[HWWrite2P01], (instrs FCOMPP, UCOM_FPPr)>; 812 813// FCOMI(P) FUCOMI(P). 814// m. 815def : InstRW<[HWWrite3P01], (instrs COM_FIPr, COM_FIr, UCOM_FIPr, UCOM_FIr)>; 816 817// FTST. 818def : InstRW<[HWWriteP1], (instregex "TST_F")>; 819 820// FXAM. 821def : InstRW<[HWWrite2P1], (instrs XAM_F)>; 822 823// FPREM. 824def HWWriteFPREM : SchedWriteRes<[]> { 825 let Latency = 19; 826 let NumMicroOps = 28; 827} 828def : InstRW<[HWWriteFPREM], (instrs FPREM)>; 829 830// FPREM1. 831def HWWriteFPREM1 : SchedWriteRes<[]> { 832 let Latency = 27; 833 let NumMicroOps = 41; 834} 835def : InstRW<[HWWriteFPREM1], (instrs FPREM1)>; 836 837// FRNDINT. 838def HWWriteFRNDINT : SchedWriteRes<[]> { 839 let Latency = 11; 840 let NumMicroOps = 17; 841} 842def : InstRW<[HWWriteFRNDINT], (instrs FRNDINT)>; 843 844//-- Math instructions --// 845 846// FSCALE. 847def HWWriteFSCALE : SchedWriteRes<[]> { 848 let Latency = 75; // 49-125 849 let NumMicroOps = 50; // 25-75 850} 851def : InstRW<[HWWriteFSCALE], (instrs FSCALE)>; 852 853// FXTRACT. 854def HWWriteFXTRACT : SchedWriteRes<[]> { 855 let Latency = 15; 856 let NumMicroOps = 17; 857} 858def : InstRW<[HWWriteFXTRACT], (instrs FXTRACT)>; 859 860//=== Floating Point XMM and YMM Instructions ===// 861 862// Remaining instrs. 863 864def HWWriteResGroup0 : SchedWriteRes<[HWPort23]> { 865 let Latency = 6; 866 let NumMicroOps = 1; 867 let ReleaseAtCycles = [1]; 868} 869def: InstRW<[HWWriteResGroup0], (instrs VBROADCASTSSrm)>; 870def: InstRW<[HWWriteResGroup0], (instregex "(V?)MOVSHDUPrm", 871 "(V?)MOVSLDUPrm", 872 "(V?)MOVDDUPrm", 873 "VPBROADCAST(D|Q)rm")>; 874 875def HWWriteResGroup0_1 : SchedWriteRes<[HWPort23]> { 876 let Latency = 7; 877 let NumMicroOps = 1; 878 let ReleaseAtCycles = [1]; 879} 880def: InstRW<[HWWriteResGroup0_1], (instrs VBROADCASTF128rm, 881 VBROADCASTI128rm, 882 VBROADCASTSDYrm, 883 VBROADCASTSSYrm, 884 VMOVDDUPYrm, 885 VMOVSHDUPYrm, 886 VMOVSLDUPYrm)>; 887def: InstRW<[HWWriteResGroup0_1], (instregex "LD_F(32|64|80)m", 888 "VPBROADCAST(D|Q)Yrm")>; 889 890def HWWriteResGroup1 : SchedWriteRes<[HWPort4,HWPort237]> { 891 let Latency = 1; 892 let NumMicroOps = 2; 893 let ReleaseAtCycles = [1,1]; 894} 895def: InstRW<[HWWriteResGroup1], (instrs FBSTPm, VMPTRSTm)>; 896def: InstRW<[HWWriteResGroup1], (instregex "ST_FP(32|64|80)m")>; 897 898def HWWriteResGroup2 : SchedWriteRes<[HWPort0]> { 899 let Latency = 1; 900 let NumMicroOps = 1; 901 let ReleaseAtCycles = [1]; 902} 903def: InstRW<[HWWriteResGroup2], (instregex "VPSLLVQ(Y?)rr", 904 "VPSRLVQ(Y?)rr")>; 905 906def HWWriteResGroup3 : SchedWriteRes<[HWPort1]> { 907 let Latency = 1; 908 let NumMicroOps = 1; 909 let ReleaseAtCycles = [1]; 910} 911def: InstRW<[HWWriteResGroup3], (instregex "COM(P?)_FST0r", 912 "UCOM_F(P?)r")>; 913 914def HWWriteResGroup4 : SchedWriteRes<[HWPort5]> { 915 let Latency = 1; 916 let NumMicroOps = 1; 917 let ReleaseAtCycles = [1]; 918} 919def: InstRW<[HWWriteResGroup4], (instrs MMX_MOVQ2DQrr)>; 920 921def HWWriteResGroup5 : SchedWriteRes<[HWPort6]> { 922 let Latency = 1; 923 let NumMicroOps = 1; 924 let ReleaseAtCycles = [1]; 925} 926def: InstRW<[HWWriteResGroup5], (instregex "JMP(16|32|64)r")>; 927 928def HWWriteResGroup6 : SchedWriteRes<[HWPort01]> { 929 let Latency = 1; 930 let NumMicroOps = 1; 931 let ReleaseAtCycles = [1]; 932} 933def: InstRW<[HWWriteResGroup6], (instrs FINCSTP, FNOP)>; 934 935def HWWriteResGroup7 : SchedWriteRes<[HWPort06]> { 936 let Latency = 1; 937 let NumMicroOps = 1; 938 let ReleaseAtCycles = [1]; 939} 940def: InstRW<[HWWriteResGroup7], (instrs CDQ, CQO)>; 941 942def HWWriteResGroup8 : SchedWriteRes<[HWPort15]> { 943 let Latency = 1; 944 let NumMicroOps = 1; 945 let ReleaseAtCycles = [1]; 946} 947def: InstRW<[HWWriteResGroup8], (instregex "ANDN(32|64)rr")>; 948 949def HWWriteResGroup9 : SchedWriteRes<[HWPort015]> { 950 let Latency = 1; 951 let NumMicroOps = 1; 952 let ReleaseAtCycles = [1]; 953} 954def: InstRW<[HWWriteResGroup9], (instregex "VPBLENDD(Y?)rri")>; 955 956def HWWriteResGroup10 : SchedWriteRes<[HWPort0156]> { 957 let Latency = 1; 958 let NumMicroOps = 1; 959 let ReleaseAtCycles = [1]; 960} 961def: InstRW<[HWWriteResGroup10], (instrs SGDT64m, 962 SIDT64m, 963 SMSW16m, 964 STRm, 965 SYSCALL)>; 966 967def HWWriteResGroup11_1 : SchedWriteRes<[HWPort0,HWPort23]> { 968 let Latency = 7; 969 let NumMicroOps = 2; 970 let ReleaseAtCycles = [1,1]; 971} 972def: InstRW<[HWWriteResGroup11_1], (instrs VPSLLVQrm, VPSRLVQrm)>; 973 974def HWWriteResGroup11_2 : SchedWriteRes<[HWPort0,HWPort23]> { 975 let Latency = 8; 976 let NumMicroOps = 2; 977 let ReleaseAtCycles = [1,1]; 978} 979def: InstRW<[HWWriteResGroup11_2], (instrs VPSLLVQYrm, VPSRLVQYrm)>; 980 981def HWWriteResGroup12 : SchedWriteRes<[HWPort1,HWPort23]> { 982 let Latency = 8; 983 let NumMicroOps = 2; 984 let ReleaseAtCycles = [1,1]; 985} 986def: InstRW<[HWWriteResGroup12], (instrs MMX_CVTPI2PSrm)>; 987def: InstRW<[HWWriteResGroup12], (instregex "P(DEP|EXT)(32|64)rm")>; 988 989def HWWriteResGroup13 : SchedWriteRes<[HWPort5,HWPort23]> { 990 let Latency = 6; 991 let NumMicroOps = 2; 992 let ReleaseAtCycles = [1,1]; 993} 994def: InstRW<[HWWriteResGroup13], (instregex "(V?)PMOV(SX|ZX)BDrm", 995 "(V?)PMOV(SX|ZX)BQrm", 996 "(V?)PMOV(SX|ZX)BWrm", 997 "(V?)PMOV(SX|ZX)DQrm", 998 "(V?)PMOV(SX|ZX)WDrm", 999 "(V?)PMOV(SX|ZX)WQrm")>; 1000 1001def HWWriteResGroup13_1 : SchedWriteRes<[HWPort5,HWPort23]> { 1002 let Latency = 8; 1003 let NumMicroOps = 2; 1004 let ReleaseAtCycles = [1,1]; 1005} 1006def: InstRW<[HWWriteResGroup13_1], (instrs VPMOVSXBDYrm, 1007 VPMOVSXBQYrm, 1008 VPMOVSXWQYrm)>; 1009 1010def HWWriteResGroup14 : SchedWriteRes<[HWPort6,HWPort23]> { 1011 let Latency = 6; 1012 let NumMicroOps = 2; 1013 let ReleaseAtCycles = [1,1]; 1014} 1015def: InstRW<[HWWriteResGroup14], (instrs FARJMP64m)>; 1016def: InstRW<[HWWriteResGroup14], (instregex "JMP(16|32|64)m")>; 1017 1018def HWWriteResGroup16 : SchedWriteRes<[HWPort23,HWPort15]> { 1019 let Latency = 6; 1020 let NumMicroOps = 2; 1021 let ReleaseAtCycles = [1,1]; 1022} 1023def: InstRW<[HWWriteResGroup16], (instregex "ANDN(32|64)rm", 1024 "MOVBE(16|32|64)rm")>; 1025 1026def HWWriteResGroup17 : SchedWriteRes<[HWPort23,HWPort015]> { 1027 let Latency = 7; 1028 let NumMicroOps = 2; 1029 let ReleaseAtCycles = [1,1]; 1030} 1031def: InstRW<[HWWriteResGroup17], (instrs VINSERTF128rm, 1032 VINSERTI128rm, 1033 VPBLENDDrmi)>; 1034 1035def HWWriteResGroup17_2 : SchedWriteRes<[HWPort23,HWPort015]> { 1036 let Latency = 8; 1037 let NumMicroOps = 2; 1038 let ReleaseAtCycles = [1,1]; 1039} 1040def: InstRW<[HWWriteResGroup17_2], (instrs VPBLENDDYrmi)>; 1041 1042def HWWriteResGroup18 : SchedWriteRes<[HWPort23,HWPort0156]> { 1043 let Latency = 6; 1044 let NumMicroOps = 2; 1045 let ReleaseAtCycles = [1,1]; 1046} 1047def: InstRW<[HWWriteResGroup18], (instrs POP16r, POP32r, POP64r)>; 1048def: InstRW<[HWWriteResGroup18], (instregex "POP(16|32|64)rmr")>; 1049 1050def HWWriteResGroup19 : SchedWriteRes<[HWPort237,HWPort0156]> { 1051 let Latency = 2; 1052 let NumMicroOps = 2; 1053 let ReleaseAtCycles = [1,1]; 1054} 1055def: InstRW<[HWWriteResGroup19], (instrs SFENCE)>; 1056 1057def HWWriteResGroup21 : SchedWriteRes<[HWPort4,HWPort6,HWPort237]> { 1058 let Latency = 2; 1059 let NumMicroOps = 3; 1060 let ReleaseAtCycles = [1,1,1]; 1061} 1062def: InstRW<[HWWriteResGroup21], (instrs FNSTCW16m)>; 1063 1064def HWWriteResGroup23 : SchedWriteRes<[HWPort4,HWPort237,HWPort15]> { 1065 let Latency = 2; 1066 let NumMicroOps = 3; 1067 let ReleaseAtCycles = [1,1,1]; 1068} 1069def: InstRW<[HWWriteResGroup23], (instregex "MOVBE(32|64)mr")>; 1070 1071def HWWriteResGroup23_16 : SchedWriteRes<[HWPort06, HWPort237, HWPort4]> { 1072 let Latency = 2; 1073 let NumMicroOps = 3; 1074 let ReleaseAtCycles = [1,1,1]; 1075} 1076def: InstRW<[HWWriteResGroup23_16], (instrs MOVBE16mr)>; 1077 1078def HWWriteResGroup24 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> { 1079 let Latency = 2; 1080 let NumMicroOps = 3; 1081 let ReleaseAtCycles = [1,1,1]; 1082} 1083def: InstRW<[HWWriteResGroup24], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8, 1084 STOSB, STOSL, STOSQ, STOSW)>; 1085def: InstRW<[HWWriteResGroup24], (instregex "PUSH(16|32|64)rmr")>; 1086 1087def HWWriteResGroup25 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> { 1088 let Latency = 7; 1089 let NumMicroOps = 4; 1090 let ReleaseAtCycles = [1,1,1,1]; 1091} 1092def: InstRW<[HWWriteResGroup25], (instregex "SAR(8|16|32|64)m(1|i)", 1093 "SHL(8|16|32|64)m(1|i)", 1094 "SHR(8|16|32|64)m(1|i)")>; 1095 1096def HWWriteResGroup26 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1097 let Latency = 7; 1098 let NumMicroOps = 4; 1099 let ReleaseAtCycles = [1,1,1,1]; 1100} 1101def: InstRW<[HWWriteResGroup26], (instregex "POP(16|32|64)rmm", 1102 "PUSH(16|32|64)rmm")>; 1103 1104def HWWriteResGroup28 : SchedWriteRes<[HWPort01]> { 1105 let Latency = 2; 1106 let NumMicroOps = 2; 1107 let ReleaseAtCycles = [2]; 1108} 1109def: InstRW<[HWWriteResGroup28], (instrs FDECSTP)>; 1110 1111def HWWriteResGroup30 : SchedWriteRes<[HWPort0156]> { 1112 let Latency = 2; 1113 let NumMicroOps = 2; 1114 let ReleaseAtCycles = [2]; 1115} 1116def: InstRW<[HWWriteResGroup30], (instrs LFENCE, 1117 MFENCE, 1118 WAIT, 1119 XGETBV)>; 1120 1121def HWWriteResGroup32 : SchedWriteRes<[HWPort6,HWPort0156]> { 1122 let Latency = 2; 1123 let NumMicroOps = 2; 1124 let ReleaseAtCycles = [1,1]; 1125} 1126def: InstRW<[HWWriteResGroup32], (instregex "CLFLUSH")>; 1127 1128def HWWriteResGroup33 : SchedWriteRes<[HWPort01,HWPort015]> { 1129 let Latency = 2; 1130 let NumMicroOps = 2; 1131 let ReleaseAtCycles = [1,1]; 1132} 1133def: InstRW<[HWWriteResGroup33], (instrs MMX_MOVDQ2Qrr)>; 1134 1135def HWWriteResGroup35 : SchedWriteRes<[HWPort06,HWPort0156]> { 1136 let Latency = 2; 1137 let NumMicroOps = 2; 1138 let ReleaseAtCycles = [1,1]; 1139} 1140def: InstRW<[HWWriteResGroup35], (instrs CWD, JCXZ, JECXZ, JRCXZ)>; 1141 1142def HWWriteResGroup36_2 : SchedWriteRes<[HWPort5,HWPort23]> { 1143 let Latency = 7; 1144 let NumMicroOps = 3; 1145 let ReleaseAtCycles = [2,1]; 1146} 1147def: InstRW<[HWWriteResGroup36_2], (instrs MMX_PACKSSDWrm, 1148 MMX_PACKSSWBrm, 1149 MMX_PACKUSWBrm)>; 1150 1151def HWWriteResGroup37 : SchedWriteRes<[HWPort23,HWPort0156]> { 1152 let Latency = 7; 1153 let NumMicroOps = 3; 1154 let ReleaseAtCycles = [1,2]; 1155} 1156def: InstRW<[HWWriteResGroup37], (instrs LEAVE, LEAVE64, 1157 SCASB, SCASL, SCASQ, SCASW)>; 1158 1159def HWWriteResGroup39 : SchedWriteRes<[HWPort0,HWPort01,HWPort23]> { 1160 let Latency = 7; 1161 let NumMicroOps = 3; 1162 let ReleaseAtCycles = [1,1,1]; 1163} 1164def: InstRW<[HWWriteResGroup39], (instrs FLDCW16m)>; 1165 1166def HWWriteResGroup41 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> { 1167 let Latency = 7; 1168 let NumMicroOps = 3; 1169 let ReleaseAtCycles = [1,1,1]; 1170} 1171def: InstRW<[HWWriteResGroup41], (instrs LRET64, RET32, RET64)>; 1172 1173def HWWriteResGroup44 : SchedWriteRes<[HWPort4,HWPort6,HWPort237,HWPort0156]> { 1174 let Latency = 3; 1175 let NumMicroOps = 4; 1176 let ReleaseAtCycles = [1,1,1,1]; 1177} 1178def: InstRW<[HWWriteResGroup44], (instregex "CALL(16|32|64)r")>; 1179 1180def HWWriteResGroup45 : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> { 1181 let Latency = 3; 1182 let NumMicroOps = 4; 1183 let ReleaseAtCycles = [1,1,1,1]; 1184} 1185def: InstRW<[HWWriteResGroup45], (instrs CALL64pcrel32)>; 1186 1187def HWWriteResGroup46 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06]> { 1188 let Latency = 8; 1189 let NumMicroOps = 5; 1190 let ReleaseAtCycles = [1,1,1,2]; 1191} 1192def: InstRW<[HWWriteResGroup46], (instregex "ROL(8|16|32|64)m(1|i)", 1193 "ROR(8|16|32|64)m(1|i)")>; 1194 1195def HWWriteResGroup46_1 : SchedWriteRes<[HWPort06]> { 1196 let Latency = 2; 1197 let NumMicroOps = 2; 1198 let ReleaseAtCycles = [2]; 1199} 1200def: InstRW<[HWWriteResGroup46_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1, 1201 ROR8r1, ROR16r1, ROR32r1, ROR64r1)>; 1202 1203def HWWriteResGroup47 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1204 let Latency = 8; 1205 let NumMicroOps = 5; 1206 let ReleaseAtCycles = [1,1,1,2]; 1207} 1208def: InstRW<[HWWriteResGroup47], (instregex "XADD(8|16|32|64)rm")>; 1209 1210def HWWriteResGroup48 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1211 let Latency = 8; 1212 let NumMicroOps = 5; 1213 let ReleaseAtCycles = [1,1,1,1,1]; 1214} 1215def: InstRW<[HWWriteResGroup48], (instregex "CALL(16|32|64)m")>; 1216def: InstRW<[HWWriteResGroup48], (instrs FARCALL64m)>; 1217 1218def HWWriteResGroup50 : SchedWriteRes<[HWPort1]> { 1219 let Latency = 3; 1220 let NumMicroOps = 1; 1221 let ReleaseAtCycles = [1]; 1222} 1223def: InstRW<[HWWriteResGroup50], (instregex "P(DEP|EXT)(32|64)rr")>; 1224 1225def HWWriteResGroup51 : SchedWriteRes<[HWPort5]> { 1226 let Latency = 3; 1227 let NumMicroOps = 1; 1228 let ReleaseAtCycles = [1]; 1229} 1230def: InstRW<[HWWriteResGroup51], (instregex "VPBROADCAST(B|W)rr")>; 1231 1232def HWWriteResGroup52_1 : SchedWriteRes<[HWPort1,HWPort23]> { 1233 let Latency = 10; 1234 let NumMicroOps = 2; 1235 let ReleaseAtCycles = [1,1]; 1236} 1237def: InstRW<[HWWriteResGroup52_1], (instregex "(ADD|SUB|SUBR)_F(32|64)m", 1238 "ILD_F(16|32|64)m")>; 1239 1240def HWWriteResGroup53_1 : SchedWriteRes<[HWPort5,HWPort23]> { 1241 let Latency = 9; 1242 let NumMicroOps = 2; 1243 let ReleaseAtCycles = [1,1]; 1244} 1245def: InstRW<[HWWriteResGroup53_1], (instrs VPMOVSXBWYrm, 1246 VPMOVSXDQYrm, 1247 VPMOVSXWDYrm, 1248 VPMOVZXWDYrm)>; 1249 1250def HWWriteResGroup57 : SchedWriteRes<[HWPort5,HWPort0156]> { 1251 let Latency = 3; 1252 let NumMicroOps = 3; 1253 let ReleaseAtCycles = [2,1]; 1254} 1255def: InstRW<[HWWriteResGroup57], (instrs MMX_PACKSSDWrr, 1256 MMX_PACKSSWBrr, 1257 MMX_PACKUSWBrr)>; 1258 1259def HWWriteResGroup58 : SchedWriteRes<[HWPort6,HWPort0156]> { 1260 let Latency = 3; 1261 let NumMicroOps = 3; 1262 let ReleaseAtCycles = [1,2]; 1263} 1264def: InstRW<[HWWriteResGroup58], (instregex "CLD")>; 1265 1266def HWWriteResGroup59 : SchedWriteRes<[HWPort06,HWPort0156]> { 1267 let Latency = 2; 1268 let NumMicroOps = 3; 1269 let ReleaseAtCycles = [1,2]; 1270} 1271def: InstRW<[HWWriteResGroup59], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1, 1272 RCR8r1, RCR16r1, RCR32r1, RCR64r1)>; 1273 1274def HWWriteResGroup60 : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1275 let Latency = 5; 1276 let NumMicroOps = 8; 1277 let ReleaseAtCycles = [2,4,2]; 1278} 1279def: InstRW<[HWWriteResGroup60], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>; 1280 1281def HWWriteResGroup60b : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1282 let Latency = 6; 1283 let NumMicroOps = 8; 1284 let ReleaseAtCycles = [2,4,2]; 1285} 1286def: InstRW<[HWWriteResGroup60b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>; 1287 1288def HWWriteResGroup61 : SchedWriteRes<[HWPort0,HWPort4,HWPort237]> { 1289 let Latency = 4; 1290 let NumMicroOps = 3; 1291 let ReleaseAtCycles = [1,1,1]; 1292} 1293def: InstRW<[HWWriteResGroup61], (instrs FNSTSWm)>; 1294 1295def HWWriteResGroup62 : SchedWriteRes<[HWPort1,HWPort4,HWPort237]> { 1296 let Latency = 4; 1297 let NumMicroOps = 3; 1298 let ReleaseAtCycles = [1,1,1]; 1299} 1300def: InstRW<[HWWriteResGroup62], (instregex "IST(T?)_FP(16|32|64)m", 1301 "IST_F(16|32)m")>; 1302 1303def HWWriteResGroup66 : SchedWriteRes<[HWPort23,HWPort237,HWPort06,HWPort0156]> { 1304 let Latency = 9; 1305 let NumMicroOps = 5; 1306 let ReleaseAtCycles = [1,1,1,2]; 1307} 1308def: InstRW<[HWWriteResGroup66], (instregex "RCL(8|16|32|64)m(1|i)", 1309 "RCR(8|16|32|64)m(1|i)")>; 1310 1311def HWWriteResGroup68 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort0156]> { 1312 let Latency = 9; 1313 let NumMicroOps = 6; 1314 let ReleaseAtCycles = [1,1,1,3]; 1315} 1316def: InstRW<[HWWriteResGroup68], (instregex "XCHG(8|16|32|64)rm")>; 1317 1318def HWWriteResGroup69 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1319 let Latency = 9; 1320 let NumMicroOps = 6; 1321 let ReleaseAtCycles = [1,1,1,2,1]; 1322} 1323def: InstRW<[HWWriteResGroup69], (instregex "ROL(8|16|32|64)mCL", 1324 "ROR(8|16|32|64)mCL", 1325 "SAR(8|16|32|64)mCL", 1326 "SHL(8|16|32|64)mCL", 1327 "SHR(8|16|32|64)mCL")>; 1328def: SchedAlias<WriteADCRMW, HWWriteResGroup69>; 1329 1330def HWWriteResGroup72 : SchedWriteRes<[HWPort0,HWPort0156]> { 1331 let Latency = 4; 1332 let NumMicroOps = 2; 1333 let ReleaseAtCycles = [1,1]; 1334} 1335def: InstRW<[HWWriteResGroup72], (instrs FNSTSW16r)>; 1336 1337def HWWriteResGroup73 : SchedWriteRes<[HWPort1,HWPort5]> { 1338 let Latency = 4; 1339 let NumMicroOps = 2; 1340 let ReleaseAtCycles = [1,1]; 1341} 1342def: InstRW<[HWWriteResGroup73], (instrs MMX_CVTPS2PIrr, 1343 MMX_CVTTPS2PIrr)>; 1344 1345def HWWriteResGroup75 : SchedWriteRes<[HWPort1,HWPort23]> { 1346 let Latency = 11; 1347 let NumMicroOps = 3; 1348 let ReleaseAtCycles = [2,1]; 1349} 1350def: InstRW<[HWWriteResGroup75], (instregex "FICOM(P?)(16|32)m")>; 1351 1352def HWWriteResGroup78_1 : SchedWriteRes<[HWPort1,HWPort5,HWPort23]> { 1353 let Latency = 9; 1354 let NumMicroOps = 3; 1355 let ReleaseAtCycles = [1,1,1]; 1356} 1357def: InstRW<[HWWriteResGroup78_1], (instrs MMX_CVTPI2PDrm)>; 1358 1359def HWWriteResGroup80 : SchedWriteRes<[HWPort5,HWPort23,HWPort015]> { 1360 let Latency = 9; 1361 let NumMicroOps = 3; 1362 let ReleaseAtCycles = [1,1,1]; 1363} 1364def: InstRW<[HWWriteResGroup80], (instregex "VPBROADCAST(B|W)(Y?)rm")>; 1365 1366def HWWriteResGroup81 : SchedWriteRes<[HWPort0156]> { 1367 let Latency = 4; 1368 let NumMicroOps = 4; 1369 let ReleaseAtCycles = [4]; 1370} 1371def: InstRW<[HWWriteResGroup81], (instrs FNCLEX)>; 1372 1373def HWWriteResGroup82 : SchedWriteRes<[]> { 1374 let Latency = 0; 1375 let NumMicroOps = 4; 1376 let ReleaseAtCycles = []; 1377} 1378def: InstRW<[HWWriteResGroup82], (instrs VZEROUPPER)>; 1379 1380def HWWriteResGroup83 : SchedWriteRes<[HWPort1,HWPort6,HWPort0156]> { 1381 let Latency = 4; 1382 let NumMicroOps = 4; 1383 let ReleaseAtCycles = [1,1,2]; 1384} 1385def: InstRW<[HWWriteResGroup83], (instregex "LAR(16|32|64)rr")>; 1386 1387def HWWriteResGroup87 : SchedWriteRes<[HWPort1,HWPort6,HWPort23,HWPort0156]> { 1388 let Latency = 9; 1389 let NumMicroOps = 5; 1390 let ReleaseAtCycles = [1,2,1,1]; 1391} 1392def: InstRW<[HWWriteResGroup87], (instregex "LAR(16|32|64)rm", 1393 "LSL(16|32|64)rm")>; 1394 1395def HWWriteResGroup88 : SchedWriteRes<[HWPort4,HWPort237,HWPort0156]> { 1396 let Latency = 5; 1397 let NumMicroOps = 6; 1398 let ReleaseAtCycles = [1,1,4]; 1399} 1400def: InstRW<[HWWriteResGroup88], (instregex "PUSHF(16|64)")>; 1401 1402def HWWriteResGroup89 : SchedWriteRes<[HWPort0]> { 1403 let Latency = 5; 1404 let NumMicroOps = 1; 1405 let ReleaseAtCycles = [1]; 1406} 1407def: InstRW<[HWWriteResGroup89], (instregex "MUL_(FPrST0|FST0r|FrST0)")>; 1408 1409def HWWriteResGroup91_2 : SchedWriteRes<[HWPort0,HWPort23]> { 1410 let Latency = 11; 1411 let NumMicroOps = 2; 1412 let ReleaseAtCycles = [1,1]; 1413} 1414def: InstRW<[HWWriteResGroup91_2], (instregex "(V?)PCMPGTQrm")>; 1415 1416def HWWriteResGroup91_3 : SchedWriteRes<[HWPort0,HWPort23]> { 1417 let Latency = 12; 1418 let NumMicroOps = 2; 1419 let ReleaseAtCycles = [1,1]; 1420} 1421def: InstRW<[HWWriteResGroup91_3], (instregex "MUL_F(32|64)m")>; 1422def: InstRW<[HWWriteResGroup91_3], (instrs VPCMPGTQYrm)>; 1423 1424def HWWriteResGroup93 : SchedWriteRes<[HWPort1,HWPort5]> { 1425 let Latency = 5; 1426 let NumMicroOps = 3; 1427 let ReleaseAtCycles = [1,2]; 1428} 1429def: InstRW<[HWWriteResGroup93], (instregex "(V?)CVTSI642SSrr")>; 1430 1431def HWWriteResGroup94 : SchedWriteRes<[HWPort1,HWPort6,HWPort06]> { 1432 let Latency = 5; 1433 let NumMicroOps = 3; 1434 let ReleaseAtCycles = [1,1,1]; 1435} 1436def: InstRW<[HWWriteResGroup94], (instregex "STR(16|32|64)r")>; 1437 1438def HWWriteResGroup99 : SchedWriteRes<[HWPort6,HWPort0156]> { 1439 let Latency = 5; 1440 let NumMicroOps = 5; 1441 let ReleaseAtCycles = [1,4]; 1442} 1443def: InstRW<[HWWriteResGroup99], (instrs PAUSE)>; 1444 1445def HWWriteResGroup100 : SchedWriteRes<[HWPort06,HWPort0156]> { 1446 let Latency = 5; 1447 let NumMicroOps = 5; 1448 let ReleaseAtCycles = [1,4]; 1449} 1450def: InstRW<[HWWriteResGroup100], (instrs XSETBV)>; 1451 1452def HWWriteResGroup103 : SchedWriteRes<[HWPort1,HWPort23]> { 1453 let Latency = 13; 1454 let NumMicroOps = 3; 1455 let ReleaseAtCycles = [2,1]; 1456} 1457def: InstRW<[HWWriteResGroup103], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>; 1458 1459def HWWriteResGroup107 : SchedWriteRes<[HWPort1,HWPort6,HWPort06,HWPort0156]> { 1460 let Latency = 6; 1461 let NumMicroOps = 4; 1462 let ReleaseAtCycles = [1,1,1,1]; 1463} 1464def: InstRW<[HWWriteResGroup107], (instregex "SLDT(16|32|64)r")>; 1465 1466def HWWriteResGroup108 : SchedWriteRes<[HWPort6,HWPort0156]> { 1467 let Latency = 6; 1468 let NumMicroOps = 6; 1469 let ReleaseAtCycles = [1,5]; 1470} 1471def: InstRW<[HWWriteResGroup108], (instrs STD)>; 1472 1473def HWWriteResGroup114 : SchedWriteRes<[HWPort6,HWPort06,HWPort15,HWPort0156]> { 1474 let Latency = 7; 1475 let NumMicroOps = 7; 1476 let ReleaseAtCycles = [2,2,1,2]; 1477} 1478def: InstRW<[HWWriteResGroup114], (instrs LOOP)>; 1479 1480def HWWriteResGroup115 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1481 let Latency = 15; 1482 let NumMicroOps = 3; 1483 let ReleaseAtCycles = [1,1,1]; 1484} 1485def: InstRW<[HWWriteResGroup115], (instregex "MUL_FI(16|32)m")>; 1486 1487def HWWriteResGroup120 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1488 let Latency = 16; 1489 let NumMicroOps = 10; 1490 let ReleaseAtCycles = [1,1,1,4,1,2]; 1491} 1492def: InstRW<[HWWriteResGroup120], (instregex "RCL(8|16|32|64)mCL")>; 1493 1494def HWWriteResGroup129 : SchedWriteRes<[HWPort1,HWPort06,HWPort0156]> { 1495 let Latency = 11; 1496 let NumMicroOps = 7; 1497 let ReleaseAtCycles = [2,2,3]; 1498} 1499def: InstRW<[HWWriteResGroup129], (instregex "RCL(16|32|64)rCL", 1500 "RCR(16|32|64)rCL")>; 1501 1502def HWWriteResGroup130 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> { 1503 let Latency = 11; 1504 let NumMicroOps = 9; 1505 let ReleaseAtCycles = [1,4,1,3]; 1506} 1507def: InstRW<[HWWriteResGroup130], (instrs RCL8rCL)>; 1508 1509def HWWriteResGroup131 : SchedWriteRes<[HWPort06,HWPort0156]> { 1510 let Latency = 11; 1511 let NumMicroOps = 11; 1512 let ReleaseAtCycles = [2,9]; 1513} 1514def: InstRW<[HWWriteResGroup131], (instrs LOOPE, LOOPNE)>; 1515 1516def HWWriteResGroup132 : SchedWriteRes<[HWPort4,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1517 let Latency = 17; 1518 let NumMicroOps = 14; 1519 let ReleaseAtCycles = [1,1,1,4,2,5]; 1520} 1521def: InstRW<[HWWriteResGroup132], (instrs CMPXCHG8B)>; 1522 1523def HWWriteResGroup135 : SchedWriteRes<[HWPort1,HWPort23,HWPort237,HWPort06,HWPort15,HWPort0156]> { 1524 let Latency = 19; 1525 let NumMicroOps = 11; 1526 let ReleaseAtCycles = [2,1,1,3,1,3]; 1527} 1528def: InstRW<[HWWriteResGroup135], (instregex "RCR(8|16|32|64)mCL")>; 1529 1530def HWWriteResGroup142 : SchedWriteRes<[HWPort1,HWPort06,HWPort15,HWPort0156]> { 1531 let Latency = 14; 1532 let NumMicroOps = 10; 1533 let ReleaseAtCycles = [2,3,1,4]; 1534} 1535def: InstRW<[HWWriteResGroup142], (instrs RCR8rCL)>; 1536 1537def HWWriteResGroup143 : SchedWriteRes<[HWPort23,HWPort0156]> { 1538 let Latency = 19; 1539 let NumMicroOps = 15; 1540 let ReleaseAtCycles = [1,14]; 1541} 1542def: InstRW<[HWWriteResGroup143], (instrs POPF16)>; 1543 1544def HWWriteResGroup144 : SchedWriteRes<[HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1545 let Latency = 21; 1546 let NumMicroOps = 8; 1547 let ReleaseAtCycles = [1,1,1,1,1,1,2]; 1548} 1549def: InstRW<[HWWriteResGroup144], (instrs INSB, INSL, INSW)>; 1550 1551def HWWriteResGroup145 : SchedWriteRes<[HWPort5, HWPort6]> { 1552 let Latency = 8; 1553 let NumMicroOps = 20; 1554 let ReleaseAtCycles = [1,1]; 1555} 1556def: InstRW<[HWWriteResGroup145], (instrs VZEROALL)>; 1557 1558def HWWriteResGroup146 : SchedWriteRes<[HWPort0,HWPort4,HWPort5,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1559 let Latency = 22; 1560 let NumMicroOps = 19; 1561 let ReleaseAtCycles = [2,1,4,1,1,4,6]; 1562} 1563def: InstRW<[HWWriteResGroup146], (instrs CMPXCHG16B)>; 1564 1565def HWWriteResGroup147 : SchedWriteRes<[HWPort0,HWPort1,HWPort5,HWPort6,HWPort01,HWPort0156]> { 1566 let Latency = 17; 1567 let NumMicroOps = 15; 1568 let ReleaseAtCycles = [2,1,2,4,2,4]; 1569} 1570def: InstRW<[HWWriteResGroup147], (instrs XCH_F)>; 1571 1572def HWWriteResGroup149 : SchedWriteRes<[HWPort5,HWPort6,HWPort06,HWPort0156]> { 1573 let Latency = 18; 1574 let NumMicroOps = 8; 1575 let ReleaseAtCycles = [1,1,1,5]; 1576} 1577def: InstRW<[HWWriteResGroup149], (instrs CPUID, RDTSC)>; 1578 1579def HWWriteResGroup151 : SchedWriteRes<[HWPort6,HWPort23,HWPort0156]> { 1580 let Latency = 23; 1581 let NumMicroOps = 19; 1582 let ReleaseAtCycles = [3,1,15]; 1583} 1584def: InstRW<[HWWriteResGroup151], (instregex "XRSTOR(64)?")>; 1585 1586def HWWriteResGroup154 : SchedWriteRes<[HWPort0]> { 1587 let Latency = 20; 1588 let NumMicroOps = 1; 1589 let ReleaseAtCycles = [1]; 1590} 1591def: InstRW<[HWWriteResGroup154], (instregex "DIV_(FPrST0|FST0r|FrST0)")>; 1592 1593def HWWriteResGroup155 : SchedWriteRes<[HWPort0,HWPort23]> { 1594 let Latency = 27; 1595 let NumMicroOps = 2; 1596 let ReleaseAtCycles = [1,1]; 1597} 1598def: InstRW<[HWWriteResGroup155], (instregex "DIVR_F(32|64)m")>; 1599 1600def HWWriteResGroup156 : SchedWriteRes<[HWPort5,HWPort6,HWPort0156]> { 1601 let Latency = 20; 1602 let NumMicroOps = 10; 1603 let ReleaseAtCycles = [1,2,7]; 1604} 1605def: InstRW<[HWWriteResGroup156], (instrs MWAITrr)>; 1606 1607def HWWriteResGroup161 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1608 let Latency = 30; 1609 let NumMicroOps = 3; 1610 let ReleaseAtCycles = [1,1,1]; 1611} 1612def: InstRW<[HWWriteResGroup161], (instregex "DIVR_FI(16|32)m")>; 1613 1614def HWWriteResGroup162 : SchedWriteRes<[HWPort0]> { 1615 let Latency = 24; 1616 let NumMicroOps = 1; 1617 let ReleaseAtCycles = [1]; 1618} 1619def: InstRW<[HWWriteResGroup162], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>; 1620 1621def HWWriteResGroup163 : SchedWriteRes<[HWPort0,HWPort23]> { 1622 let Latency = 31; 1623 let NumMicroOps = 2; 1624 let ReleaseAtCycles = [1,1]; 1625} 1626def: InstRW<[HWWriteResGroup163], (instregex "DIV_F(32|64)m")>; 1627 1628def HWWriteResGroup164 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1629 let Latency = 30; 1630 let NumMicroOps = 27; 1631 let ReleaseAtCycles = [1,5,1,1,19]; 1632} 1633def: InstRW<[HWWriteResGroup164], (instrs XSAVE64)>; 1634 1635def HWWriteResGroup165 : SchedWriteRes<[HWPort4,HWPort6,HWPort23,HWPort237,HWPort0156]> { 1636 let Latency = 31; 1637 let NumMicroOps = 28; 1638 let ReleaseAtCycles = [1,6,1,1,19]; 1639} 1640def: InstRW<[HWWriteResGroup165], (instrs XSAVE)>; 1641def: InstRW<[HWWriteResGroup165], (instregex "XSAVEC", "XSAVES", "XSAVEOPT")>; 1642 1643def HWWriteResGroup166 : SchedWriteRes<[HWPort0,HWPort1,HWPort23]> { 1644 let Latency = 34; 1645 let NumMicroOps = 3; 1646 let ReleaseAtCycles = [1,1,1]; 1647} 1648def: InstRW<[HWWriteResGroup166], (instregex "DIV_FI(16|32)m")>; 1649 1650def HWWriteResGroup170 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort06,HWPort0156]> { 1651 let Latency = 35; 1652 let NumMicroOps = 23; 1653 let ReleaseAtCycles = [1,5,3,4,10]; 1654} 1655def: InstRW<[HWWriteResGroup170], (instregex "IN(8|16|32)ri", 1656 "IN(8|16|32)rr")>; 1657 1658def HWWriteResGroup171 : SchedWriteRes<[HWPort5,HWPort6,HWPort23,HWPort237,HWPort06,HWPort0156]> { 1659 let Latency = 36; 1660 let NumMicroOps = 23; 1661 let ReleaseAtCycles = [1,5,2,1,4,10]; 1662} 1663def: InstRW<[HWWriteResGroup171], (instregex "OUT(8|16|32)ir", 1664 "OUT(8|16|32)rr")>; 1665 1666def HWWriteResGroup175 : SchedWriteRes<[HWPort1,HWPort4,HWPort5,HWPort6,HWPort23,HWPort237,HWPort15,HWPort0156]> { 1667 let Latency = 41; 1668 let NumMicroOps = 18; 1669 let ReleaseAtCycles = [1,1,2,3,1,1,1,8]; 1670} 1671def: InstRW<[HWWriteResGroup175], (instrs VMCLEARm)>; 1672 1673def HWWriteResGroup176 : SchedWriteRes<[HWPort5,HWPort0156]> { 1674 let Latency = 42; 1675 let NumMicroOps = 22; 1676 let ReleaseAtCycles = [2,20]; 1677} 1678def: InstRW<[HWWriteResGroup176], (instrs RDTSCP)>; 1679 1680def HWWriteResGroup177 : SchedWriteRes<[HWPort0,HWPort01,HWPort23,HWPort05,HWPort06,HWPort015,HWPort0156]> { 1681 let Latency = 61; 1682 let NumMicroOps = 64; 1683 let ReleaseAtCycles = [2,2,8,1,10,2,39]; 1684} 1685def: InstRW<[HWWriteResGroup177], (instrs FLDENVm)>; 1686 1687def HWWriteResGroup178 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> { 1688 let Latency = 64; 1689 let NumMicroOps = 88; 1690 let ReleaseAtCycles = [4,4,31,1,2,1,45]; 1691} 1692def: InstRW<[HWWriteResGroup178], (instrs FXRSTOR64)>; 1693 1694def HWWriteResGroup179 : SchedWriteRes<[HWPort0,HWPort6,HWPort23,HWPort05,HWPort06,HWPort15,HWPort0156]> { 1695 let Latency = 64; 1696 let NumMicroOps = 90; 1697 let ReleaseAtCycles = [4,2,33,1,2,1,47]; 1698} 1699def: InstRW<[HWWriteResGroup179], (instrs FXRSTOR)>; 1700 1701def HWWriteResGroup180 : SchedWriteRes<[HWPort5,HWPort01,HWPort0156]> { 1702 let Latency = 75; 1703 let NumMicroOps = 15; 1704 let ReleaseAtCycles = [6,3,6]; 1705} 1706def: InstRW<[HWWriteResGroup180], (instrs FNINIT)>; 1707 1708def HWWriteResGroup183 : SchedWriteRes<[HWPort0,HWPort1,HWPort4,HWPort5,HWPort6,HWPort237,HWPort06,HWPort0156]> { 1709 let Latency = 115; 1710 let NumMicroOps = 100; 1711 let ReleaseAtCycles = [9,9,11,8,1,11,21,30]; 1712} 1713def: InstRW<[HWWriteResGroup183], (instrs FSTENVm)>; 1714 1715def HWWriteResGroup184 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1716 let Latency = 14; 1717 let NumMicroOps = 12; 1718 let ReleaseAtCycles = [2,2,2,1,3,2]; 1719} 1720def: InstRW<[HWWriteResGroup184], (instrs VGATHERDPDrm, VPGATHERDQrm)>; 1721 1722def HWWriteResGroup185 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1723 let Latency = 17; 1724 let NumMicroOps = 20; 1725 let ReleaseAtCycles = [3,3,4,1,5,4]; 1726} 1727def: InstRW<[HWWriteResGroup185], (instrs VGATHERDPDYrm, VPGATHERDQYrm)>; 1728 1729def HWWriteResGroup186 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1730 let Latency = 16; 1731 let NumMicroOps = 20; 1732 let ReleaseAtCycles = [3,3,4,1,5,4]; 1733} 1734def: InstRW<[HWWriteResGroup186], (instrs VGATHERDPSrm, VPGATHERDDrm)>; 1735 1736def HWWriteResGroup187 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1737 let Latency = 22; 1738 let NumMicroOps = 34; 1739 let ReleaseAtCycles = [5,3,8,1,9,8]; 1740} 1741def: InstRW<[HWWriteResGroup187], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>; 1742 1743def HWWriteResGroup188 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1744 let Latency = 15; 1745 let NumMicroOps = 14; 1746 let ReleaseAtCycles = [3,3,2,1,3,2]; 1747} 1748def: InstRW<[HWWriteResGroup188], (instrs VGATHERQPDrm, VPGATHERQQrm)>; 1749 1750def HWWriteResGroup189 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1751 let Latency = 17; 1752 let NumMicroOps = 22; 1753 let ReleaseAtCycles = [5,3,4,1,5,4]; 1754} 1755def: InstRW<[HWWriteResGroup189], (instrs VGATHERQPDYrm, VPGATHERQQYrm, 1756 VGATHERQPSYrm, VPGATHERQDYrm)>; 1757 1758def HWWriteResGroup190 : SchedWriteRes<[HWPort0,HWPort5,HWPort06,HWPort15,HWPort015,HWPort23]> { 1759 let Latency = 16; 1760 let NumMicroOps = 15; 1761 let ReleaseAtCycles = [3,3,2,1,4,2]; 1762} 1763def: InstRW<[HWWriteResGroup190], (instrs VGATHERQPSrm, VPGATHERQDrm)>; 1764 1765def: InstRW<[WriteZero], (instrs CLC)>; 1766 1767 1768// Instruction variants handled by the renamer. These might not need execution 1769// ports in certain conditions. 1770// See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs", 1771// section "Haswell and Broadwell Pipeline" > "Register allocation and 1772// renaming". 1773// These can be investigated with llvm-exegesis, e.g. 1774// echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1775// echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=- 1776 1777def HWWriteZeroLatency : SchedWriteRes<[]> { 1778 let Latency = 0; 1779} 1780 1781def HWWriteZeroIdiom : SchedWriteVariant<[ 1782 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1783 SchedVar<NoSchedPred, [WriteALU]> 1784]>; 1785def : InstRW<[HWWriteZeroIdiom], (instrs SUB32rr, SUB64rr, 1786 XOR32rr, XOR64rr)>; 1787 1788def HWWriteFZeroIdiom : SchedWriteVariant<[ 1789 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1790 SchedVar<NoSchedPred, [WriteFLogic]> 1791]>; 1792def : InstRW<[HWWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr, 1793 VXORPDrr)>; 1794 1795def HWWriteFZeroIdiomY : SchedWriteVariant<[ 1796 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1797 SchedVar<NoSchedPred, [WriteFLogicY]> 1798]>; 1799def : InstRW<[HWWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>; 1800 1801def HWWriteVZeroIdiomLogicX : SchedWriteVariant<[ 1802 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1803 SchedVar<NoSchedPred, [WriteVecLogicX]> 1804]>; 1805def : InstRW<[HWWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>; 1806 1807def HWWriteVZeroIdiomLogicY : SchedWriteVariant<[ 1808 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1809 SchedVar<NoSchedPred, [WriteVecLogicY]> 1810]>; 1811def : InstRW<[HWWriteVZeroIdiomLogicY], (instrs VPXORYrr)>; 1812 1813def HWWriteVZeroIdiomALUX : SchedWriteVariant<[ 1814 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1815 SchedVar<NoSchedPred, [WriteVecALUX]> 1816]>; 1817def : InstRW<[HWWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr, 1818 PSUBDrr, VPSUBDrr, 1819 PSUBQrr, VPSUBQrr, 1820 PSUBWrr, VPSUBWrr, 1821 PCMPGTBrr, VPCMPGTBrr, 1822 PCMPGTDrr, VPCMPGTDrr, 1823 PCMPGTWrr, VPCMPGTWrr)>; 1824 1825def HWWriteVZeroIdiomALUY : SchedWriteVariant<[ 1826 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1827 SchedVar<NoSchedPred, [WriteVecALUY]> 1828]>; 1829def : InstRW<[HWWriteVZeroIdiomALUY], (instrs VPSUBBYrr, 1830 VPSUBDYrr, 1831 VPSUBQYrr, 1832 VPSUBWYrr, 1833 VPCMPGTBYrr, 1834 VPCMPGTDYrr, 1835 VPCMPGTWYrr)>; 1836 1837def HWWritePCMPGTQ : SchedWriteRes<[HWPort0]> { 1838 let Latency = 5; 1839 let NumMicroOps = 1; 1840 let ReleaseAtCycles = [1]; 1841} 1842 1843def HWWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[ 1844 SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [HWWriteZeroLatency]>, 1845 SchedVar<NoSchedPred, [HWWritePCMPGTQ]> 1846]>; 1847def : InstRW<[HWWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr, 1848 VPCMPGTQYrr)>; 1849 1850 1851// The 0x83 ADC/SBB opcodes have special support for immediate 0 to only require 1852// a single uop. It does not apply to the GR8 encoding. And only applies to the 1853// 8-bit immediate since using larger immediate for 0 would be silly. 1854// Unfortunately, this optimization does not apply to the AX/EAX/RAX short 1855// encodings we convert to in MCInstLowering so we exclude AX/EAX/RAX here since 1856// we schedule before that point. 1857// TODO: Should we disable using the short encodings on these CPUs? 1858def HWFastADC0 : MCSchedPredicate< 1859 CheckAll<[ 1860 CheckImmOperand<2, 0>, // Second MCOperand is Imm and has value 0. 1861 CheckNot<CheckRegOperand<1, AX>>, // First MCOperand is not register AX 1862 CheckNot<CheckRegOperand<1, EAX>>, // First MCOperand is not register EAX 1863 CheckNot<CheckRegOperand<1, RAX>> // First MCOperand is not register RAX 1864 ]> 1865>; 1866 1867def HWWriteADC0 : SchedWriteRes<[HWPort06]> { 1868 let Latency = 1; 1869 let NumMicroOps = 1; 1870 let ReleaseAtCycles = [1]; 1871} 1872 1873def HWWriteADC : SchedWriteVariant<[ 1874 SchedVar<HWFastADC0, [HWWriteADC0]>, 1875 SchedVar<NoSchedPred, [WriteADC]> 1876]>; 1877 1878def : InstRW<[HWWriteADC], (instrs ADC16ri8, ADC32ri8, ADC64ri8, 1879 SBB16ri8, SBB32ri8, SBB64ri8)>; 1880 1881// CMOVs that use both Z and C flag require an extra uop. 1882def HWWriteCMOVA_CMOVBErr : SchedWriteRes<[HWPort06,HWPort0156]> { 1883 let Latency = 3; 1884 let ReleaseAtCycles = [1,2]; 1885 let NumMicroOps = 3; 1886} 1887 1888def HWWriteCMOVA_CMOVBErm : SchedWriteRes<[HWPort23,HWPort06,HWPort0156]> { 1889 let Latency = 8; 1890 let ReleaseAtCycles = [1,1,2]; 1891 let NumMicroOps = 4; 1892} 1893 1894def HWCMOVA_CMOVBErr : SchedWriteVariant<[ 1895 SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [HWWriteCMOVA_CMOVBErr]>, 1896 SchedVar<NoSchedPred, [WriteCMOV]> 1897]>; 1898 1899def HWCMOVA_CMOVBErm : SchedWriteVariant<[ 1900 SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [HWWriteCMOVA_CMOVBErm]>, 1901 SchedVar<NoSchedPred, [WriteCMOV.Folded]> 1902]>; 1903 1904def : InstRW<[HWCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>; 1905def : InstRW<[HWCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>; 1906 1907// SETCCs that use both Z and C flag require an extra uop. 1908def HWWriteSETA_SETBEr : SchedWriteRes<[HWPort06,HWPort0156]> { 1909 let Latency = 2; 1910 let ReleaseAtCycles = [1,1]; 1911 let NumMicroOps = 2; 1912} 1913 1914def HWWriteSETA_SETBEm : SchedWriteRes<[HWPort4,HWPort237,HWPort06,HWPort0156]> { 1915 let Latency = 3; 1916 let ReleaseAtCycles = [1,1,1,1]; 1917 let NumMicroOps = 4; 1918} 1919 1920def HWSETA_SETBErr : SchedWriteVariant<[ 1921 SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [HWWriteSETA_SETBEr]>, 1922 SchedVar<NoSchedPred, [WriteSETCC]> 1923]>; 1924 1925def HWSETA_SETBErm : SchedWriteVariant<[ 1926 SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [HWWriteSETA_SETBEm]>, 1927 SchedVar<NoSchedPred, [WriteSETCCStore]> 1928]>; 1929 1930def : InstRW<[HWSETA_SETBErr], (instrs SETCCr)>; 1931def : InstRW<[HWSETA_SETBErm], (instrs SETCCm)>; 1932 1933/////////////////////////////////////////////////////////////////////////////// 1934// Dependency breaking instructions. 1935/////////////////////////////////////////////////////////////////////////////// 1936 1937def : IsZeroIdiomFunction<[ 1938 // GPR Zero-idioms. 1939 DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>, 1940 1941 // SSE Zero-idioms. 1942 DepBreakingClass<[ 1943 // fp variants. 1944 XORPSrr, XORPDrr, 1945 1946 // int variants. 1947 PXORrr, 1948 PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr, 1949 PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr 1950 ], ZeroIdiomPredicate>, 1951 1952 // AVX Zero-idioms. 1953 DepBreakingClass<[ 1954 // xmm fp variants. 1955 VXORPSrr, VXORPDrr, 1956 1957 // xmm int variants. 1958 VPXORrr, 1959 VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr, 1960 VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr, 1961 1962 // ymm variants. 1963 VXORPSYrr, VXORPDYrr, VPXORYrr, 1964 VPSUBBYrr, VPSUBWYrr, VPSUBDYrr, VPSUBQYrr, 1965 VPCMPGTBYrr, VPCMPGTWYrr, VPCMPGTDYrr 1966 ], ZeroIdiomPredicate>, 1967]>; 1968 1969} // SchedModel 1970