X86SchedBroadwell.td 71 KB

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