X86SchedSkylakeClient.td 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779
  1. //=- X86SchedSkylake.td - X86 Skylake Client 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 Skylake Client to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. def SkylakeClientModel : SchedMachineModel {
  14. // All x86 instructions are modeled as a single micro-op, and SKylake can
  15. // decode 6 instructions per cycle.
  16. let IssueWidth = 6;
  17. let MicroOpBufferSize = 224; // Based on the reorder buffer.
  18. let LoadLatency = 5;
  19. let MispredictPenalty = 14;
  20. // Based on the LSD (loop-stream detector) queue size and benchmarking data.
  21. let LoopMicroOpBufferSize = 50;
  22. // This flag is set to allow the scheduler to assign a default model to
  23. // unrecognized opcodes.
  24. let CompleteModel = 0;
  25. }
  26. let SchedModel = SkylakeClientModel in {
  27. // Skylake Client can issue micro-ops to 8 different ports in one cycle.
  28. // Ports 0, 1, 5, and 6 handle all computation.
  29. // Port 4 gets the data half of stores. Store data can be available later than
  30. // the store address, but since we don't model the latency of stores, we can
  31. // ignore that.
  32. // Ports 2 and 3 are identical. They handle loads and the address half of
  33. // stores. Port 7 can handle address calculations.
  34. def SKLPort0 : ProcResource<1>;
  35. def SKLPort1 : ProcResource<1>;
  36. def SKLPort2 : ProcResource<1>;
  37. def SKLPort3 : ProcResource<1>;
  38. def SKLPort4 : ProcResource<1>;
  39. def SKLPort5 : ProcResource<1>;
  40. def SKLPort6 : ProcResource<1>;
  41. def SKLPort7 : ProcResource<1>;
  42. // Many micro-ops are capable of issuing on multiple ports.
  43. def SKLPort01 : ProcResGroup<[SKLPort0, SKLPort1]>;
  44. def SKLPort23 : ProcResGroup<[SKLPort2, SKLPort3]>;
  45. def SKLPort237 : ProcResGroup<[SKLPort2, SKLPort3, SKLPort7]>;
  46. def SKLPort04 : ProcResGroup<[SKLPort0, SKLPort4]>;
  47. def SKLPort05 : ProcResGroup<[SKLPort0, SKLPort5]>;
  48. def SKLPort06 : ProcResGroup<[SKLPort0, SKLPort6]>;
  49. def SKLPort15 : ProcResGroup<[SKLPort1, SKLPort5]>;
  50. def SKLPort16 : ProcResGroup<[SKLPort1, SKLPort6]>;
  51. def SKLPort56 : ProcResGroup<[SKLPort5, SKLPort6]>;
  52. def SKLPort015 : ProcResGroup<[SKLPort0, SKLPort1, SKLPort5]>;
  53. def SKLPort056 : ProcResGroup<[SKLPort0, SKLPort5, SKLPort6]>;
  54. def SKLPort0156: ProcResGroup<[SKLPort0, SKLPort1, SKLPort5, SKLPort6]>;
  55. def SKLDivider : ProcResource<1>; // Integer division issued on port 0.
  56. // FP division and sqrt on port 0.
  57. def SKLFPDivider : ProcResource<1>;
  58. // 60 Entry Unified Scheduler
  59. def SKLPortAny : ProcResGroup<[SKLPort0, SKLPort1, SKLPort2, SKLPort3, SKLPort4,
  60. SKLPort5, SKLPort6, SKLPort7]> {
  61. let BufferSize=60;
  62. }
  63. // Integer loads are 5 cycles, so ReadAfterLd registers needn't be available until 5
  64. // cycles after the memory operand.
  65. def : ReadAdvance<ReadAfterLd, 5>;
  66. // Vector loads are 5/6/7 cycles, so ReadAfterVec*Ld registers needn't be available
  67. // until 5/6/7 cycles after the memory operand.
  68. def : ReadAdvance<ReadAfterVecLd, 5>;
  69. def : ReadAdvance<ReadAfterVecXLd, 6>;
  70. def : ReadAdvance<ReadAfterVecYLd, 7>;
  71. def : ReadAdvance<ReadInt2Fpu, 0>;
  72. // Many SchedWrites are defined in pairs with and without a folded load.
  73. // Instructions with folded loads are usually micro-fused, so they only appear
  74. // as two micro-ops when queued in the reservation station.
  75. // This multiclass defines the resource usage for variants with and without
  76. // folded loads.
  77. multiclass SKLWriteResPair<X86FoldableSchedWrite SchedRW,
  78. list<ProcResourceKind> ExePorts,
  79. int Lat, list<int> Res = [1], int UOps = 1,
  80. int LoadLat = 5, int LoadUOps = 1> {
  81. // Register variant is using a single cycle on ExePort.
  82. def : WriteRes<SchedRW, ExePorts> {
  83. let Latency = Lat;
  84. let ResourceCycles = Res;
  85. let NumMicroOps = UOps;
  86. }
  87. // Memory variant also uses a cycle on port 2/3 and adds LoadLat cycles to
  88. // the latency (default = 5).
  89. def : WriteRes<SchedRW.Folded, !listconcat([SKLPort23], ExePorts)> {
  90. let Latency = !add(Lat, LoadLat);
  91. let ResourceCycles = !listconcat([1], Res);
  92. let NumMicroOps = !add(UOps, LoadUOps);
  93. }
  94. }
  95. // A folded store needs a cycle on port 4 for the store data, and an extra port
  96. // 2/3/7 cycle to recompute the address.
  97. def : WriteRes<WriteRMW, [SKLPort237,SKLPort4]>;
  98. // Arithmetic.
  99. defm : SKLWriteResPair<WriteALU, [SKLPort0156], 1>; // Simple integer ALU op.
  100. defm : SKLWriteResPair<WriteADC, [SKLPort06], 1>; // Integer ALU + flags op.
  101. // Integer multiplication.
  102. defm : SKLWriteResPair<WriteIMul8, [SKLPort1], 3>;
  103. defm : SKLWriteResPair<WriteIMul16, [SKLPort1,SKLPort06,SKLPort0156], 4, [1,1,2], 4>;
  104. defm : X86WriteRes<WriteIMul16Imm, [SKLPort1,SKLPort0156], 4, [1,1], 2>;
  105. defm : X86WriteRes<WriteIMul16ImmLd, [SKLPort1,SKLPort0156,SKLPort23], 8, [1,1,1], 3>;
  106. defm : SKLWriteResPair<WriteIMul16Reg, [SKLPort1], 3>;
  107. defm : SKLWriteResPair<WriteIMul32, [SKLPort1,SKLPort06,SKLPort0156], 4, [1,1,1], 3>;
  108. defm : SKLWriteResPair<WriteMULX32, [SKLPort1,SKLPort06,SKLPort0156], 3, [1,1,1], 3>;
  109. defm : SKLWriteResPair<WriteIMul32Imm, [SKLPort1], 3>;
  110. defm : SKLWriteResPair<WriteIMul32Reg, [SKLPort1], 3>;
  111. defm : SKLWriteResPair<WriteIMul64, [SKLPort1,SKLPort5], 4, [1,1], 2>;
  112. defm : SKLWriteResPair<WriteMULX64, [SKLPort1,SKLPort5], 3, [1,1], 2>;
  113. defm : SKLWriteResPair<WriteIMul64Imm, [SKLPort1], 3>;
  114. defm : SKLWriteResPair<WriteIMul64Reg, [SKLPort1], 3>;
  115. def SKLWriteIMulH : WriteRes<WriteIMulH, []> { let Latency = 4; }
  116. def : WriteRes<WriteIMulHLd, []> {
  117. let Latency = !add(SKLWriteIMulH.Latency, SkylakeClientModel.LoadLatency);
  118. }
  119. defm : X86WriteRes<WriteBSWAP32, [SKLPort15], 1, [1], 1>;
  120. defm : X86WriteRes<WriteBSWAP64, [SKLPort06, SKLPort15], 2, [1,1], 2>;
  121. defm : X86WriteRes<WriteCMPXCHG,[SKLPort06, SKLPort0156], 5, [2,3], 5>;
  122. defm : X86WriteRes<WriteCMPXCHGRMW,[SKLPort23,SKLPort06,SKLPort0156,SKLPort237,SKLPort4], 8, [1,2,1,1,1], 6>;
  123. defm : X86WriteRes<WriteXCHG, [SKLPort0156], 2, [3], 3>;
  124. // TODO: Why isn't the SKLDivider used?
  125. defm : SKLWriteResPair<WriteDiv8, [SKLPort0,SKLDivider], 25, [1,10], 1, 4>;
  126. defm : X86WriteRes<WriteDiv16, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort05,SKLPort0156], 76, [7,2,8,3,1,11], 32>;
  127. defm : X86WriteRes<WriteDiv32, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort05,SKLPort0156], 76, [7,2,8,3,1,11], 32>;
  128. defm : X86WriteRes<WriteDiv64, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort05,SKLPort0156], 76, [7,2,8,3,1,11], 32>;
  129. defm : X86WriteRes<WriteDiv16Ld, [SKLPort0,SKLPort23,SKLDivider], 29, [1,1,10], 2>;
  130. defm : X86WriteRes<WriteDiv32Ld, [SKLPort0,SKLPort23,SKLDivider], 29, [1,1,10], 2>;
  131. defm : X86WriteRes<WriteDiv64Ld, [SKLPort0,SKLPort23,SKLDivider], 29, [1,1,10], 2>;
  132. defm : X86WriteRes<WriteIDiv8, [SKLPort0,SKLDivider], 25, [1,10], 1>;
  133. defm : X86WriteRes<WriteIDiv16, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort06,SKLPort0156], 102, [4,2,4,8,14,34], 66>;
  134. defm : X86WriteRes<WriteIDiv32, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort06,SKLPort0156], 102, [4,2,4,8,14,34], 66>;
  135. defm : X86WriteRes<WriteIDiv64, [SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort06,SKLPort0156], 102, [4,2,4,8,14,34], 66>;
  136. defm : X86WriteRes<WriteIDiv8Ld, [SKLPort0,SKLPort5,SKLPort23,SKLPort0156], 28, [2,4,1,1], 8>;
  137. defm : X86WriteRes<WriteIDiv16Ld, [SKLPort0,SKLPort5,SKLPort23,SKLPort0156], 28, [2,4,1,1], 8>;
  138. defm : X86WriteRes<WriteIDiv32Ld, [SKLPort0,SKLPort5,SKLPort23,SKLPort0156], 28, [2,4,1,1], 8>;
  139. defm : X86WriteRes<WriteIDiv64Ld, [SKLPort0,SKLPort5,SKLPort23,SKLPort0156], 28, [2,4,1,1], 8>;
  140. defm : SKLWriteResPair<WriteCRC32, [SKLPort1], 3>;
  141. def : WriteRes<WriteLEA, [SKLPort15]>; // LEA instructions can't fold loads.
  142. defm : SKLWriteResPair<WriteCMOV, [SKLPort06], 1, [1], 1>; // Conditional move.
  143. defm : X86WriteRes<WriteFCMOV, [SKLPort1], 3, [1], 1>; // x87 conditional move.
  144. def : WriteRes<WriteSETCC, [SKLPort06]>; // Setcc.
  145. def : WriteRes<WriteSETCCStore, [SKLPort06,SKLPort4,SKLPort237]> {
  146. let Latency = 2;
  147. let NumMicroOps = 3;
  148. }
  149. defm : X86WriteRes<WriteLAHFSAHF, [SKLPort06], 1, [1], 1>;
  150. defm : X86WriteRes<WriteBitTest, [SKLPort06], 1, [1], 1>;
  151. defm : X86WriteRes<WriteBitTestImmLd, [SKLPort06,SKLPort23], 6, [1,1], 2>;
  152. defm : X86WriteRes<WriteBitTestRegLd, [SKLPort0156,SKLPort23], 6, [1,1], 2>;
  153. defm : X86WriteRes<WriteBitTestSet, [SKLPort06], 1, [1], 1>;
  154. defm : X86WriteRes<WriteBitTestSetImmLd, [SKLPort06,SKLPort23], 5, [1,1], 3>;
  155. defm : X86WriteRes<WriteBitTestSetRegLd, [SKLPort0156,SKLPort23], 5, [1,1], 2>;
  156. // Bit counts.
  157. defm : SKLWriteResPair<WriteBSF, [SKLPort1], 3>;
  158. defm : SKLWriteResPair<WriteBSR, [SKLPort1], 3>;
  159. defm : SKLWriteResPair<WriteLZCNT, [SKLPort1], 3>;
  160. defm : SKLWriteResPair<WriteTZCNT, [SKLPort1], 3>;
  161. defm : SKLWriteResPair<WritePOPCNT, [SKLPort1], 3>;
  162. // Integer shifts and rotates.
  163. defm : SKLWriteResPair<WriteShift, [SKLPort06], 1>;
  164. defm : SKLWriteResPair<WriteShiftCL, [SKLPort06], 3, [3], 3>;
  165. defm : SKLWriteResPair<WriteRotate, [SKLPort06], 1, [1], 1>;
  166. defm : SKLWriteResPair<WriteRotateCL, [SKLPort06], 3, [3], 3>;
  167. // SHLD/SHRD.
  168. defm : X86WriteRes<WriteSHDrri, [SKLPort1], 3, [1], 1>;
  169. defm : X86WriteRes<WriteSHDrrcl,[SKLPort1,SKLPort06,SKLPort0156], 6, [1, 2, 1], 4>;
  170. defm : X86WriteRes<WriteSHDmri, [SKLPort1,SKLPort23,SKLPort237,SKLPort0156], 9, [1, 1, 1, 1], 4>;
  171. defm : X86WriteRes<WriteSHDmrcl,[SKLPort1,SKLPort23,SKLPort237,SKLPort06,SKLPort0156], 11, [1, 1, 1, 2, 1], 6>;
  172. // BMI1 BEXTR/BLS, BMI2 BZHI
  173. defm : SKLWriteResPair<WriteBEXTR, [SKLPort06,SKLPort15], 2, [1,1], 2>;
  174. defm : SKLWriteResPair<WriteBLS, [SKLPort15], 1>;
  175. defm : SKLWriteResPair<WriteBZHI, [SKLPort15], 1>;
  176. // Loads, stores, and moves, not folded with other operations.
  177. defm : X86WriteRes<WriteLoad, [SKLPort23], 5, [1], 1>;
  178. defm : X86WriteRes<WriteStore, [SKLPort237, SKLPort4], 1, [1,1], 1>;
  179. defm : X86WriteRes<WriteStoreNT, [SKLPort237, SKLPort4], 1, [1,1], 2>;
  180. defm : X86WriteRes<WriteMove, [SKLPort0156], 1, [1], 1>;
  181. // Model the effect of clobbering the read-write mask operand of the GATHER operation.
  182. // Does not cost anything by itself, only has latency, matching that of the WriteLoad,
  183. defm : X86WriteRes<WriteVecMaskedGatherWriteback, [], 5, [], 0>;
  184. // Idioms that clear a register, like xorps %xmm0, %xmm0.
  185. // These can often bypass execution ports completely.
  186. def : WriteRes<WriteZero, []>;
  187. // Branches don't produce values, so they have no latency, but they still
  188. // consume resources. Indirect branches can fold loads.
  189. defm : SKLWriteResPair<WriteJump, [SKLPort06], 1>;
  190. // Floating point. This covers both scalar and vector operations.
  191. defm : X86WriteRes<WriteFLD0, [SKLPort05], 1, [1], 1>;
  192. defm : X86WriteRes<WriteFLD1, [SKLPort05], 1, [2], 2>;
  193. defm : X86WriteRes<WriteFLDC, [SKLPort05], 1, [2], 2>;
  194. defm : X86WriteRes<WriteFLoad, [SKLPort23], 5, [1], 1>;
  195. defm : X86WriteRes<WriteFLoadX, [SKLPort23], 6, [1], 1>;
  196. defm : X86WriteRes<WriteFLoadY, [SKLPort23], 7, [1], 1>;
  197. defm : X86WriteRes<WriteFMaskedLoad, [SKLPort23,SKLPort015], 7, [1,1], 2>;
  198. defm : X86WriteRes<WriteFMaskedLoadY, [SKLPort23,SKLPort015], 8, [1,1], 2>;
  199. defm : X86WriteRes<WriteFStore, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  200. defm : X86WriteRes<WriteFStoreX, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  201. defm : X86WriteRes<WriteFStoreY, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  202. defm : X86WriteRes<WriteFStoreNT, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  203. defm : X86WriteRes<WriteFStoreNTX, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  204. defm : X86WriteRes<WriteFStoreNTY, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  205. defm : X86WriteRes<WriteFMaskedStore32, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  206. defm : X86WriteRes<WriteFMaskedStore32Y, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  207. defm : X86WriteRes<WriteFMaskedStore64, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  208. defm : X86WriteRes<WriteFMaskedStore64Y, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  209. defm : X86WriteRes<WriteFMove, [SKLPort015], 1, [1], 1>;
  210. defm : X86WriteRes<WriteFMoveX, [SKLPort015], 1, [1], 1>;
  211. defm : X86WriteRes<WriteFMoveY, [SKLPort015], 1, [1], 1>;
  212. defm : X86WriteResUnsupported<WriteFMoveZ>;
  213. defm : X86WriteRes<WriteEMMS, [SKLPort05,SKLPort0156], 10, [9,1], 10>;
  214. defm : SKLWriteResPair<WriteFAdd, [SKLPort01], 4, [1], 1, 5>; // Floating point add/sub.
  215. defm : SKLWriteResPair<WriteFAddX, [SKLPort01], 4, [1], 1, 6>;
  216. defm : SKLWriteResPair<WriteFAddY, [SKLPort01], 4, [1], 1, 7>;
  217. defm : X86WriteResPairUnsupported<WriteFAddZ>;
  218. defm : SKLWriteResPair<WriteFAdd64, [SKLPort01], 4, [1], 1, 5>; // Floating point double add/sub.
  219. defm : SKLWriteResPair<WriteFAdd64X, [SKLPort01], 4, [1], 1, 6>;
  220. defm : SKLWriteResPair<WriteFAdd64Y, [SKLPort01], 4, [1], 1, 7>;
  221. defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
  222. defm : SKLWriteResPair<WriteFCmp, [SKLPort01], 4, [1], 1, 5>; // Floating point compare.
  223. defm : SKLWriteResPair<WriteFCmpX, [SKLPort01], 4, [1], 1, 6>;
  224. defm : SKLWriteResPair<WriteFCmpY, [SKLPort01], 4, [1], 1, 7>;
  225. defm : X86WriteResPairUnsupported<WriteFCmpZ>;
  226. defm : SKLWriteResPair<WriteFCmp64, [SKLPort01], 4, [1], 1, 5>; // Floating point double compare.
  227. defm : SKLWriteResPair<WriteFCmp64X, [SKLPort01], 4, [1], 1, 6>;
  228. defm : SKLWriteResPair<WriteFCmp64Y, [SKLPort01], 4, [1], 1, 7>;
  229. defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
  230. defm : SKLWriteResPair<WriteFCom, [SKLPort0], 2>; // Floating point compare to flags (X87).
  231. defm : SKLWriteResPair<WriteFComX, [SKLPort0], 2>; // Floating point compare to flags (SSE).
  232. defm : SKLWriteResPair<WriteFMul, [SKLPort01], 4, [1], 1, 5>; // Floating point multiplication.
  233. defm : SKLWriteResPair<WriteFMulX, [SKLPort01], 4, [1], 1, 6>;
  234. defm : SKLWriteResPair<WriteFMulY, [SKLPort01], 4, [1], 1, 7>;
  235. defm : X86WriteResPairUnsupported<WriteFMulZ>;
  236. defm : SKLWriteResPair<WriteFMul64, [SKLPort01], 4, [1], 1, 5>; // Floating point double multiplication.
  237. defm : SKLWriteResPair<WriteFMul64X, [SKLPort01], 4, [1], 1, 6>;
  238. defm : SKLWriteResPair<WriteFMul64Y, [SKLPort01], 4, [1], 1, 7>;
  239. defm : X86WriteResPairUnsupported<WriteFMul64Z>;
  240. defm : SKLWriteResPair<WriteFDiv, [SKLPort0,SKLFPDivider], 11, [1,3], 1, 5>; // Floating point division.
  241. defm : SKLWriteResPair<WriteFDivX, [SKLPort0,SKLFPDivider], 11, [1,3], 1, 6>;
  242. defm : SKLWriteResPair<WriteFDivY, [SKLPort0,SKLFPDivider], 11, [1,5], 1, 7>;
  243. defm : X86WriteResPairUnsupported<WriteFDivZ>;
  244. defm : SKLWriteResPair<WriteFDiv64, [SKLPort0,SKLFPDivider], 14, [1,4], 1, 5>; // Floating point double division.
  245. defm : SKLWriteResPair<WriteFDiv64X, [SKLPort0,SKLFPDivider], 14, [1,4], 1, 6>;
  246. defm : SKLWriteResPair<WriteFDiv64Y, [SKLPort0,SKLFPDivider], 14, [1,8], 1, 7>;
  247. defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
  248. defm : SKLWriteResPair<WriteFSqrt, [SKLPort0,SKLFPDivider], 12, [1,3], 1, 5>; // Floating point square root.
  249. defm : SKLWriteResPair<WriteFSqrtX, [SKLPort0,SKLFPDivider], 12, [1,3], 1, 6>;
  250. defm : SKLWriteResPair<WriteFSqrtY, [SKLPort0,SKLFPDivider], 12, [1,6], 1, 7>;
  251. defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
  252. defm : SKLWriteResPair<WriteFSqrt64, [SKLPort0,SKLFPDivider], 18, [1,6], 1, 5>; // Floating point double square root.
  253. defm : SKLWriteResPair<WriteFSqrt64X, [SKLPort0,SKLFPDivider], 18, [1,6], 1, 6>;
  254. defm : SKLWriteResPair<WriteFSqrt64Y, [SKLPort0,SKLFPDivider], 18, [1,12],1, 7>;
  255. defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
  256. defm : SKLWriteResPair<WriteFSqrt80, [SKLPort0,SKLFPDivider], 21, [1,7]>; // Floating point long double square root.
  257. defm : SKLWriteResPair<WriteFRcp, [SKLPort0], 4, [1], 1, 5>; // Floating point reciprocal estimate.
  258. defm : SKLWriteResPair<WriteFRcpX, [SKLPort0], 4, [1], 1, 6>;
  259. defm : SKLWriteResPair<WriteFRcpY, [SKLPort0], 4, [1], 1, 7>;
  260. defm : X86WriteResPairUnsupported<WriteFRcpZ>;
  261. defm : SKLWriteResPair<WriteFRsqrt, [SKLPort0], 4, [1], 1, 5>; // Floating point reciprocal square root estimate.
  262. defm : SKLWriteResPair<WriteFRsqrtX,[SKLPort0], 4, [1], 1, 6>;
  263. defm : SKLWriteResPair<WriteFRsqrtY,[SKLPort0], 4, [1], 1, 7>;
  264. defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
  265. defm : SKLWriteResPair<WriteFMA, [SKLPort01], 4, [1], 1, 5>; // Fused Multiply Add.
  266. defm : SKLWriteResPair<WriteFMAX, [SKLPort01], 4, [1], 1, 6>;
  267. defm : SKLWriteResPair<WriteFMAY, [SKLPort01], 4, [1], 1, 7>;
  268. defm : X86WriteResPairUnsupported<WriteFMAZ>;
  269. defm : SKLWriteResPair<WriteDPPD, [SKLPort5,SKLPort01], 9, [1,2], 3, 6>; // Floating point double dot product.
  270. defm : SKLWriteResPair<WriteDPPS, [SKLPort5,SKLPort01], 13, [1,3], 4, 6>;
  271. defm : SKLWriteResPair<WriteDPPSY, [SKLPort5,SKLPort01], 13, [1,3], 4, 7>;
  272. defm : SKLWriteResPair<WriteFSign, [SKLPort0], 1>; // Floating point fabs/fchs.
  273. defm : SKLWriteResPair<WriteFRnd, [SKLPort01], 8, [2], 2, 6>; // Floating point rounding.
  274. defm : SKLWriteResPair<WriteFRndY, [SKLPort01], 8, [2], 2, 7>;
  275. defm : X86WriteResPairUnsupported<WriteFRndZ>;
  276. defm : SKLWriteResPair<WriteFLogic, [SKLPort015], 1, [1], 1, 6>; // Floating point and/or/xor logicals.
  277. defm : SKLWriteResPair<WriteFLogicY, [SKLPort015], 1, [1], 1, 7>;
  278. defm : X86WriteResPairUnsupported<WriteFLogicZ>;
  279. defm : SKLWriteResPair<WriteFTest, [SKLPort0], 2, [1], 1, 6>; // Floating point TEST instructions.
  280. defm : SKLWriteResPair<WriteFTestY, [SKLPort0], 2, [1], 1, 7>;
  281. defm : X86WriteResPairUnsupported<WriteFTestZ>;
  282. defm : SKLWriteResPair<WriteFShuffle, [SKLPort5], 1, [1], 1, 6>; // Floating point vector shuffles.
  283. defm : SKLWriteResPair<WriteFShuffleY, [SKLPort5], 1, [1], 1, 7>;
  284. defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
  285. defm : SKLWriteResPair<WriteFVarShuffle, [SKLPort5], 1, [1], 1, 6>; // Floating point vector shuffles.
  286. defm : SKLWriteResPair<WriteFVarShuffleY, [SKLPort5], 1, [1], 1, 7>;
  287. defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
  288. defm : SKLWriteResPair<WriteFBlend, [SKLPort015], 1, [1], 1, 6>; // Floating point vector blends.
  289. defm : SKLWriteResPair<WriteFBlendY, [SKLPort015], 1, [1], 1, 7>;
  290. defm : X86WriteResPairUnsupported<WriteFBlendZ>;
  291. defm : SKLWriteResPair<WriteFVarBlend, [SKLPort015], 2, [2], 2, 6>; // Fp vector variable blends.
  292. defm : SKLWriteResPair<WriteFVarBlendY,[SKLPort015], 2, [2], 2, 7>;
  293. defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
  294. // FMA Scheduling helper class.
  295. // class FMASC { X86FoldableSchedWrite Sched = WriteFAdd; }
  296. // Vector integer operations.
  297. defm : X86WriteRes<WriteVecLoad, [SKLPort23], 5, [1], 1>;
  298. defm : X86WriteRes<WriteVecLoadX, [SKLPort23], 6, [1], 1>;
  299. defm : X86WriteRes<WriteVecLoadY, [SKLPort23], 7, [1], 1>;
  300. defm : X86WriteRes<WriteVecLoadNT, [SKLPort23], 6, [1], 1>;
  301. defm : X86WriteRes<WriteVecLoadNTY, [SKLPort23], 7, [1], 1>;
  302. defm : X86WriteRes<WriteVecMaskedLoad, [SKLPort23,SKLPort015], 7, [1,1], 2>;
  303. defm : X86WriteRes<WriteVecMaskedLoadY, [SKLPort23,SKLPort015], 8, [1,1], 2>;
  304. defm : X86WriteRes<WriteVecStore, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  305. defm : X86WriteRes<WriteVecStoreX, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  306. defm : X86WriteRes<WriteVecStoreY, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  307. defm : X86WriteRes<WriteVecStoreNT, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  308. defm : X86WriteRes<WriteVecStoreNTY, [SKLPort237,SKLPort4], 1, [1,1], 2>;
  309. defm : X86WriteRes<WriteVecMaskedStore32, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  310. defm : X86WriteRes<WriteVecMaskedStore32Y, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  311. defm : X86WriteRes<WriteVecMaskedStore64, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  312. defm : X86WriteRes<WriteVecMaskedStore64Y, [SKLPort237,SKLPort0], 2, [1,1], 2>;
  313. defm : X86WriteRes<WriteVecMove, [SKLPort05], 1, [1], 1>;
  314. defm : X86WriteRes<WriteVecMoveX, [SKLPort015], 1, [1], 1>;
  315. defm : X86WriteRes<WriteVecMoveY, [SKLPort015], 1, [1], 1>;
  316. defm : X86WriteResUnsupported<WriteVecMoveZ>;
  317. defm : X86WriteRes<WriteVecMoveToGpr, [SKLPort0], 2, [1], 1>;
  318. defm : X86WriteRes<WriteVecMoveFromGpr, [SKLPort5], 1, [1], 1>;
  319. defm : SKLWriteResPair<WriteVecALU, [SKLPort05], 1, [1], 1, 5>; // Vector integer ALU op, no logicals.
  320. defm : SKLWriteResPair<WriteVecALUX, [SKLPort01], 1, [1], 1, 6>;
  321. defm : SKLWriteResPair<WriteVecALUY, [SKLPort01], 1, [1], 1, 7>;
  322. defm : X86WriteResPairUnsupported<WriteVecALUZ>;
  323. defm : SKLWriteResPair<WriteVecLogic, [SKLPort05], 1, [1], 1, 5>; // Vector integer and/or/xor.
  324. defm : SKLWriteResPair<WriteVecLogicX,[SKLPort015], 1, [1], 1, 6>;
  325. defm : SKLWriteResPair<WriteVecLogicY,[SKLPort015], 1, [1], 1, 7>;
  326. defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
  327. defm : SKLWriteResPair<WriteVecTest, [SKLPort0,SKLPort5], 3, [1,1], 2, 6>; // Vector integer TEST instructions.
  328. defm : SKLWriteResPair<WriteVecTestY, [SKLPort0,SKLPort5], 3, [1,1], 2, 7>;
  329. defm : X86WriteResPairUnsupported<WriteVecTestZ>;
  330. defm : SKLWriteResPair<WriteVecIMul, [SKLPort0] , 5, [1], 1, 5>; // Vector integer multiply.
  331. defm : SKLWriteResPair<WriteVecIMulX, [SKLPort01], 5, [1], 1, 6>;
  332. defm : SKLWriteResPair<WriteVecIMulY, [SKLPort01], 5, [1], 1, 7>;
  333. defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
  334. defm : SKLWriteResPair<WritePMULLD, [SKLPort01], 10, [2], 2, 6>; // Vector PMULLD.
  335. defm : SKLWriteResPair<WritePMULLDY, [SKLPort01], 10, [2], 2, 7>;
  336. defm : X86WriteResPairUnsupported<WritePMULLDZ>;
  337. defm : SKLWriteResPair<WriteShuffle, [SKLPort5], 1, [1], 1, 5>; // Vector shuffles.
  338. defm : SKLWriteResPair<WriteShuffleX, [SKLPort5], 1, [1], 1, 6>;
  339. defm : SKLWriteResPair<WriteShuffleY, [SKLPort5], 1, [1], 1, 7>;
  340. defm : X86WriteResPairUnsupported<WriteShuffleZ>;
  341. defm : SKLWriteResPair<WriteVarShuffle, [SKLPort5], 1, [1], 1, 5>; // Vector shuffles.
  342. defm : SKLWriteResPair<WriteVarShuffleX, [SKLPort5], 1, [1], 1, 6>;
  343. defm : SKLWriteResPair<WriteVarShuffleY, [SKLPort5], 1, [1], 1, 7>;
  344. defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
  345. defm : SKLWriteResPair<WriteBlend, [SKLPort5], 1, [1], 1, 6>; // Vector blends.
  346. defm : SKLWriteResPair<WriteBlendY, [SKLPort5], 1, [1], 1, 7>;
  347. defm : X86WriteResPairUnsupported<WriteBlendZ>;
  348. defm : SKLWriteResPair<WriteVarBlend, [SKLPort015], 2, [2], 2, 6>; // Vector variable blends.
  349. defm : SKLWriteResPair<WriteVarBlendY, [SKLPort015], 2, [2], 2, 6>;
  350. defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
  351. defm : SKLWriteResPair<WriteMPSAD, [SKLPort5], 4, [2], 2, 6>; // Vector MPSAD.
  352. defm : SKLWriteResPair<WriteMPSADY, [SKLPort5], 4, [2], 2, 7>;
  353. defm : X86WriteResPairUnsupported<WriteMPSADZ>;
  354. defm : SKLWriteResPair<WritePSADBW, [SKLPort5], 3, [1], 1, 5>; // Vector PSADBW.
  355. defm : SKLWriteResPair<WritePSADBWX, [SKLPort5], 3, [1], 1, 6>;
  356. defm : SKLWriteResPair<WritePSADBWY, [SKLPort5], 3, [1], 1, 7>;
  357. defm : X86WriteResPairUnsupported<WritePSADBWZ>;
  358. defm : SKLWriteResPair<WritePHMINPOS, [SKLPort01], 4, [1], 1, 6>; // Vector PHMINPOS.
  359. // Vector integer shifts.
  360. defm : SKLWriteResPair<WriteVecShift, [SKLPort0], 1, [1], 1, 5>;
  361. defm : X86WriteRes<WriteVecShiftX, [SKLPort5,SKLPort01], 2, [1,1], 2>;
  362. defm : X86WriteRes<WriteVecShiftY, [SKLPort5,SKLPort01], 4, [1,1], 2>;
  363. defm : X86WriteRes<WriteVecShiftXLd, [SKLPort01,SKLPort23], 7, [1,1], 2>;
  364. defm : X86WriteRes<WriteVecShiftYLd, [SKLPort01,SKLPort23], 8, [1,1], 2>;
  365. defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
  366. defm : SKLWriteResPair<WriteVecShiftImm, [SKLPort0], 1, [1], 1, 5>; // Vector integer immediate shifts.
  367. defm : SKLWriteResPair<WriteVecShiftImmX, [SKLPort01], 1, [1], 1, 6>;
  368. defm : SKLWriteResPair<WriteVecShiftImmY, [SKLPort01], 1, [1], 1, 7>;
  369. defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
  370. defm : SKLWriteResPair<WriteVarVecShift, [SKLPort01], 1, [1], 1, 6>; // Variable vector shifts.
  371. defm : SKLWriteResPair<WriteVarVecShiftY, [SKLPort01], 1, [1], 1, 7>;
  372. defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
  373. // Vector insert/extract operations.
  374. def : WriteRes<WriteVecInsert, [SKLPort5]> {
  375. let Latency = 2;
  376. let NumMicroOps = 2;
  377. let ResourceCycles = [2];
  378. }
  379. def : WriteRes<WriteVecInsertLd, [SKLPort5,SKLPort23]> {
  380. let Latency = 6;
  381. let NumMicroOps = 2;
  382. }
  383. def: InstRW<[WriteVecInsertLd], (instregex "(V?)MOV(H|L)(PD|PS)rm")>;
  384. def : WriteRes<WriteVecExtract, [SKLPort0,SKLPort5]> {
  385. let Latency = 3;
  386. let NumMicroOps = 2;
  387. }
  388. def : WriteRes<WriteVecExtractSt, [SKLPort4,SKLPort5,SKLPort237]> {
  389. let Latency = 2;
  390. let NumMicroOps = 3;
  391. }
  392. // Conversion between integer and float.
  393. defm : SKLWriteResPair<WriteCvtSS2I, [SKLPort0,SKLPort01], 6, [1,1], 2, 5>;
  394. defm : SKLWriteResPair<WriteCvtPS2I, [SKLPort01], 4, [1], 1, 6>;
  395. defm : SKLWriteResPair<WriteCvtPS2IY, [SKLPort01], 4, [1], 1, 7>;
  396. defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
  397. defm : SKLWriteResPair<WriteCvtSD2I, [SKLPort0,SKLPort01], 6, [1,1], 2, 5>;
  398. defm : SKLWriteResPair<WriteCvtPD2I, [SKLPort5,SKLPort01], 5, [1,1], 2, 6>;
  399. defm : SKLWriteResPair<WriteCvtPD2IY, [SKLPort5,SKLPort01], 7, [1,1], 2, 6>;
  400. defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
  401. defm : X86WriteRes<WriteCvtI2SS, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  402. defm : X86WriteRes<WriteCvtI2SSLd, [SKLPort23,SKLPort01], 10, [1,1], 2>;
  403. defm : SKLWriteResPair<WriteCvtI2PS, [SKLPort01], 4, [1], 1, 6>;
  404. defm : SKLWriteResPair<WriteCvtI2PSY, [SKLPort01], 4, [1], 1, 7>;
  405. defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
  406. defm : X86WriteRes<WriteCvtI2SD, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  407. defm : X86WriteRes<WriteCvtI2SDLd, [SKLPort23,SKLPort01], 10, [1,1], 2>;
  408. defm : SKLWriteResPair<WriteCvtI2PD, [SKLPort0,SKLPort5], 5, [1,1], 2, 6>;
  409. defm : SKLWriteResPair<WriteCvtI2PDY, [SKLPort0,SKLPort5], 7, [1,1], 2, 6>;
  410. defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
  411. defm : X86WriteRes<WriteCvtSS2SD, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  412. defm : X86WriteRes<WriteCvtSS2SDLd, [SKLPort23,SKLPort01], 10, [1,1], 2>;
  413. defm : X86WriteRes<WriteCvtPS2PD, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  414. defm : X86WriteRes<WriteCvtPS2PDLd, [SKLPort23,SKLPort01], 9, [1,1], 2>;
  415. defm : X86WriteRes<WriteCvtPS2PDY, [SKLPort5,SKLPort01], 7, [1,1], 2>;
  416. defm : X86WriteRes<WriteCvtPS2PDYLd, [SKLPort23,SKLPort01], 11, [1,1], 2>;
  417. defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
  418. defm : SKLWriteResPair<WriteCvtSD2SS, [SKLPort5,SKLPort01], 5, [1,1], 2, 5>;
  419. defm : SKLWriteResPair<WriteCvtPD2PS, [SKLPort5,SKLPort01], 5, [1,1], 2, 6>;
  420. defm : SKLWriteResPair<WriteCvtPD2PSY, [SKLPort5,SKLPort01], 7, [1,1], 2, 6>;
  421. defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
  422. defm : X86WriteRes<WriteCvtPH2PS, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  423. defm : X86WriteRes<WriteCvtPH2PSY, [SKLPort5,SKLPort01], 7, [1,1], 2>;
  424. defm : X86WriteResUnsupported<WriteCvtPH2PSZ>;
  425. defm : X86WriteRes<WriteCvtPH2PSLd, [SKLPort23,SKLPort01], 9, [1,1], 2>;
  426. defm : X86WriteRes<WriteCvtPH2PSYLd, [SKLPort23,SKLPort01], 10, [1,1], 2>;
  427. defm : X86WriteResUnsupported<WriteCvtPH2PSZLd>;
  428. defm : X86WriteRes<WriteCvtPS2PH, [SKLPort5,SKLPort01], 5, [1,1], 2>;
  429. defm : X86WriteRes<WriteCvtPS2PHY, [SKLPort5,SKLPort01], 7, [1,1], 2>;
  430. defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
  431. defm : X86WriteRes<WriteCvtPS2PHSt, [SKLPort4,SKLPort5,SKLPort237,SKLPort01], 6, [1,1,1,1], 4>;
  432. defm : X86WriteRes<WriteCvtPS2PHYSt, [SKLPort4,SKLPort5,SKLPort237,SKLPort01], 8, [1,1,1,1], 4>;
  433. defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
  434. // Strings instructions.
  435. // Packed Compare Implicit Length Strings, Return Mask
  436. def : WriteRes<WritePCmpIStrM, [SKLPort0]> {
  437. let Latency = 10;
  438. let NumMicroOps = 3;
  439. let ResourceCycles = [3];
  440. }
  441. def : WriteRes<WritePCmpIStrMLd, [SKLPort0, SKLPort23]> {
  442. let Latency = 16;
  443. let NumMicroOps = 4;
  444. let ResourceCycles = [3,1];
  445. }
  446. // Packed Compare Explicit Length Strings, Return Mask
  447. def : WriteRes<WritePCmpEStrM, [SKLPort0, SKLPort5, SKLPort015, SKLPort0156]> {
  448. let Latency = 19;
  449. let NumMicroOps = 9;
  450. let ResourceCycles = [4,3,1,1];
  451. }
  452. def : WriteRes<WritePCmpEStrMLd, [SKLPort0, SKLPort5,SKLPort23, SKLPort015, SKLPort0156]> {
  453. let Latency = 25;
  454. let NumMicroOps = 10;
  455. let ResourceCycles = [4,3,1,1,1];
  456. }
  457. // Packed Compare Implicit Length Strings, Return Index
  458. def : WriteRes<WritePCmpIStrI, [SKLPort0]> {
  459. let Latency = 10;
  460. let NumMicroOps = 3;
  461. let ResourceCycles = [3];
  462. }
  463. def : WriteRes<WritePCmpIStrILd, [SKLPort0, SKLPort23]> {
  464. let Latency = 16;
  465. let NumMicroOps = 4;
  466. let ResourceCycles = [3,1];
  467. }
  468. // Packed Compare Explicit Length Strings, Return Index
  469. def : WriteRes<WritePCmpEStrI, [SKLPort0, SKLPort5, SKLPort0156]> {
  470. let Latency = 18;
  471. let NumMicroOps = 8;
  472. let ResourceCycles = [4,3,1];
  473. }
  474. def : WriteRes<WritePCmpEStrILd, [SKLPort0, SKLPort5, SKLPort23, SKLPort0156]> {
  475. let Latency = 24;
  476. let NumMicroOps = 9;
  477. let ResourceCycles = [4,3,1,1];
  478. }
  479. // MOVMSK Instructions.
  480. def : WriteRes<WriteFMOVMSK, [SKLPort0]> { let Latency = 2; }
  481. def : WriteRes<WriteVecMOVMSK, [SKLPort0]> { let Latency = 2; }
  482. def : WriteRes<WriteVecMOVMSKY, [SKLPort0]> { let Latency = 2; }
  483. def : WriteRes<WriteMMXMOVMSK, [SKLPort0]> { let Latency = 2; }
  484. // AES instructions.
  485. def : WriteRes<WriteAESDecEnc, [SKLPort0]> { // Decryption, encryption.
  486. let Latency = 4;
  487. let NumMicroOps = 1;
  488. let ResourceCycles = [1];
  489. }
  490. def : WriteRes<WriteAESDecEncLd, [SKLPort0, SKLPort23]> {
  491. let Latency = 10;
  492. let NumMicroOps = 2;
  493. let ResourceCycles = [1,1];
  494. }
  495. def : WriteRes<WriteAESIMC, [SKLPort0]> { // InvMixColumn.
  496. let Latency = 8;
  497. let NumMicroOps = 2;
  498. let ResourceCycles = [2];
  499. }
  500. def : WriteRes<WriteAESIMCLd, [SKLPort0, SKLPort23]> {
  501. let Latency = 14;
  502. let NumMicroOps = 3;
  503. let ResourceCycles = [2,1];
  504. }
  505. def : WriteRes<WriteAESKeyGen, [SKLPort0, SKLPort5, SKLPort015]> { // Key Generation.
  506. let Latency = 20;
  507. let NumMicroOps = 11;
  508. let ResourceCycles = [3,6,2];
  509. }
  510. def : WriteRes<WriteAESKeyGenLd, [SKLPort0, SKLPort5, SKLPort23, SKLPort015]> {
  511. let Latency = 25;
  512. let NumMicroOps = 11;
  513. let ResourceCycles = [3,6,1,1];
  514. }
  515. // Carry-less multiplication instructions.
  516. def : WriteRes<WriteCLMul, [SKLPort5]> {
  517. let Latency = 6;
  518. let NumMicroOps = 1;
  519. let ResourceCycles = [1];
  520. }
  521. def : WriteRes<WriteCLMulLd, [SKLPort5, SKLPort23]> {
  522. let Latency = 12;
  523. let NumMicroOps = 2;
  524. let ResourceCycles = [1,1];
  525. }
  526. // Catch-all for expensive system instructions.
  527. def : WriteRes<WriteSystem, [SKLPort0156]> { let Latency = 100; } // def WriteSystem : SchedWrite;
  528. // AVX2.
  529. defm : SKLWriteResPair<WriteFShuffle256, [SKLPort5], 3, [1], 1, 7>; // Fp 256-bit width vector shuffles.
  530. defm : SKLWriteResPair<WriteFVarShuffle256, [SKLPort5], 3, [1], 1, 7>; // Fp 256-bit width vector variable shuffles.
  531. defm : SKLWriteResPair<WriteShuffle256, [SKLPort5], 3, [1], 1, 7>; // 256-bit width vector shuffles.
  532. defm : SKLWriteResPair<WriteVPMOV256, [SKLPort5], 3, [1], 1, 7>; // 256-bit width packed vector width-changing move.
  533. defm : SKLWriteResPair<WriteVarShuffle256, [SKLPort5], 3, [1], 1, 7>; // 256-bit width vector variable shuffles.
  534. // Old microcoded instructions that nobody use.
  535. def : WriteRes<WriteMicrocoded, [SKLPort0156]> { let Latency = 100; } // def WriteMicrocoded : SchedWrite;
  536. // Fence instructions.
  537. def : WriteRes<WriteFence, [SKLPort23, SKLPort4]>;
  538. // Load/store MXCSR.
  539. def : WriteRes<WriteLDMXCSR, [SKLPort0,SKLPort23,SKLPort0156]> { let Latency = 7; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
  540. def : WriteRes<WriteSTMXCSR, [SKLPort4,SKLPort5,SKLPort237]> { let Latency = 2; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
  541. // Nop, not very useful expect it provides a model for nops!
  542. def : WriteRes<WriteNop, []>;
  543. ////////////////////////////////////////////////////////////////////////////////
  544. // Horizontal add/sub instructions.
  545. ////////////////////////////////////////////////////////////////////////////////
  546. defm : SKLWriteResPair<WriteFHAdd, [SKLPort5,SKLPort01], 6, [2,1], 3, 6>;
  547. defm : SKLWriteResPair<WriteFHAddY, [SKLPort5,SKLPort01], 6, [2,1], 3, 7>;
  548. defm : SKLWriteResPair<WritePHAdd, [SKLPort5,SKLPort05], 3, [2,1], 3, 5>;
  549. defm : SKLWriteResPair<WritePHAddX, [SKLPort5,SKLPort015], 3, [2,1], 3, 6>;
  550. defm : SKLWriteResPair<WritePHAddY, [SKLPort5,SKLPort015], 3, [2,1], 3, 7>;
  551. // Remaining instrs.
  552. def SKLWriteResGroup1 : SchedWriteRes<[SKLPort0]> {
  553. let Latency = 1;
  554. let NumMicroOps = 1;
  555. let ResourceCycles = [1];
  556. }
  557. def: InstRW<[SKLWriteResGroup1], (instregex "MMX_PADDS(B|W)rr",
  558. "MMX_PADDUS(B|W)rr",
  559. "MMX_PAVG(B|W)rr",
  560. "MMX_PCMPEQ(B|D|W)rr",
  561. "MMX_PCMPGT(B|D|W)rr",
  562. "MMX_P(MAX|MIN)SWrr",
  563. "MMX_P(MAX|MIN)UBrr",
  564. "MMX_PSUBS(B|W)rr",
  565. "MMX_PSUBUS(B|W)rr")>;
  566. def SKLWriteResGroup3 : SchedWriteRes<[SKLPort5]> {
  567. let Latency = 1;
  568. let NumMicroOps = 1;
  569. let ResourceCycles = [1];
  570. }
  571. def: InstRW<[SKLWriteResGroup3], (instregex "COM(P?)_FST0r",
  572. "UCOM_F(P?)r")>;
  573. def SKLWriteResGroup4 : SchedWriteRes<[SKLPort6]> {
  574. let Latency = 1;
  575. let NumMicroOps = 1;
  576. let ResourceCycles = [1];
  577. }
  578. def: InstRW<[SKLWriteResGroup4], (instregex "JMP(16|32|64)r")>;
  579. def SKLWriteResGroup6 : SchedWriteRes<[SKLPort05]> {
  580. let Latency = 1;
  581. let NumMicroOps = 1;
  582. let ResourceCycles = [1];
  583. }
  584. def: InstRW<[SKLWriteResGroup6], (instrs FINCSTP, FNOP)>;
  585. def SKLWriteResGroup7 : SchedWriteRes<[SKLPort06]> {
  586. let Latency = 1;
  587. let NumMicroOps = 1;
  588. let ResourceCycles = [1];
  589. }
  590. def: InstRW<[SKLWriteResGroup7], (instrs CDQ, CQO, CLAC, STAC)>;
  591. def SKLWriteResGroup8 : SchedWriteRes<[SKLPort15]> {
  592. let Latency = 1;
  593. let NumMicroOps = 1;
  594. let ResourceCycles = [1];
  595. }
  596. def: InstRW<[SKLWriteResGroup8], (instregex "ANDN(32|64)rr")>;
  597. def SKLWriteResGroup9 : SchedWriteRes<[SKLPort015]> {
  598. let Latency = 1;
  599. let NumMicroOps = 1;
  600. let ResourceCycles = [1];
  601. }
  602. def: InstRW<[SKLWriteResGroup9], (instregex "(V?)PADD(B|D|Q|W)(Y?)rr",
  603. "VPBLENDD(Y?)rri")>;
  604. def SKLWriteResGroup10 : SchedWriteRes<[SKLPort0156]> {
  605. let Latency = 1;
  606. let NumMicroOps = 1;
  607. let ResourceCycles = [1];
  608. }
  609. def: InstRW<[SKLWriteResGroup10], (instrs SGDT64m,
  610. SIDT64m,
  611. SMSW16m,
  612. STRm,
  613. SYSCALL)>;
  614. def SKLWriteResGroup11 : SchedWriteRes<[SKLPort4,SKLPort237]> {
  615. let Latency = 1;
  616. let NumMicroOps = 2;
  617. let ResourceCycles = [1,1];
  618. }
  619. def: InstRW<[SKLWriteResGroup11], (instrs FBSTPm, VMPTRSTm)>;
  620. def: InstRW<[SKLWriteResGroup11], (instregex "ST_FP(32|64|80)m")>;
  621. def SKLWriteResGroup13 : SchedWriteRes<[SKLPort5]> {
  622. let Latency = 2;
  623. let NumMicroOps = 2;
  624. let ResourceCycles = [2];
  625. }
  626. def: InstRW<[SKLWriteResGroup13], (instrs MMX_MOVQ2DQrr)>;
  627. def SKLWriteResGroup14 : SchedWriteRes<[SKLPort05]> {
  628. let Latency = 2;
  629. let NumMicroOps = 2;
  630. let ResourceCycles = [2];
  631. }
  632. def: InstRW<[SKLWriteResGroup14], (instrs FDECSTP,
  633. MMX_MOVDQ2Qrr)>;
  634. def SKLWriteResGroup17 : SchedWriteRes<[SKLPort0156]> {
  635. let Latency = 2;
  636. let NumMicroOps = 2;
  637. let ResourceCycles = [2];
  638. }
  639. def: InstRW<[SKLWriteResGroup17], (instrs LFENCE,
  640. WAIT,
  641. XGETBV)>;
  642. def SKLWriteResGroup20 : SchedWriteRes<[SKLPort6,SKLPort0156]> {
  643. let Latency = 2;
  644. let NumMicroOps = 2;
  645. let ResourceCycles = [1,1];
  646. }
  647. def: InstRW<[SKLWriteResGroup20], (instregex "CLFLUSH")>;
  648. def SKLWriteResGroup21 : SchedWriteRes<[SKLPort237,SKLPort0156]> {
  649. let Latency = 2;
  650. let NumMicroOps = 2;
  651. let ResourceCycles = [1,1];
  652. }
  653. def: InstRW<[SKLWriteResGroup21], (instrs SFENCE)>;
  654. def SKLWriteResGroup23 : SchedWriteRes<[SKLPort06,SKLPort0156]> {
  655. let Latency = 2;
  656. let NumMicroOps = 2;
  657. let ResourceCycles = [1,1];
  658. }
  659. def: InstRW<[SKLWriteResGroup23], (instrs CWD,
  660. JCXZ, JECXZ, JRCXZ,
  661. ADC8i8, SBB8i8,
  662. ADC16i16, SBB16i16,
  663. ADC32i32, SBB32i32,
  664. ADC64i32, SBB64i32)>;
  665. def SKLWriteResGroup25 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort237]> {
  666. let Latency = 2;
  667. let NumMicroOps = 3;
  668. let ResourceCycles = [1,1,1];
  669. }
  670. def: InstRW<[SKLWriteResGroup25], (instrs FNSTCW16m)>;
  671. def SKLWriteResGroup27 : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort15]> {
  672. let Latency = 2;
  673. let NumMicroOps = 3;
  674. let ResourceCycles = [1,1,1];
  675. }
  676. def: InstRW<[SKLWriteResGroup27], (instregex "MOVBE(16|32|64)mr")>;
  677. def SKLWriteResGroup28 : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort0156]> {
  678. let Latency = 2;
  679. let NumMicroOps = 3;
  680. let ResourceCycles = [1,1,1];
  681. }
  682. def: InstRW<[SKLWriteResGroup28], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8,
  683. STOSB, STOSL, STOSQ, STOSW)>;
  684. def: InstRW<[SKLWriteResGroup28], (instregex "PUSH(16|32|64)rmr")>;
  685. def SKLWriteResGroup29 : SchedWriteRes<[SKLPort1]> {
  686. let Latency = 3;
  687. let NumMicroOps = 1;
  688. let ResourceCycles = [1];
  689. }
  690. def: InstRW<[SKLWriteResGroup29], (instregex "PDEP(32|64)rr",
  691. "PEXT(32|64)rr")>;
  692. def SKLWriteResGroup30 : SchedWriteRes<[SKLPort5]> {
  693. let Latency = 3;
  694. let NumMicroOps = 1;
  695. let ResourceCycles = [1];
  696. }
  697. def: InstRW<[SKLWriteResGroup30], (instregex "(ADD|SUB|SUBR)_(FPrST0|FST0r|FrST0)",
  698. "VPBROADCAST(B|W)rr")>;
  699. def SKLWriteResGroup32 : SchedWriteRes<[SKLPort0,SKLPort0156]> {
  700. let Latency = 3;
  701. let NumMicroOps = 2;
  702. let ResourceCycles = [1,1];
  703. }
  704. def: InstRW<[SKLWriteResGroup32], (instrs FNSTSW16r)>;
  705. def SKLWriteResGroup35 : SchedWriteRes<[SKLPort0,SKLPort5]> {
  706. let Latency = 3;
  707. let NumMicroOps = 3;
  708. let ResourceCycles = [1,2];
  709. }
  710. def: InstRW<[SKLWriteResGroup35], (instregex "MMX_PH(ADD|SUB)SWrr")>;
  711. def SKLWriteResGroup36 : SchedWriteRes<[SKLPort5,SKLPort01]> {
  712. let Latency = 3;
  713. let NumMicroOps = 3;
  714. let ResourceCycles = [2,1];
  715. }
  716. def: InstRW<[SKLWriteResGroup36], (instregex "(V?)PHADDSW(Y?)rr",
  717. "(V?)PHSUBSW(Y?)rr")>;
  718. def SKLWriteResGroup39 : SchedWriteRes<[SKLPort5,SKLPort0156]> {
  719. let Latency = 3;
  720. let NumMicroOps = 3;
  721. let ResourceCycles = [2,1];
  722. }
  723. def: InstRW<[SKLWriteResGroup39], (instrs MMX_PACKSSDWrr,
  724. MMX_PACKSSWBrr,
  725. MMX_PACKUSWBrr)>;
  726. def SKLWriteResGroup40 : SchedWriteRes<[SKLPort6,SKLPort0156]> {
  727. let Latency = 3;
  728. let NumMicroOps = 3;
  729. let ResourceCycles = [1,2];
  730. }
  731. def: InstRW<[SKLWriteResGroup40], (instregex "CLD")>;
  732. def SKLWriteResGroup41 : SchedWriteRes<[SKLPort237,SKLPort0156]> {
  733. let Latency = 3;
  734. let NumMicroOps = 3;
  735. let ResourceCycles = [1,2];
  736. }
  737. def: InstRW<[SKLWriteResGroup41], (instrs MFENCE)>;
  738. def SKLWriteResGroup42 : SchedWriteRes<[SKLPort06,SKLPort0156]> {
  739. let Latency = 2;
  740. let NumMicroOps = 3;
  741. let ResourceCycles = [1,2];
  742. }
  743. def: InstRW<[SKLWriteResGroup42], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1,
  744. RCR8r1, RCR16r1, RCR32r1, RCR64r1)>;
  745. def SKLWriteResGroup42b : SchedWriteRes<[SKLPort1,SKLPort06,SKLPort0156]> {
  746. let Latency = 5;
  747. let NumMicroOps = 8;
  748. let ResourceCycles = [2,4,2];
  749. }
  750. def: InstRW<[SKLWriteResGroup42b], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>;
  751. def SKLWriteResGroup42c : SchedWriteRes<[SKLPort1,SKLPort06,SKLPort0156]> {
  752. let Latency = 6;
  753. let NumMicroOps = 8;
  754. let ResourceCycles = [2,4,2];
  755. }
  756. def: InstRW<[SKLWriteResGroup42c], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>;
  757. def SKLWriteResGroup43 : SchedWriteRes<[SKLPort0,SKLPort4,SKLPort237]> {
  758. let Latency = 3;
  759. let NumMicroOps = 3;
  760. let ResourceCycles = [1,1,1];
  761. }
  762. def: InstRW<[SKLWriteResGroup43], (instrs FNSTSWm)>;
  763. def SKLWriteResGroup45 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort237,SKLPort0156]> {
  764. let Latency = 3;
  765. let NumMicroOps = 4;
  766. let ResourceCycles = [1,1,1,1];
  767. }
  768. def: InstRW<[SKLWriteResGroup45], (instregex "CALL(16|32|64)r")>;
  769. def SKLWriteResGroup46 : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort06,SKLPort0156]> {
  770. let Latency = 3;
  771. let NumMicroOps = 4;
  772. let ResourceCycles = [1,1,1,1];
  773. }
  774. def: InstRW<[SKLWriteResGroup46], (instrs CALL64pcrel32)>;
  775. def SKLWriteResGroup47 : SchedWriteRes<[SKLPort0]> {
  776. let Latency = 4;
  777. let NumMicroOps = 1;
  778. let ResourceCycles = [1];
  779. }
  780. def: InstRW<[SKLWriteResGroup47], (instregex "MUL_(FPrST0|FST0r|FrST0)")>;
  781. def SKLWriteResGroup53 : SchedWriteRes<[SKLPort4,SKLPort5,SKLPort237]> {
  782. let Latency = 4;
  783. let NumMicroOps = 3;
  784. let ResourceCycles = [1,1,1];
  785. }
  786. def: InstRW<[SKLWriteResGroup53], (instregex "IST(T?)_FP(16|32|64)m",
  787. "IST_F(16|32)m")>;
  788. def SKLWriteResGroup54 : SchedWriteRes<[SKLPort0156]> {
  789. let Latency = 4;
  790. let NumMicroOps = 4;
  791. let ResourceCycles = [4];
  792. }
  793. def: InstRW<[SKLWriteResGroup54], (instrs FNCLEX)>;
  794. def SKLWriteResGroup55 : SchedWriteRes<[SKLPort6,SKLPort0156]> {
  795. let Latency = 4;
  796. let NumMicroOps = 4;
  797. let ResourceCycles = [1,3];
  798. }
  799. def: InstRW<[SKLWriteResGroup55], (instrs PAUSE)>;
  800. def SKLWriteResGroup56 : SchedWriteRes<[]> {
  801. let Latency = 0;
  802. let NumMicroOps = 4;
  803. let ResourceCycles = [];
  804. }
  805. def: InstRW<[SKLWriteResGroup56], (instrs VZEROUPPER)>;
  806. def SKLWriteResGroup57 : SchedWriteRes<[SKLPort1,SKLPort6,SKLPort0156]> {
  807. let Latency = 4;
  808. let NumMicroOps = 4;
  809. let ResourceCycles = [1,1,2];
  810. }
  811. def: InstRW<[SKLWriteResGroup57], (instregex "LAR(16|32|64)rr")>;
  812. def SKLWriteResGroup60 : SchedWriteRes<[SKLPort5,SKLPort01]> {
  813. let Latency = 5;
  814. let NumMicroOps = 2;
  815. let ResourceCycles = [1,1];
  816. }
  817. def: InstRW<[SKLWriteResGroup60], (instregex "MMX_CVT(T?)PS2PIrr")>;
  818. def SKLWriteResGroup61 : SchedWriteRes<[SKLPort1,SKLPort6,SKLPort06]> {
  819. let Latency = 5;
  820. let NumMicroOps = 3;
  821. let ResourceCycles = [1,1,1];
  822. }
  823. def: InstRW<[SKLWriteResGroup61], (instregex "STR(16|32|64)r")>;
  824. def SKLWriteResGroup63 : SchedWriteRes<[SKLPort06,SKLPort0156]> {
  825. let Latency = 5;
  826. let NumMicroOps = 5;
  827. let ResourceCycles = [1,4];
  828. }
  829. def: InstRW<[SKLWriteResGroup63], (instrs XSETBV)>;
  830. def SKLWriteResGroup65 : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort0156]> {
  831. let Latency = 5;
  832. let NumMicroOps = 6;
  833. let ResourceCycles = [1,1,4];
  834. }
  835. def: InstRW<[SKLWriteResGroup65], (instregex "PUSHF(16|64)")>;
  836. def SKLWriteResGroup67 : SchedWriteRes<[SKLPort23]> {
  837. let Latency = 6;
  838. let NumMicroOps = 1;
  839. let ResourceCycles = [1];
  840. }
  841. def: InstRW<[SKLWriteResGroup67], (instrs VBROADCASTSSrm,
  842. VPBROADCASTDrm,
  843. VPBROADCASTQrm)>;
  844. def: InstRW<[SKLWriteResGroup67], (instregex "(V?)MOVSHDUPrm",
  845. "(V?)MOVSLDUPrm",
  846. "(V?)MOVDDUPrm")>;
  847. def SKLWriteResGroup68 : SchedWriteRes<[SKLPort0]> {
  848. let Latency = 6;
  849. let NumMicroOps = 2;
  850. let ResourceCycles = [2];
  851. }
  852. def: InstRW<[SKLWriteResGroup68], (instrs MMX_CVTPI2PSrr)>;
  853. def SKLWriteResGroup69 : SchedWriteRes<[SKLPort0,SKLPort23]> {
  854. let Latency = 6;
  855. let NumMicroOps = 2;
  856. let ResourceCycles = [1,1];
  857. }
  858. def: InstRW<[SKLWriteResGroup69], (instrs MMX_PADDSBrm,
  859. MMX_PADDSWrm,
  860. MMX_PADDUSBrm,
  861. MMX_PADDUSWrm,
  862. MMX_PAVGBrm,
  863. MMX_PAVGWrm,
  864. MMX_PCMPEQBrm,
  865. MMX_PCMPEQDrm,
  866. MMX_PCMPEQWrm,
  867. MMX_PCMPGTBrm,
  868. MMX_PCMPGTDrm,
  869. MMX_PCMPGTWrm,
  870. MMX_PMAXSWrm,
  871. MMX_PMAXUBrm,
  872. MMX_PMINSWrm,
  873. MMX_PMINUBrm,
  874. MMX_PSUBSBrm,
  875. MMX_PSUBSWrm,
  876. MMX_PSUBUSBrm,
  877. MMX_PSUBUSWrm)>;
  878. def SKLWriteResGroup72 : SchedWriteRes<[SKLPort6,SKLPort23]> {
  879. let Latency = 6;
  880. let NumMicroOps = 2;
  881. let ResourceCycles = [1,1];
  882. }
  883. def: InstRW<[SKLWriteResGroup72], (instrs FARJMP64m)>;
  884. def: InstRW<[SKLWriteResGroup72], (instregex "JMP(16|32|64)m")>;
  885. def SKLWriteResGroup75 : SchedWriteRes<[SKLPort23,SKLPort15]> {
  886. let Latency = 6;
  887. let NumMicroOps = 2;
  888. let ResourceCycles = [1,1];
  889. }
  890. def: InstRW<[SKLWriteResGroup75], (instregex "ANDN(32|64)rm",
  891. "MOVBE(16|32|64)rm")>;
  892. def SKLWriteResGroup76 : SchedWriteRes<[SKLPort23,SKLPort0156]> {
  893. let Latency = 6;
  894. let NumMicroOps = 2;
  895. let ResourceCycles = [1,1];
  896. }
  897. def: InstRW<[SKLWriteResGroup76], (instrs POP16r, POP32r, POP64r)>;
  898. def: InstRW<[SKLWriteResGroup76], (instregex "POP(16|32|64)rmr")>;
  899. def SKLWriteResGroup78 : SchedWriteRes<[SKLPort5,SKLPort01]> {
  900. let Latency = 6;
  901. let NumMicroOps = 3;
  902. let ResourceCycles = [2,1];
  903. }
  904. def: InstRW<[SKLWriteResGroup78], (instregex "(V?)CVTSI642SSrr")>;
  905. def SKLWriteResGroup80 : SchedWriteRes<[SKLPort1,SKLPort6,SKLPort06,SKLPort0156]> {
  906. let Latency = 6;
  907. let NumMicroOps = 4;
  908. let ResourceCycles = [1,1,1,1];
  909. }
  910. def: InstRW<[SKLWriteResGroup80], (instregex "SLDT(16|32|64)r")>;
  911. def SKLWriteResGroup82 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort06]> {
  912. let Latency = 6;
  913. let NumMicroOps = 4;
  914. let ResourceCycles = [1,1,1,1];
  915. }
  916. def: InstRW<[SKLWriteResGroup82], (instregex "SAR(8|16|32|64)m(1|i)",
  917. "SHL(8|16|32|64)m(1|i)",
  918. "SHR(8|16|32|64)m(1|i)")>;
  919. def SKLWriteResGroup83 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort0156]> {
  920. let Latency = 6;
  921. let NumMicroOps = 4;
  922. let ResourceCycles = [1,1,1,1];
  923. }
  924. def: InstRW<[SKLWriteResGroup83], (instregex "POP(16|32|64)rmm",
  925. "PUSH(16|32|64)rmm")>;
  926. def SKLWriteResGroup84 : SchedWriteRes<[SKLPort6,SKLPort0156]> {
  927. let Latency = 6;
  928. let NumMicroOps = 6;
  929. let ResourceCycles = [1,5];
  930. }
  931. def: InstRW<[SKLWriteResGroup84], (instrs STD)>;
  932. def SKLWriteResGroup85 : SchedWriteRes<[SKLPort23]> {
  933. let Latency = 7;
  934. let NumMicroOps = 1;
  935. let ResourceCycles = [1];
  936. }
  937. def: InstRW<[SKLWriteResGroup85], (instregex "LD_F(32|64|80)m")>;
  938. def: InstRW<[SKLWriteResGroup85], (instrs VBROADCASTF128,
  939. VBROADCASTI128,
  940. VBROADCASTSDYrm,
  941. VBROADCASTSSYrm,
  942. VMOVDDUPYrm,
  943. VMOVSHDUPYrm,
  944. VMOVSLDUPYrm,
  945. VPBROADCASTDYrm,
  946. VPBROADCASTQYrm)>;
  947. def SKLWriteResGroup88 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  948. let Latency = 6;
  949. let NumMicroOps = 2;
  950. let ResourceCycles = [1,1];
  951. }
  952. def: InstRW<[SKLWriteResGroup88], (instregex "(V?)PMOV(SX|ZX)BDrm",
  953. "(V?)PMOV(SX|ZX)BQrm",
  954. "(V?)PMOV(SX|ZX)BWrm",
  955. "(V?)PMOV(SX|ZX)DQrm",
  956. "(V?)PMOV(SX|ZX)WDrm",
  957. "(V?)PMOV(SX|ZX)WQrm")>;
  958. def SKLWriteResGroup91 : SchedWriteRes<[SKLPort23,SKLPort015]> {
  959. let Latency = 7;
  960. let NumMicroOps = 2;
  961. let ResourceCycles = [1,1];
  962. }
  963. def: InstRW<[SKLWriteResGroup91], (instrs VINSERTF128rm,
  964. VINSERTI128rm,
  965. VPBLENDDrmi)>;
  966. def: InstRW<[SKLWriteResGroup91, ReadAfterVecXLd],
  967. (instregex "(V?)PADD(B|D|Q|W)rm",
  968. "(V?)PSUB(B|D|Q|W)rm")>;
  969. def SKLWriteResGroup92 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  970. let Latency = 7;
  971. let NumMicroOps = 3;
  972. let ResourceCycles = [2,1];
  973. }
  974. def: InstRW<[SKLWriteResGroup92], (instrs MMX_PACKSSDWrm,
  975. MMX_PACKSSWBrm,
  976. MMX_PACKUSWBrm)>;
  977. def SKLWriteResGroup94 : SchedWriteRes<[SKLPort23,SKLPort0156]> {
  978. let Latency = 7;
  979. let NumMicroOps = 3;
  980. let ResourceCycles = [1,2];
  981. }
  982. def: InstRW<[SKLWriteResGroup94], (instrs LEAVE, LEAVE64,
  983. SCASB, SCASL, SCASQ, SCASW)>;
  984. def SKLWriteResGroup95 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort01]> {
  985. let Latency = 7;
  986. let NumMicroOps = 3;
  987. let ResourceCycles = [1,1,1];
  988. }
  989. def: InstRW<[SKLWriteResGroup95], (instregex "(V?)CVT(T?)SS2SI64rr")>;
  990. def SKLWriteResGroup96 : SchedWriteRes<[SKLPort0,SKLPort23,SKLPort05]> {
  991. let Latency = 7;
  992. let NumMicroOps = 3;
  993. let ResourceCycles = [1,1,1];
  994. }
  995. def: InstRW<[SKLWriteResGroup96], (instrs FLDCW16m)>;
  996. def SKLWriteResGroup98 : SchedWriteRes<[SKLPort6,SKLPort23,SKLPort0156]> {
  997. let Latency = 7;
  998. let NumMicroOps = 3;
  999. let ResourceCycles = [1,1,1];
  1000. }
  1001. def: InstRW<[SKLWriteResGroup98], (instrs LRET64, RET64)>;
  1002. def SKLWriteResGroup100 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort06]> {
  1003. let Latency = 7;
  1004. let NumMicroOps = 5;
  1005. let ResourceCycles = [1,1,1,2];
  1006. }
  1007. def: InstRW<[SKLWriteResGroup100], (instregex "ROL(8|16|32|64)m(1|i)",
  1008. "ROR(8|16|32|64)m(1|i)")>;
  1009. def SKLWriteResGroup100_1 : SchedWriteRes<[SKLPort06]> {
  1010. let Latency = 2;
  1011. let NumMicroOps = 2;
  1012. let ResourceCycles = [2];
  1013. }
  1014. def: InstRW<[SKLWriteResGroup100_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1,
  1015. ROR8r1, ROR16r1, ROR32r1, ROR64r1)>;
  1016. def SKLWriteResGroup101 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort0156]> {
  1017. let Latency = 7;
  1018. let NumMicroOps = 5;
  1019. let ResourceCycles = [1,1,1,2];
  1020. }
  1021. def: InstRW<[SKLWriteResGroup101], (instregex "XADD(8|16|32|64)rm")>;
  1022. def SKLWriteResGroup102 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort23,SKLPort237,SKLPort0156]> {
  1023. let Latency = 7;
  1024. let NumMicroOps = 5;
  1025. let ResourceCycles = [1,1,1,1,1];
  1026. }
  1027. def: InstRW<[SKLWriteResGroup102], (instregex "CALL(16|32|64)m")>;
  1028. def: InstRW<[SKLWriteResGroup102], (instrs FARCALL64m)>;
  1029. def SKLWriteResGroup103 : SchedWriteRes<[SKLPort6,SKLPort06,SKLPort15,SKLPort0156]> {
  1030. let Latency = 7;
  1031. let NumMicroOps = 7;
  1032. let ResourceCycles = [1,3,1,2];
  1033. }
  1034. def: InstRW<[SKLWriteResGroup103], (instrs LOOP)>;
  1035. def SKLWriteResGroup107 : SchedWriteRes<[SKLPort1,SKLPort23]> {
  1036. let Latency = 8;
  1037. let NumMicroOps = 2;
  1038. let ResourceCycles = [1,1];
  1039. }
  1040. def: InstRW<[SKLWriteResGroup107], (instregex "PDEP(32|64)rm",
  1041. "PEXT(32|64)rm")>;
  1042. def SKLWriteResGroup108 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  1043. let Latency = 8;
  1044. let NumMicroOps = 2;
  1045. let ResourceCycles = [1,1];
  1046. }
  1047. def: InstRW<[SKLWriteResGroup108], (instregex "FCOM(P?)(32|64)m")>;
  1048. def: InstRW<[SKLWriteResGroup108], (instrs VPBROADCASTBYrm,
  1049. VPBROADCASTWYrm,
  1050. VPMOVSXBDYrm,
  1051. VPMOVSXBQYrm,
  1052. VPMOVSXWQYrm)>;
  1053. def SKLWriteResGroup110 : SchedWriteRes<[SKLPort23,SKLPort015]> {
  1054. let Latency = 8;
  1055. let NumMicroOps = 2;
  1056. let ResourceCycles = [1,1];
  1057. }
  1058. def: InstRW<[SKLWriteResGroup110], (instrs VPBLENDDYrmi)>;
  1059. def: InstRW<[SKLWriteResGroup110, ReadAfterVecYLd],
  1060. (instregex "VPADD(B|D|Q|W)Yrm",
  1061. "VPSUB(B|D|Q|W)Yrm")>;
  1062. def SKLWriteResGroup112 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort23]> {
  1063. let Latency = 8;
  1064. let NumMicroOps = 4;
  1065. let ResourceCycles = [1,2,1];
  1066. }
  1067. def: InstRW<[SKLWriteResGroup112], (instregex "MMX_PH(ADD|SUB)SWrm")>;
  1068. def SKLWriteResGroup116 : SchedWriteRes<[SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1069. let Latency = 8;
  1070. let NumMicroOps = 5;
  1071. let ResourceCycles = [1,1,1,2];
  1072. }
  1073. def: InstRW<[SKLWriteResGroup116], (instregex "RCL(8|16|32|64)m(1|i)",
  1074. "RCR(8|16|32|64)m(1|i)")>;
  1075. def SKLWriteResGroup117 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort06]> {
  1076. let Latency = 8;
  1077. let NumMicroOps = 6;
  1078. let ResourceCycles = [1,1,1,3];
  1079. }
  1080. def: InstRW<[SKLWriteResGroup117], (instregex "ROL(8|16|32|64)mCL",
  1081. "ROR(8|16|32|64)mCL",
  1082. "SAR(8|16|32|64)mCL",
  1083. "SHL(8|16|32|64)mCL",
  1084. "SHR(8|16|32|64)mCL")>;
  1085. def SKLWriteResGroup119 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1086. let Latency = 8;
  1087. let NumMicroOps = 6;
  1088. let ResourceCycles = [1,1,1,2,1];
  1089. }
  1090. def: SchedAlias<WriteADCRMW, SKLWriteResGroup119>;
  1091. def SKLWriteResGroup120 : SchedWriteRes<[SKLPort0,SKLPort23]> {
  1092. let Latency = 9;
  1093. let NumMicroOps = 2;
  1094. let ResourceCycles = [1,1];
  1095. }
  1096. def: InstRW<[SKLWriteResGroup120], (instrs MMX_CVTPI2PSrm)>;
  1097. def SKLWriteResGroup121 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  1098. let Latency = 9;
  1099. let NumMicroOps = 2;
  1100. let ResourceCycles = [1,1];
  1101. }
  1102. def: InstRW<[SKLWriteResGroup121], (instrs PCMPGTQrm,
  1103. VPCMPGTQrm,
  1104. VPMOVSXBWYrm,
  1105. VPMOVSXDQYrm,
  1106. VPMOVSXWDYrm,
  1107. VPMOVZXWDYrm)>;
  1108. def SKLWriteResGroup123 : SchedWriteRes<[SKLPort23,SKLPort01]> {
  1109. let Latency = 9;
  1110. let NumMicroOps = 2;
  1111. let ResourceCycles = [1,1];
  1112. }
  1113. def: InstRW<[SKLWriteResGroup123], (instregex "MMX_CVT(T?)PS2PIrm")>;
  1114. def SKLWriteResGroup128 : SchedWriteRes<[SKLPort5,SKLPort01,SKLPort23]> {
  1115. let Latency = 9;
  1116. let NumMicroOps = 4;
  1117. let ResourceCycles = [2,1,1];
  1118. }
  1119. def: InstRW<[SKLWriteResGroup128], (instregex "(V?)PHADDSWrm",
  1120. "(V?)PHSUBSWrm")>;
  1121. def SKLWriteResGroup131 : SchedWriteRes<[SKLPort1,SKLPort6,SKLPort23,SKLPort0156]> {
  1122. let Latency = 9;
  1123. let NumMicroOps = 5;
  1124. let ResourceCycles = [1,2,1,1];
  1125. }
  1126. def: InstRW<[SKLWriteResGroup131], (instregex "LAR(16|32|64)rm",
  1127. "LSL(16|32|64)rm")>;
  1128. def SKLWriteResGroup133 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  1129. let Latency = 10;
  1130. let NumMicroOps = 2;
  1131. let ResourceCycles = [1,1];
  1132. }
  1133. def: InstRW<[SKLWriteResGroup133], (instregex "(ADD|SUB|SUBR)_F(32|64)m",
  1134. "ILD_F(16|32|64)m")>;
  1135. def: InstRW<[SKLWriteResGroup133], (instrs VPCMPGTQYrm)>;
  1136. def SKLWriteResGroup138 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort23]> {
  1137. let Latency = 10;
  1138. let NumMicroOps = 3;
  1139. let ResourceCycles = [1,1,1];
  1140. }
  1141. def: InstRW<[SKLWriteResGroup138], (instrs MMX_CVTPI2PDrm)>;
  1142. def SKLWriteResGroup140 : SchedWriteRes<[SKLPort5,SKLPort01,SKLPort23]> {
  1143. let Latency = 10;
  1144. let NumMicroOps = 4;
  1145. let ResourceCycles = [2,1,1];
  1146. }
  1147. def: InstRW<[SKLWriteResGroup140], (instrs VPHADDSWYrm,
  1148. VPHSUBSWYrm)>;
  1149. def SKLWriteResGroup143 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1150. let Latency = 10;
  1151. let NumMicroOps = 8;
  1152. let ResourceCycles = [1,1,1,1,1,3];
  1153. }
  1154. def: InstRW<[SKLWriteResGroup143], (instregex "XCHG(8|16|32|64)rm")>;
  1155. def SKLWriteResGroup146 : SchedWriteRes<[SKLPort0,SKLPort23]> {
  1156. let Latency = 11;
  1157. let NumMicroOps = 2;
  1158. let ResourceCycles = [1,1];
  1159. }
  1160. def: InstRW<[SKLWriteResGroup146], (instregex "MUL_F(32|64)m")>;
  1161. def SKLWriteResGroup149 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  1162. let Latency = 11;
  1163. let NumMicroOps = 3;
  1164. let ResourceCycles = [2,1];
  1165. }
  1166. def: InstRW<[SKLWriteResGroup149], (instregex "FICOM(P?)(16|32)m")>;
  1167. def SKLWriteResGroup154 : SchedWriteRes<[SKLPort1,SKLPort06,SKLPort0156]> {
  1168. let Latency = 11;
  1169. let NumMicroOps = 7;
  1170. let ResourceCycles = [2,3,2];
  1171. }
  1172. def: InstRW<[SKLWriteResGroup154], (instregex "RCL(16|32|64)rCL",
  1173. "RCR(16|32|64)rCL")>;
  1174. def SKLWriteResGroup155 : SchedWriteRes<[SKLPort1,SKLPort06,SKLPort15,SKLPort0156]> {
  1175. let Latency = 11;
  1176. let NumMicroOps = 9;
  1177. let ResourceCycles = [1,5,1,2];
  1178. }
  1179. def: InstRW<[SKLWriteResGroup155], (instrs RCL8rCL)>;
  1180. def SKLWriteResGroup156 : SchedWriteRes<[SKLPort06,SKLPort0156]> {
  1181. let Latency = 11;
  1182. let NumMicroOps = 11;
  1183. let ResourceCycles = [2,9];
  1184. }
  1185. def: InstRW<[SKLWriteResGroup156], (instrs LOOPE, LOOPNE)>;
  1186. def SKLWriteResGroup162 : SchedWriteRes<[SKLPort5,SKLPort23]> {
  1187. let Latency = 13;
  1188. let NumMicroOps = 3;
  1189. let ResourceCycles = [2,1];
  1190. }
  1191. def: InstRW<[SKLWriteResGroup162], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>;
  1192. def SKLWriteResGroup169 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort23]> {
  1193. let Latency = 14;
  1194. let NumMicroOps = 3;
  1195. let ResourceCycles = [1,1,1];
  1196. }
  1197. def: InstRW<[SKLWriteResGroup169], (instregex "MUL_FI(16|32)m")>;
  1198. def SKLWriteResGroup170 : SchedWriteRes<[SKLPort1,SKLPort06,SKLPort15,SKLPort0156]> {
  1199. let Latency = 14;
  1200. let NumMicroOps = 10;
  1201. let ResourceCycles = [2,4,1,3];
  1202. }
  1203. def: InstRW<[SKLWriteResGroup170], (instrs RCR8rCL)>;
  1204. def SKLWriteResGroup171 : SchedWriteRes<[SKLPort0]> {
  1205. let Latency = 15;
  1206. let NumMicroOps = 1;
  1207. let ResourceCycles = [1];
  1208. }
  1209. def: InstRW<[SKLWriteResGroup171], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>;
  1210. def SKLWriteResGroup174 : SchedWriteRes<[SKLPort1,SKLPort23,SKLPort237,SKLPort06,SKLPort15,SKLPort0156]> {
  1211. let Latency = 15;
  1212. let NumMicroOps = 10;
  1213. let ResourceCycles = [1,1,1,5,1,1];
  1214. }
  1215. def: InstRW<[SKLWriteResGroup174], (instregex "RCL(8|16|32|64)mCL")>;
  1216. def SKLWriteResGroup177 : SchedWriteRes<[SKLPort4,SKLPort23,SKLPort237,SKLPort06,SKLPort15,SKLPort0156]> {
  1217. let Latency = 16;
  1218. let NumMicroOps = 14;
  1219. let ResourceCycles = [1,1,1,4,2,5];
  1220. }
  1221. def: InstRW<[SKLWriteResGroup177], (instrs CMPXCHG8B)>;
  1222. def SKLWriteResGroup178 : SchedWriteRes<[SKLPort0156]> {
  1223. let Latency = 16;
  1224. let NumMicroOps = 16;
  1225. let ResourceCycles = [16];
  1226. }
  1227. def: InstRW<[SKLWriteResGroup178], (instrs VZEROALL)>;
  1228. def SKLWriteResGroup180 : SchedWriteRes<[SKLPort0,SKLPort1,SKLPort5,SKLPort6,SKLPort05,SKLPort0156]> {
  1229. let Latency = 17;
  1230. let NumMicroOps = 15;
  1231. let ResourceCycles = [2,1,2,4,2,4];
  1232. }
  1233. def: InstRW<[SKLWriteResGroup180], (instrs XCH_F)>;
  1234. def SKLWriteResGroup184 : SchedWriteRes<[SKLPort5,SKLPort6,SKLPort06,SKLPort0156]> {
  1235. let Latency = 18;
  1236. let NumMicroOps = 8;
  1237. let ResourceCycles = [1,1,1,5];
  1238. }
  1239. def: InstRW<[SKLWriteResGroup184], (instrs CPUID, RDTSC)>;
  1240. def SKLWriteResGroup185 : SchedWriteRes<[SKLPort1,SKLPort23,SKLPort237,SKLPort06,SKLPort15,SKLPort0156]> {
  1241. let Latency = 18;
  1242. let NumMicroOps = 11;
  1243. let ResourceCycles = [2,1,1,4,1,2];
  1244. }
  1245. def: InstRW<[SKLWriteResGroup185], (instregex "RCR(8|16|32|64)mCL")>;
  1246. def SKLWriteResGroup189 : SchedWriteRes<[SKLPort0]> {
  1247. let Latency = 20;
  1248. let NumMicroOps = 1;
  1249. let ResourceCycles = [1];
  1250. }
  1251. def: InstRW<[SKLWriteResGroup189], (instregex "DIV_(FPrST0|FST0r|FrST0)")>;
  1252. def SKLWriteResGroup192 : SchedWriteRes<[SKLPort4,SKLPort5,SKLPort6,SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1253. let Latency = 20;
  1254. let NumMicroOps = 8;
  1255. let ResourceCycles = [1,1,1,1,1,1,2];
  1256. }
  1257. def: InstRW<[SKLWriteResGroup192], (instrs INSB, INSL, INSW)>;
  1258. def SKLWriteResGroup193 : SchedWriteRes<[SKLPort5,SKLPort6,SKLPort0156]> {
  1259. let Latency = 20;
  1260. let NumMicroOps = 10;
  1261. let ResourceCycles = [1,2,7];
  1262. }
  1263. def: InstRW<[SKLWriteResGroup193], (instrs MWAITrr)>;
  1264. def SKLWriteResGroup196 : SchedWriteRes<[SKLPort0,SKLPort23]> {
  1265. let Latency = 22;
  1266. let NumMicroOps = 2;
  1267. let ResourceCycles = [1,1];
  1268. }
  1269. def: InstRW<[SKLWriteResGroup196], (instregex "DIV_F(32|64)m")>;
  1270. def SKLWriteResGroupVEX2 : SchedWriteRes<[SKLPort0, SKLPort23, SKLPort5, SKLPort015]> {
  1271. let Latency = 18;
  1272. let NumMicroOps = 5; // 2 uops perform multiple loads
  1273. let ResourceCycles = [1,2,1,1];
  1274. }
  1275. def: InstRW<[SKLWriteResGroupVEX2], (instrs VGATHERDPDrm, VPGATHERDQrm,
  1276. VGATHERQPDrm, VPGATHERQQrm,
  1277. VGATHERQPSrm, VPGATHERQDrm)>;
  1278. def SKLWriteResGroupVEX4 : SchedWriteRes<[SKLPort0, SKLPort23, SKLPort5, SKLPort015]> {
  1279. let Latency = 20;
  1280. let NumMicroOps = 5; // 2 uops peform multiple loads
  1281. let ResourceCycles = [1,4,1,1];
  1282. }
  1283. def: InstRW<[SKLWriteResGroupVEX4], (instrs VGATHERDPDYrm, VPGATHERDQYrm,
  1284. VGATHERDPSrm, VPGATHERDDrm,
  1285. VGATHERQPDYrm, VPGATHERQQYrm,
  1286. VGATHERQPSYrm, VPGATHERQDYrm)>;
  1287. def SKLWriteResGroupVEX8 : SchedWriteRes<[SKLPort0, SKLPort23, SKLPort5, SKLPort015]> {
  1288. let Latency = 22;
  1289. let NumMicroOps = 5; // 2 uops perform multiple loads
  1290. let ResourceCycles = [1,8,1,1];
  1291. }
  1292. def: InstRW<[SKLWriteResGroupVEX8], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>;
  1293. def SKLWriteResGroup198 : SchedWriteRes<[SKLPort0,SKLPort4,SKLPort5,SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1294. let Latency = 23;
  1295. let NumMicroOps = 19;
  1296. let ResourceCycles = [2,1,4,1,1,4,6];
  1297. }
  1298. def: InstRW<[SKLWriteResGroup198], (instrs CMPXCHG16B)>;
  1299. def SKLWriteResGroup202 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort23]> {
  1300. let Latency = 25;
  1301. let NumMicroOps = 3;
  1302. let ResourceCycles = [1,1,1];
  1303. }
  1304. def: InstRW<[SKLWriteResGroup202], (instregex "DIV_FI(16|32)m")>;
  1305. def SKLWriteResGroup206 : SchedWriteRes<[SKLPort0,SKLPort23]> {
  1306. let Latency = 27;
  1307. let NumMicroOps = 2;
  1308. let ResourceCycles = [1,1];
  1309. }
  1310. def: InstRW<[SKLWriteResGroup206], (instregex "DIVR_F(32|64)m")>;
  1311. def SKLWriteResGroup208 : SchedWriteRes<[SKLPort0,SKLPort5,SKLPort23]> {
  1312. let Latency = 30;
  1313. let NumMicroOps = 3;
  1314. let ResourceCycles = [1,1,1];
  1315. }
  1316. def: InstRW<[SKLWriteResGroup208], (instregex "DIVR_FI(16|32)m")>;
  1317. def SKLWriteResGroup209 : SchedWriteRes<[SKLPort5,SKLPort6,SKLPort23,SKLPort06,SKLPort0156]> {
  1318. let Latency = 35;
  1319. let NumMicroOps = 23;
  1320. let ResourceCycles = [1,5,3,4,10];
  1321. }
  1322. def: InstRW<[SKLWriteResGroup209], (instregex "IN(8|16|32)ri",
  1323. "IN(8|16|32)rr")>;
  1324. def SKLWriteResGroup210 : SchedWriteRes<[SKLPort5,SKLPort6,SKLPort23,SKLPort237,SKLPort06,SKLPort0156]> {
  1325. let Latency = 35;
  1326. let NumMicroOps = 23;
  1327. let ResourceCycles = [1,5,2,1,4,10];
  1328. }
  1329. def: InstRW<[SKLWriteResGroup210], (instregex "OUT(8|16|32)ir",
  1330. "OUT(8|16|32)rr")>;
  1331. def SKLWriteResGroup211 : SchedWriteRes<[SKLPort1,SKLPort6,SKLPort23,SKLPort0156]> {
  1332. let Latency = 37;
  1333. let NumMicroOps = 31;
  1334. let ResourceCycles = [1,8,1,21];
  1335. }
  1336. def: InstRW<[SKLWriteResGroup211], (instregex "XRSTOR(64)?")>;
  1337. def SKLWriteResGroup212 : SchedWriteRes<[SKLPort1,SKLPort4,SKLPort5,SKLPort6,SKLPort23,SKLPort237,SKLPort15,SKLPort0156]> {
  1338. let Latency = 40;
  1339. let NumMicroOps = 18;
  1340. let ResourceCycles = [1,1,2,3,1,1,1,8];
  1341. }
  1342. def: InstRW<[SKLWriteResGroup212], (instrs VMCLEARm)>;
  1343. def SKLWriteResGroup213 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort23,SKLPort237,SKLPort0156]> {
  1344. let Latency = 41;
  1345. let NumMicroOps = 39;
  1346. let ResourceCycles = [1,10,1,1,26];
  1347. }
  1348. def: InstRW<[SKLWriteResGroup213], (instrs XSAVE64)>;
  1349. def SKLWriteResGroup214 : SchedWriteRes<[SKLPort5,SKLPort0156]> {
  1350. let Latency = 42;
  1351. let NumMicroOps = 22;
  1352. let ResourceCycles = [2,20];
  1353. }
  1354. def: InstRW<[SKLWriteResGroup214], (instrs RDTSCP)>;
  1355. def SKLWriteResGroup215 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort23,SKLPort237,SKLPort0156]> {
  1356. let Latency = 42;
  1357. let NumMicroOps = 40;
  1358. let ResourceCycles = [1,11,1,1,26];
  1359. }
  1360. def: InstRW<[SKLWriteResGroup215], (instrs XSAVE)>;
  1361. def: InstRW<[SKLWriteResGroup215], (instregex "XSAVEC", "XSAVES")>;
  1362. def SKLWriteResGroup216 : SchedWriteRes<[SKLPort4,SKLPort6,SKLPort23,SKLPort237,SKLPort0156]> {
  1363. let Latency = 46;
  1364. let NumMicroOps = 44;
  1365. let ResourceCycles = [1,11,1,1,30];
  1366. }
  1367. def: InstRW<[SKLWriteResGroup216], (instregex "XSAVEOPT")>;
  1368. def SKLWriteResGroup217 : SchedWriteRes<[SKLPort0,SKLPort23,SKLPort05,SKLPort06,SKLPort0156]> {
  1369. let Latency = 62;
  1370. let NumMicroOps = 64;
  1371. let ResourceCycles = [2,8,5,10,39];
  1372. }
  1373. def: InstRW<[SKLWriteResGroup217], (instrs FLDENVm)>;
  1374. def SKLWriteResGroup218 : SchedWriteRes<[SKLPort0,SKLPort6,SKLPort23,SKLPort05,SKLPort06,SKLPort15,SKLPort0156]> {
  1375. let Latency = 63;
  1376. let NumMicroOps = 88;
  1377. let ResourceCycles = [4,4,31,1,2,1,45];
  1378. }
  1379. def: InstRW<[SKLWriteResGroup218], (instrs FXRSTOR64)>;
  1380. def SKLWriteResGroup219 : SchedWriteRes<[SKLPort0,SKLPort6,SKLPort23,SKLPort05,SKLPort06,SKLPort15,SKLPort0156]> {
  1381. let Latency = 63;
  1382. let NumMicroOps = 90;
  1383. let ResourceCycles = [4,2,33,1,2,1,47];
  1384. }
  1385. def: InstRW<[SKLWriteResGroup219], (instrs FXRSTOR)>;
  1386. def SKLWriteResGroup220 : SchedWriteRes<[SKLPort5,SKLPort05,SKLPort0156]> {
  1387. let Latency = 75;
  1388. let NumMicroOps = 15;
  1389. let ResourceCycles = [6,3,6];
  1390. }
  1391. def: InstRW<[SKLWriteResGroup220], (instrs FNINIT)>;
  1392. def SKLWriteResGroup223 : SchedWriteRes<[SKLPort0,SKLPort1,SKLPort4,SKLPort5,SKLPort6,SKLPort237,SKLPort06,SKLPort0156]> {
  1393. let Latency = 106;
  1394. let NumMicroOps = 100;
  1395. let ResourceCycles = [9,1,11,16,1,11,21,30];
  1396. }
  1397. def: InstRW<[SKLWriteResGroup223], (instrs FSTENVm)>;
  1398. def: InstRW<[WriteZero], (instrs CLC)>;
  1399. // Instruction variants handled by the renamer. These might not need execution
  1400. // ports in certain conditions.
  1401. // See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs",
  1402. // section "Skylake Pipeline" > "Register allocation and renaming".
  1403. // These can be investigated with llvm-exegesis, e.g.
  1404. // echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
  1405. // echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
  1406. def SKLWriteZeroLatency : SchedWriteRes<[]> {
  1407. let Latency = 0;
  1408. }
  1409. def SKLWriteZeroIdiom : SchedWriteVariant<[
  1410. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1411. SchedVar<NoSchedPred, [WriteALU]>
  1412. ]>;
  1413. def : InstRW<[SKLWriteZeroIdiom], (instrs SUB32rr, SUB64rr,
  1414. XOR32rr, XOR64rr)>;
  1415. def SKLWriteFZeroIdiom : SchedWriteVariant<[
  1416. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1417. SchedVar<NoSchedPred, [WriteFLogic]>
  1418. ]>;
  1419. def : InstRW<[SKLWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr,
  1420. VXORPDrr)>;
  1421. def SKLWriteFZeroIdiomY : SchedWriteVariant<[
  1422. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1423. SchedVar<NoSchedPred, [WriteFLogicY]>
  1424. ]>;
  1425. def : InstRW<[SKLWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>;
  1426. def SKLWriteVZeroIdiomLogicX : SchedWriteVariant<[
  1427. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1428. SchedVar<NoSchedPred, [WriteVecLogicX]>
  1429. ]>;
  1430. def : InstRW<[SKLWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>;
  1431. def SKLWriteVZeroIdiomLogicY : SchedWriteVariant<[
  1432. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1433. SchedVar<NoSchedPred, [WriteVecLogicY]>
  1434. ]>;
  1435. def : InstRW<[SKLWriteVZeroIdiomLogicY], (instrs VPXORYrr)>;
  1436. def SKLWriteVZeroIdiomALUX : SchedWriteVariant<[
  1437. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1438. SchedVar<NoSchedPred, [WriteVecALUX]>
  1439. ]>;
  1440. def : InstRW<[SKLWriteVZeroIdiomALUX], (instrs PCMPGTBrr, VPCMPGTBrr,
  1441. PCMPGTDrr, VPCMPGTDrr,
  1442. PCMPGTWrr, VPCMPGTWrr)>;
  1443. def SKLWriteVZeroIdiomALUY : SchedWriteVariant<[
  1444. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1445. SchedVar<NoSchedPred, [WriteVecALUY]>
  1446. ]>;
  1447. def : InstRW<[SKLWriteVZeroIdiomALUY], (instrs VPCMPGTBYrr,
  1448. VPCMPGTDYrr,
  1449. VPCMPGTWYrr)>;
  1450. def SKLWritePSUB : SchedWriteRes<[SKLPort015]> {
  1451. let Latency = 1;
  1452. let NumMicroOps = 1;
  1453. let ResourceCycles = [1];
  1454. }
  1455. def SKLWriteVZeroIdiomPSUB : SchedWriteVariant<[
  1456. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1457. SchedVar<NoSchedPred, [SKLWritePSUB]>
  1458. ]>;
  1459. def : InstRW<[SKLWriteVZeroIdiomPSUB], (instrs PSUBBrr, VPSUBBrr,
  1460. PSUBDrr, VPSUBDrr,
  1461. PSUBQrr, VPSUBQrr,
  1462. PSUBWrr, VPSUBWrr,
  1463. VPSUBBYrr,
  1464. VPSUBDYrr,
  1465. VPSUBQYrr,
  1466. VPSUBWYrr)>;
  1467. def SKLWritePCMPGTQ : SchedWriteRes<[SKLPort5]> {
  1468. let Latency = 3;
  1469. let NumMicroOps = 1;
  1470. let ResourceCycles = [1];
  1471. }
  1472. def SKLWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[
  1473. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [SKLWriteZeroLatency]>,
  1474. SchedVar<NoSchedPred, [SKLWritePCMPGTQ]>
  1475. ]>;
  1476. def : InstRW<[SKLWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr,
  1477. VPCMPGTQYrr)>;
  1478. // CMOVs that use both Z and C flag require an extra uop.
  1479. def SKLWriteCMOVA_CMOVBErr : SchedWriteRes<[SKLPort06]> {
  1480. let Latency = 2;
  1481. let ResourceCycles = [2];
  1482. let NumMicroOps = 2;
  1483. }
  1484. def SKLWriteCMOVA_CMOVBErm : SchedWriteRes<[SKLPort23,SKLPort06]> {
  1485. let Latency = 7;
  1486. let ResourceCycles = [1,2];
  1487. let NumMicroOps = 3;
  1488. }
  1489. def SKLCMOVA_CMOVBErr : SchedWriteVariant<[
  1490. SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [SKLWriteCMOVA_CMOVBErr]>,
  1491. SchedVar<NoSchedPred, [WriteCMOV]>
  1492. ]>;
  1493. def SKLCMOVA_CMOVBErm : SchedWriteVariant<[
  1494. SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [SKLWriteCMOVA_CMOVBErm]>,
  1495. SchedVar<NoSchedPred, [WriteCMOV.Folded]>
  1496. ]>;
  1497. def : InstRW<[SKLCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>;
  1498. def : InstRW<[SKLCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>;
  1499. // SETCCs that use both Z and C flag require an extra uop.
  1500. def SKLWriteSETA_SETBEr : SchedWriteRes<[SKLPort06]> {
  1501. let Latency = 2;
  1502. let ResourceCycles = [2];
  1503. let NumMicroOps = 2;
  1504. }
  1505. def SKLWriteSETA_SETBEm : SchedWriteRes<[SKLPort4,SKLPort237,SKLPort06]> {
  1506. let Latency = 3;
  1507. let ResourceCycles = [1,1,2];
  1508. let NumMicroOps = 4;
  1509. }
  1510. def SKLSETA_SETBErr : SchedWriteVariant<[
  1511. SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [SKLWriteSETA_SETBEr]>,
  1512. SchedVar<NoSchedPred, [WriteSETCC]>
  1513. ]>;
  1514. def SKLSETA_SETBErm : SchedWriteVariant<[
  1515. SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [SKLWriteSETA_SETBEm]>,
  1516. SchedVar<NoSchedPred, [WriteSETCCStore]>
  1517. ]>;
  1518. def : InstRW<[SKLSETA_SETBErr], (instrs SETCCr)>;
  1519. def : InstRW<[SKLSETA_SETBErm], (instrs SETCCm)>;
  1520. ///////////////////////////////////////////////////////////////////////////////
  1521. // Dependency breaking instructions.
  1522. ///////////////////////////////////////////////////////////////////////////////
  1523. def : IsZeroIdiomFunction<[
  1524. // GPR Zero-idioms.
  1525. DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>,
  1526. // SSE Zero-idioms.
  1527. DepBreakingClass<[
  1528. // fp variants.
  1529. XORPSrr, XORPDrr,
  1530. // int variants.
  1531. PXORrr,
  1532. PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr,
  1533. PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr
  1534. ], ZeroIdiomPredicate>,
  1535. // AVX Zero-idioms.
  1536. DepBreakingClass<[
  1537. // xmm fp variants.
  1538. VXORPSrr, VXORPDrr,
  1539. // xmm int variants.
  1540. VPXORrr,
  1541. VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr,
  1542. VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr,
  1543. // ymm variants.
  1544. VXORPSYrr, VXORPDYrr, VPXORYrr,
  1545. VPSUBBYrr, VPSUBWYrr, VPSUBDYrr, VPSUBQYrr,
  1546. VPCMPGTBYrr, VPCMPGTWYrr, VPCMPGTDYrr, VPCMPGTQYrr
  1547. ], ZeroIdiomPredicate>,
  1548. ]>;
  1549. } // SchedModel