X86SchedBroadwell.td 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  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, int LoadUOps = 1> {
  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, LoadUOps);
  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 : BWWriteResPair<WriteFSign, [BWPort5], 1>; // Floating point fabs/fchs.
  284. defm : X86WriteRes<WriteFRnd, [BWPort23], 6, [1], 1>; // Floating point rounding.
  285. defm : X86WriteRes<WriteFRndY, [BWPort23], 6, [1], 1>; // Floating point rounding (YMM/ZMM).
  286. defm : X86WriteResPairUnsupported<WriteFRndZ>;
  287. defm : X86WriteRes<WriteFRndLd, [BWPort1,BWPort23], 11, [2,1], 3>;
  288. defm : X86WriteRes<WriteFRndYLd, [BWPort1,BWPort23], 12, [2,1], 3>;
  289. defm : BWWriteResPair<WriteFLogic, [BWPort5], 1, [1], 1, 5>; // Floating point and/or/xor logicals.
  290. defm : BWWriteResPair<WriteFLogicY, [BWPort5], 1, [1], 1, 6>; // Floating point and/or/xor logicals (YMM/ZMM).
  291. defm : X86WriteResPairUnsupported<WriteFLogicZ>;
  292. defm : BWWriteResPair<WriteFTest, [BWPort0], 1, [1], 1, 5>; // Floating point TEST instructions.
  293. defm : BWWriteResPair<WriteFTestY, [BWPort0], 1, [1], 1, 6>; // Floating point TEST instructions (YMM/ZMM).
  294. defm : X86WriteResPairUnsupported<WriteFTestZ>;
  295. defm : BWWriteResPair<WriteFShuffle, [BWPort5], 1, [1], 1, 5>; // Floating point vector shuffles.
  296. defm : BWWriteResPair<WriteFShuffleY, [BWPort5], 1, [1], 1, 6>; // Floating point vector shuffles (YMM/ZMM).
  297. defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
  298. defm : BWWriteResPair<WriteFVarShuffle, [BWPort5], 1, [1], 1, 5>; // Floating point vector variable shuffles.
  299. defm : BWWriteResPair<WriteFVarShuffleY, [BWPort5], 1, [1], 1, 6>; // Floating point vector variable shuffles.
  300. defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
  301. defm : BWWriteResPair<WriteFBlend, [BWPort015], 1, [1], 1, 5>; // Floating point vector blends.
  302. defm : BWWriteResPair<WriteFBlendY, [BWPort015], 1, [1], 1, 6>; // Floating point vector blends.
  303. defm : X86WriteResPairUnsupported<WriteFBlendZ>;
  304. defm : BWWriteResPair<WriteFShuffle256, [BWPort5], 3, [1], 1, 6>; // Fp 256-bit width vector shuffles.
  305. defm : BWWriteResPair<WriteFVarShuffle256, [BWPort5], 3, [1], 1, 6>; // Fp 256-bit width vector variable shuffles.
  306. defm : BWWriteResPair<WriteFVarBlend, [BWPort5], 2, [2], 2, 5>; // Fp vector variable blends.
  307. defm : BWWriteResPair<WriteFVarBlendY, [BWPort5], 2, [2], 2, 6>; // Fp vector variable blends.
  308. defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
  309. // FMA Scheduling helper class.
  310. // class FMASC { X86FoldableSchedWrite Sched = WriteFAdd; }
  311. // Conversion between integer and float.
  312. defm : BWWriteResPair<WriteCvtSS2I, [BWPort1,BWPort0], 4, [1,1], 2, 5>;
  313. defm : BWWriteResPair<WriteCvtPS2I, [BWPort1], 3, [1], 1, 5>;
  314. defm : BWWriteResPair<WriteCvtPS2IY, [BWPort1], 3, [1], 1, 6>;
  315. defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
  316. defm : BWWriteResPair<WriteCvtSD2I, [BWPort1,BWPort0], 4, [1,1], 2, 5>;
  317. defm : BWWriteResPair<WriteCvtPD2I, [BWPort1,BWPort5], 4, [1,1], 2, 5>;
  318. defm : BWWriteResPair<WriteCvtPD2IY, [BWPort1,BWPort5], 6, [1,1], 2, 6>;
  319. defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
  320. defm : X86WriteRes<WriteCvtI2SS, [BWPort1,BWPort5], 4, [1,1], 2>;
  321. defm : X86WriteRes<WriteCvtI2SSLd, [BWPort1,BWPort23], 9, [1,1], 2>;
  322. defm : BWWriteResPair<WriteCvtI2PS, [BWPort1], 3>;
  323. defm : BWWriteResPair<WriteCvtI2PSY, [BWPort1], 3, [1], 1, 6>;
  324. defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
  325. defm : X86WriteRes<WriteCvtI2SD, [BWPort1,BWPort5], 4, [1,1], 2>;
  326. defm : X86WriteRes<WriteCvtI2SDLd, [BWPort1,BWPort23], 9, [1,1], 2>;
  327. defm : BWWriteResPair<WriteCvtI2PD, [BWPort1,BWPort5], 4, [1,1], 2, 5>;
  328. defm : BWWriteResPair<WriteCvtI2PDY, [BWPort1,BWPort5], 6, [1,1], 2, 5>;
  329. defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
  330. defm : X86WriteRes<WriteCvtSS2SD, [BWPort0,BWPort5], 2, [1,1], 2>;
  331. defm : X86WriteRes<WriteCvtSS2SDLd, [BWPort0,BWPort23], 6, [1,1], 2>;
  332. defm : X86WriteRes<WriteCvtPS2PD, [BWPort0,BWPort5], 2, [1,1], 2>;
  333. defm : X86WriteRes<WriteCvtPS2PDLd, [BWPort0,BWPort23], 6, [1,1], 2>;
  334. defm : BWWriteResPair<WriteCvtPS2PDY, [BWPort0,BWPort5], 4, [1,1], 2, 5>;
  335. defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
  336. defm : BWWriteResPair<WriteCvtSD2SS, [BWPort1,BWPort5], 4, [1,1], 2, 5>;
  337. defm : BWWriteResPair<WriteCvtPD2PS, [BWPort1,BWPort5], 4, [1,1], 2, 5>;
  338. defm : BWWriteResPair<WriteCvtPD2PSY, [BWPort1,BWPort5], 6, [1,1], 2, 6>;
  339. defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
  340. defm : X86WriteRes<WriteCvtPH2PS, [BWPort0,BWPort5], 2, [1,1], 2>;
  341. defm : X86WriteRes<WriteCvtPH2PSY, [BWPort0,BWPort5], 2, [1,1], 2>;
  342. defm : X86WriteResUnsupported<WriteCvtPH2PSZ>;
  343. defm : X86WriteRes<WriteCvtPH2PSLd, [BWPort0,BWPort23], 6, [1,1], 2>;
  344. defm : X86WriteRes<WriteCvtPH2PSYLd, [BWPort0,BWPort23], 6, [1,1], 2>;
  345. defm : X86WriteResUnsupported<WriteCvtPH2PSZLd>;
  346. defm : X86WriteRes<WriteCvtPS2PH, [BWPort1,BWPort5], 4, [1,1], 2>;
  347. defm : X86WriteRes<WriteCvtPS2PHY, [BWPort1,BWPort5], 6, [1,1], 2>;
  348. defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
  349. defm : X86WriteRes<WriteCvtPS2PHSt, [BWPort1,BWPort4,BWPort237], 5, [1,1,1], 3>;
  350. defm : X86WriteRes<WriteCvtPS2PHYSt, [BWPort1,BWPort4,BWPort237], 7, [1,1,1], 3>;
  351. defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
  352. // Vector integer operations.
  353. defm : X86WriteRes<WriteVecLoad, [BWPort23], 5, [1], 1>;
  354. defm : X86WriteRes<WriteVecLoadX, [BWPort23], 5, [1], 1>;
  355. defm : X86WriteRes<WriteVecLoadY, [BWPort23], 6, [1], 1>;
  356. defm : X86WriteRes<WriteVecLoadNT, [BWPort23], 5, [1], 1>;
  357. defm : X86WriteRes<WriteVecLoadNTY, [BWPort23], 6, [1], 1>;
  358. defm : X86WriteRes<WriteVecMaskedLoad, [BWPort23,BWPort5], 7, [1,2], 3>;
  359. defm : X86WriteRes<WriteVecMaskedLoadY, [BWPort23,BWPort5], 8, [1,2], 3>;
  360. defm : X86WriteRes<WriteVecStore, [BWPort237,BWPort4], 1, [1,1], 2>;
  361. defm : X86WriteRes<WriteVecStoreX, [BWPort237,BWPort4], 1, [1,1], 2>;
  362. defm : X86WriteRes<WriteVecStoreY, [BWPort237,BWPort4], 1, [1,1], 2>;
  363. defm : X86WriteRes<WriteVecStoreNT, [BWPort237,BWPort4], 1, [1,1], 2>;
  364. defm : X86WriteRes<WriteVecStoreNTY, [BWPort237,BWPort4], 1, [1,1], 2>;
  365. defm : X86WriteRes<WriteVecMaskedStore32, [BWPort0,BWPort4,BWPort237,BWPort15], 5, [1,1,1,1], 4>;
  366. defm : X86WriteRes<WriteVecMaskedStore32Y, [BWPort0,BWPort4,BWPort237,BWPort15], 5, [1,1,1,1], 4>;
  367. defm : X86WriteRes<WriteVecMaskedStore64, [BWPort0,BWPort4,BWPort237,BWPort15], 5, [1,1,1,1], 4>;
  368. defm : X86WriteRes<WriteVecMaskedStore64Y, [BWPort0,BWPort4,BWPort237,BWPort15], 5, [1,1,1,1], 4>;
  369. defm : X86WriteRes<WriteVecMove, [BWPort015], 1, [1], 1>;
  370. defm : X86WriteRes<WriteVecMoveX, [BWPort015], 1, [1], 1>;
  371. defm : X86WriteRes<WriteVecMoveY, [BWPort015], 1, [1], 1>;
  372. defm : X86WriteResUnsupported<WriteVecMoveZ>;
  373. defm : X86WriteRes<WriteVecMoveToGpr, [BWPort0], 1, [1], 1>;
  374. defm : X86WriteRes<WriteVecMoveFromGpr, [BWPort5], 1, [1], 1>;
  375. defm : BWWriteResPair<WriteVecLogic, [BWPort015], 1, [1], 1, 5>; // Vector integer and/or/xor.
  376. defm : BWWriteResPair<WriteVecLogicX,[BWPort015], 1, [1], 1, 5>; // Vector integer and/or/xor.
  377. defm : BWWriteResPair<WriteVecLogicY,[BWPort015], 1, [1], 1, 6>; // Vector integer and/or/xor (YMM/ZMM).
  378. defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
  379. defm : BWWriteResPair<WriteVecTest, [BWPort0,BWPort5], 2, [1,1], 2, 5>; // Vector integer TEST instructions.
  380. defm : BWWriteResPair<WriteVecTestY, [BWPort0,BWPort5], 4, [1,1], 2, 6>; // Vector integer TEST instructions (YMM/ZMM).
  381. defm : X86WriteResPairUnsupported<WriteVecTestZ>;
  382. defm : BWWriteResPair<WriteVecALU, [BWPort15], 1, [1], 1, 5>; // Vector integer ALU op, no logicals.
  383. defm : BWWriteResPair<WriteVecALUX, [BWPort15], 1, [1], 1, 5>; // Vector integer ALU op, no logicals.
  384. defm : BWWriteResPair<WriteVecALUY, [BWPort15], 1, [1], 1, 6>; // Vector integer ALU op, no logicals (YMM/ZMM).
  385. defm : X86WriteResPairUnsupported<WriteVecALUZ>;
  386. defm : BWWriteResPair<WriteVecIMul, [BWPort0], 5, [1], 1, 5>; // Vector integer multiply.
  387. defm : BWWriteResPair<WriteVecIMulX, [BWPort0], 5, [1], 1, 5>; // Vector integer multiply.
  388. defm : BWWriteResPair<WriteVecIMulY, [BWPort0], 5, [1], 1, 6>; // Vector integer multiply.
  389. defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
  390. defm : BWWriteResPair<WritePMULLD, [BWPort0], 10, [2], 2, 5>; // Vector PMULLD.
  391. defm : BWWriteResPair<WritePMULLDY, [BWPort0], 10, [2], 2, 6>; // Vector PMULLD (YMM/ZMM).
  392. defm : X86WriteResPairUnsupported<WritePMULLDZ>;
  393. defm : BWWriteResPair<WriteShuffle, [BWPort5], 1, [1], 1, 5>; // Vector shuffles.
  394. defm : BWWriteResPair<WriteShuffleX, [BWPort5], 1, [1], 1, 5>; // Vector shuffles.
  395. defm : BWWriteResPair<WriteShuffleY, [BWPort5], 1, [1], 1, 6>; // Vector shuffles (YMM/ZMM).
  396. defm : X86WriteResPairUnsupported<WriteShuffleZ>;
  397. defm : BWWriteResPair<WriteVarShuffle, [BWPort5], 1, [1], 1, 5>; // Vector variable shuffles.
  398. defm : BWWriteResPair<WriteVarShuffleX,[BWPort5], 1, [1], 1, 5>; // Vector variable shuffles.
  399. defm : BWWriteResPair<WriteVarShuffleY,[BWPort5], 1, [1], 1, 6>; // Vector variable shuffles (YMM/ZMM).
  400. defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
  401. defm : BWWriteResPair<WriteBlend, [BWPort5], 1, [1], 1, 5>; // Vector blends.
  402. defm : BWWriteResPair<WriteBlendY, [BWPort5], 1, [1], 1, 6>; // Vector blends (YMM/ZMM).
  403. defm : X86WriteResPairUnsupported<WriteBlendZ>;
  404. defm : BWWriteResPair<WriteShuffle256, [BWPort5], 3, [1], 1, 6>; // 256-bit width vector shuffles.
  405. defm : BWWriteResPair<WriteVPMOV256, [BWPort5], 3, [1], 1, 6>; // 256-bit width packed vector width-changing move.
  406. defm : BWWriteResPair<WriteVarShuffle256, [BWPort5], 3, [1], 1, 6>; // 256-bit width vector variable shuffles.
  407. defm : BWWriteResPair<WriteVarBlend, [BWPort5], 2, [2], 2, 5>; // Vector variable blends.
  408. defm : BWWriteResPair<WriteVarBlendY, [BWPort5], 2, [2], 2, 6>; // Vector variable blends (YMM/ZMM).
  409. defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
  410. defm : BWWriteResPair<WriteMPSAD, [BWPort0, BWPort5], 7, [1, 2], 3, 5>; // Vector MPSAD.
  411. defm : BWWriteResPair<WriteMPSADY, [BWPort0, BWPort5], 7, [1, 2], 3, 6>; // Vector MPSAD.
  412. defm : X86WriteResPairUnsupported<WriteMPSADZ>;
  413. defm : BWWriteResPair<WritePSADBW, [BWPort0], 5, [1], 1, 5>; // Vector PSADBW.
  414. defm : BWWriteResPair<WritePSADBWX, [BWPort0], 5, [1], 1, 5>; // Vector PSADBW.
  415. defm : BWWriteResPair<WritePSADBWY, [BWPort0], 5, [1], 1, 6>; // Vector PSADBW (YMM/ZMM).
  416. defm : X86WriteResPairUnsupported<WritePSADBWZ>;
  417. defm : BWWriteResPair<WritePHMINPOS, [BWPort0], 5>; // Vector PHMINPOS.
  418. // Vector integer shifts.
  419. defm : BWWriteResPair<WriteVecShift, [BWPort0], 1, [1], 1, 5>;
  420. defm : BWWriteResPair<WriteVecShiftX, [BWPort0,BWPort5], 2, [1,1], 2, 5>;
  421. defm : X86WriteRes<WriteVecShiftY, [BWPort0,BWPort5], 4, [1,1], 2>;
  422. defm : X86WriteRes<WriteVecShiftYLd, [BWPort0,BWPort23], 7, [1,1], 2>;
  423. defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
  424. defm : BWWriteResPair<WriteVecShiftImm, [BWPort0], 1, [1], 1, 5>;
  425. defm : BWWriteResPair<WriteVecShiftImmX, [BWPort0], 1, [1], 1, 5>; // Vector integer immediate shifts (XMM).
  426. defm : BWWriteResPair<WriteVecShiftImmY, [BWPort0], 1, [1], 1, 6>; // Vector integer immediate shifts (YMM/ZMM).
  427. defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
  428. defm : BWWriteResPair<WriteVarVecShift, [BWPort0, BWPort5], 3, [2,1], 3, 5>; // Variable vector shifts.
  429. defm : BWWriteResPair<WriteVarVecShiftY, [BWPort0, BWPort5], 3, [2,1], 3, 6>; // Variable vector shifts (YMM/ZMM).
  430. defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
  431. // Vector insert/extract operations.
  432. def : WriteRes<WriteVecInsert, [BWPort5]> {
  433. let Latency = 2;
  434. let NumMicroOps = 2;
  435. let ResourceCycles = [2];
  436. }
  437. def : WriteRes<WriteVecInsertLd, [BWPort5,BWPort23]> {
  438. let Latency = 6;
  439. let NumMicroOps = 2;
  440. }
  441. def : WriteRes<WriteVecExtract, [BWPort0,BWPort5]> {
  442. let Latency = 2;
  443. let NumMicroOps = 2;
  444. }
  445. def : WriteRes<WriteVecExtractSt, [BWPort4,BWPort5,BWPort237]> {
  446. let Latency = 2;
  447. let NumMicroOps = 3;
  448. }
  449. // String instructions.
  450. // Packed Compare Implicit Length Strings, Return Mask
  451. def : WriteRes<WritePCmpIStrM, [BWPort0]> {
  452. let Latency = 11;
  453. let NumMicroOps = 3;
  454. let ResourceCycles = [3];
  455. }
  456. def : WriteRes<WritePCmpIStrMLd, [BWPort0, BWPort23]> {
  457. let Latency = 16;
  458. let NumMicroOps = 4;
  459. let ResourceCycles = [3,1];
  460. }
  461. // Packed Compare Explicit Length Strings, Return Mask
  462. def : WriteRes<WritePCmpEStrM, [BWPort0, BWPort5, BWPort015, BWPort0156]> {
  463. let Latency = 19;
  464. let NumMicroOps = 9;
  465. let ResourceCycles = [4,3,1,1];
  466. }
  467. def : WriteRes<WritePCmpEStrMLd, [BWPort0, BWPort5, BWPort23, BWPort015, BWPort0156]> {
  468. let Latency = 24;
  469. let NumMicroOps = 10;
  470. let ResourceCycles = [4,3,1,1,1];
  471. }
  472. // Packed Compare Implicit Length Strings, Return Index
  473. def : WriteRes<WritePCmpIStrI, [BWPort0]> {
  474. let Latency = 11;
  475. let NumMicroOps = 3;
  476. let ResourceCycles = [3];
  477. }
  478. def : WriteRes<WritePCmpIStrILd, [BWPort0, BWPort23]> {
  479. let Latency = 16;
  480. let NumMicroOps = 4;
  481. let ResourceCycles = [3,1];
  482. }
  483. // Packed Compare Explicit Length Strings, Return Index
  484. def : WriteRes<WritePCmpEStrI, [BWPort0, BWPort5, BWPort0156]> {
  485. let Latency = 18;
  486. let NumMicroOps = 8;
  487. let ResourceCycles = [4,3,1];
  488. }
  489. def : WriteRes<WritePCmpEStrILd, [BWPort0, BWPort5, BWPort23, BWPort0156]> {
  490. let Latency = 23;
  491. let NumMicroOps = 9;
  492. let ResourceCycles = [4,3,1,1];
  493. }
  494. // MOVMSK Instructions.
  495. def : WriteRes<WriteFMOVMSK, [BWPort0]> { let Latency = 3; }
  496. def : WriteRes<WriteVecMOVMSK, [BWPort0]> { let Latency = 3; }
  497. def : WriteRes<WriteVecMOVMSKY, [BWPort0]> { let Latency = 3; }
  498. def : WriteRes<WriteMMXMOVMSK, [BWPort0]> { let Latency = 1; }
  499. // AES Instructions.
  500. def : WriteRes<WriteAESDecEnc, [BWPort5]> { // Decryption, encryption.
  501. let Latency = 7;
  502. let NumMicroOps = 1;
  503. let ResourceCycles = [1];
  504. }
  505. def : WriteRes<WriteAESDecEncLd, [BWPort5, BWPort23]> {
  506. let Latency = 12;
  507. let NumMicroOps = 2;
  508. let ResourceCycles = [1,1];
  509. }
  510. def : WriteRes<WriteAESIMC, [BWPort5]> { // InvMixColumn.
  511. let Latency = 14;
  512. let NumMicroOps = 2;
  513. let ResourceCycles = [2];
  514. }
  515. def : WriteRes<WriteAESIMCLd, [BWPort5, BWPort23]> {
  516. let Latency = 19;
  517. let NumMicroOps = 3;
  518. let ResourceCycles = [2,1];
  519. }
  520. def : WriteRes<WriteAESKeyGen, [BWPort0, BWPort5, BWPort015]> { // Key Generation.
  521. let Latency = 29;
  522. let NumMicroOps = 11;
  523. let ResourceCycles = [2,7,2];
  524. }
  525. def : WriteRes<WriteAESKeyGenLd, [BWPort0, BWPort5, BWPort23, BWPort015]> {
  526. let Latency = 33;
  527. let NumMicroOps = 11;
  528. let ResourceCycles = [2,7,1,1];
  529. }
  530. // Carry-less multiplication instructions.
  531. defm : BWWriteResPair<WriteCLMul, [BWPort0], 5>;
  532. // Load/store MXCSR.
  533. def : WriteRes<WriteLDMXCSR, [BWPort0,BWPort23,BWPort0156]> { let Latency = 7; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
  534. def : WriteRes<WriteSTMXCSR, [BWPort4,BWPort5,BWPort237]> { let Latency = 2; let NumMicroOps = 3; let ResourceCycles = [1,1,1]; }
  535. // Catch-all for expensive system instructions.
  536. def : WriteRes<WriteSystem, [BWPort0156]> { let Latency = 100; }
  537. // Old microcoded instructions that nobody use.
  538. def : WriteRes<WriteMicrocoded, [BWPort0156]> { let Latency = 100; }
  539. // Fence instructions.
  540. def : WriteRes<WriteFence, [BWPort23, BWPort4]>;
  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 : BWWriteResPair<WriteFHAdd, [BWPort1,BWPort5], 5, [1,2], 3, 5>;
  547. defm : BWWriteResPair<WriteFHAddY, [BWPort1,BWPort5], 5, [1,2], 3, 6>;
  548. defm : BWWriteResPair<WritePHAdd, [BWPort5,BWPort15], 3, [2,1], 3, 5>;
  549. defm : BWWriteResPair<WritePHAddX, [BWPort5,BWPort15], 3, [2,1], 3, 5>;
  550. defm : BWWriteResPair<WritePHAddY, [BWPort5,BWPort15], 3, [2,1], 3, 6>;
  551. // Remaining instrs.
  552. def BWWriteResGroup1 : SchedWriteRes<[BWPort0]> {
  553. let Latency = 1;
  554. let NumMicroOps = 1;
  555. let ResourceCycles = [1];
  556. }
  557. def: InstRW<[BWWriteResGroup1], (instregex "VPSLLVQ(Y?)rr",
  558. "VPSRLVQ(Y?)rr")>;
  559. def BWWriteResGroup2 : SchedWriteRes<[BWPort1]> {
  560. let Latency = 1;
  561. let NumMicroOps = 1;
  562. let ResourceCycles = [1];
  563. }
  564. def: InstRW<[BWWriteResGroup2], (instregex "COM(P?)_FST0r",
  565. "UCOM_F(P?)r")>;
  566. def BWWriteResGroup3 : SchedWriteRes<[BWPort5]> {
  567. let Latency = 1;
  568. let NumMicroOps = 1;
  569. let ResourceCycles = [1];
  570. }
  571. def: InstRW<[BWWriteResGroup3], (instrs MMX_MOVQ2DQrr)>;
  572. def BWWriteResGroup4 : SchedWriteRes<[BWPort6]> {
  573. let Latency = 1;
  574. let NumMicroOps = 1;
  575. let ResourceCycles = [1];
  576. }
  577. def: InstRW<[BWWriteResGroup4], (instregex "JMP(16|32|64)r")>;
  578. def BWWriteResGroup5 : SchedWriteRes<[BWPort01]> {
  579. let Latency = 1;
  580. let NumMicroOps = 1;
  581. let ResourceCycles = [1];
  582. }
  583. def: InstRW<[BWWriteResGroup5], (instrs FINCSTP, FNOP)>;
  584. def BWWriteResGroup6 : SchedWriteRes<[BWPort06]> {
  585. let Latency = 1;
  586. let NumMicroOps = 1;
  587. let ResourceCycles = [1];
  588. }
  589. def: InstRW<[BWWriteResGroup6], (instrs CDQ, CQO)>;
  590. def BWWriteResGroup7 : SchedWriteRes<[BWPort15]> {
  591. let Latency = 1;
  592. let NumMicroOps = 1;
  593. let ResourceCycles = [1];
  594. }
  595. def: InstRW<[BWWriteResGroup7], (instregex "ANDN(32|64)rr")>;
  596. def BWWriteResGroup8 : SchedWriteRes<[BWPort015]> {
  597. let Latency = 1;
  598. let NumMicroOps = 1;
  599. let ResourceCycles = [1];
  600. }
  601. def: InstRW<[BWWriteResGroup8], (instregex "VPBLENDD(Y?)rri")>;
  602. def BWWriteResGroup9 : SchedWriteRes<[BWPort0156]> {
  603. let Latency = 1;
  604. let NumMicroOps = 1;
  605. let ResourceCycles = [1];
  606. }
  607. def: InstRW<[BWWriteResGroup9], (instrs SGDT64m,
  608. SIDT64m,
  609. SMSW16m,
  610. STRm,
  611. SYSCALL)>;
  612. def BWWriteResGroup10 : SchedWriteRes<[BWPort4,BWPort237]> {
  613. let Latency = 1;
  614. let NumMicroOps = 2;
  615. let ResourceCycles = [1,1];
  616. }
  617. def: InstRW<[BWWriteResGroup10], (instrs FBSTPm)>;
  618. def: InstRW<[BWWriteResGroup10], (instregex "ST_FP(32|64|80)m")>;
  619. def BWWriteResGroup12 : SchedWriteRes<[BWPort01]> {
  620. let Latency = 2;
  621. let NumMicroOps = 2;
  622. let ResourceCycles = [2];
  623. }
  624. def: InstRW<[BWWriteResGroup12], (instrs FDECSTP)>;
  625. def BWWriteResGroup14 : SchedWriteRes<[BWPort0156]> {
  626. let Latency = 2;
  627. let NumMicroOps = 2;
  628. let ResourceCycles = [2];
  629. }
  630. def: InstRW<[BWWriteResGroup14], (instrs LFENCE,
  631. MFENCE,
  632. WAIT,
  633. XGETBV)>;
  634. def BWWriteResGroup16 : SchedWriteRes<[BWPort6,BWPort0156]> {
  635. let Latency = 2;
  636. let NumMicroOps = 2;
  637. let ResourceCycles = [1,1];
  638. }
  639. def: InstRW<[BWWriteResGroup16], (instregex "CLFLUSH")>;
  640. def BWWriteResGroup17 : SchedWriteRes<[BWPort01,BWPort015]> {
  641. let Latency = 2;
  642. let NumMicroOps = 2;
  643. let ResourceCycles = [1,1];
  644. }
  645. def: InstRW<[BWWriteResGroup17], (instrs MMX_MOVDQ2Qrr)>;
  646. def BWWriteResGroup18 : SchedWriteRes<[BWPort237,BWPort0156]> {
  647. let Latency = 2;
  648. let NumMicroOps = 2;
  649. let ResourceCycles = [1,1];
  650. }
  651. def: InstRW<[BWWriteResGroup18], (instrs SFENCE)>;
  652. def BWWriteResGroup20 : SchedWriteRes<[BWPort06,BWPort0156]> {
  653. let Latency = 2;
  654. let NumMicroOps = 2;
  655. let ResourceCycles = [1,1];
  656. }
  657. def: InstRW<[BWWriteResGroup20], (instrs CWD,
  658. JCXZ, JECXZ, JRCXZ,
  659. ADC8i8, SBB8i8,
  660. ADC16i16, SBB16i16,
  661. ADC32i32, SBB32i32,
  662. ADC64i32, SBB64i32)>;
  663. def BWWriteResGroup22 : SchedWriteRes<[BWPort4,BWPort6,BWPort237]> {
  664. let Latency = 2;
  665. let NumMicroOps = 3;
  666. let ResourceCycles = [1,1,1];
  667. }
  668. def: InstRW<[BWWriteResGroup22], (instrs FNSTCW16m)>;
  669. def BWWriteResGroup24 : SchedWriteRes<[BWPort4,BWPort237,BWPort15]> {
  670. let Latency = 2;
  671. let NumMicroOps = 3;
  672. let ResourceCycles = [1,1,1];
  673. }
  674. def: InstRW<[BWWriteResGroup24], (instregex "MOVBE(16|32|64)mr")>;
  675. def BWWriteResGroup25 : SchedWriteRes<[BWPort4,BWPort237,BWPort0156]> {
  676. let Latency = 2;
  677. let NumMicroOps = 3;
  678. let ResourceCycles = [1,1,1];
  679. }
  680. def: InstRW<[BWWriteResGroup25], (instrs PUSH16r, PUSH32r, PUSH64r, PUSH64i8,
  681. STOSB, STOSL, STOSQ, STOSW)>;
  682. def: InstRW<[BWWriteResGroup25], (instregex "PUSH(16|32|64)rmr")>;
  683. def BWWriteResGroup27 : SchedWriteRes<[BWPort1]> {
  684. let Latency = 3;
  685. let NumMicroOps = 1;
  686. let ResourceCycles = [1];
  687. }
  688. def: InstRW<[BWWriteResGroup27], (instregex "P(DEP|EXT)(32|64)rr")>;
  689. def BWWriteResGroup28 : SchedWriteRes<[BWPort5]> {
  690. let Latency = 3;
  691. let NumMicroOps = 1;
  692. let ResourceCycles = [1];
  693. }
  694. def: InstRW<[BWWriteResGroup28], (instrs VPBROADCASTBrr,
  695. VPBROADCASTWrr)>;
  696. def BWWriteResGroup33 : SchedWriteRes<[BWPort5,BWPort0156]> {
  697. let Latency = 3;
  698. let NumMicroOps = 3;
  699. let ResourceCycles = [2,1];
  700. }
  701. def: InstRW<[BWWriteResGroup33], (instrs MMX_PACKSSDWrr,
  702. MMX_PACKSSWBrr,
  703. MMX_PACKUSWBrr)>;
  704. def BWWriteResGroup34 : SchedWriteRes<[BWPort6,BWPort0156]> {
  705. let Latency = 3;
  706. let NumMicroOps = 3;
  707. let ResourceCycles = [1,2];
  708. }
  709. def: InstRW<[BWWriteResGroup34], (instregex "CLD")>;
  710. def BWWriteResGroup35 : SchedWriteRes<[BWPort06,BWPort0156]> {
  711. let Latency = 2;
  712. let NumMicroOps = 3;
  713. let ResourceCycles = [1,2];
  714. }
  715. def: InstRW<[BWWriteResGroup35], (instrs RCL8r1, RCL16r1, RCL32r1, RCL64r1,
  716. RCR8r1, RCR16r1, RCR32r1, RCR64r1)>;
  717. def BWWriteResGroup36 : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
  718. let Latency = 5;
  719. let NumMicroOps = 8;
  720. let ResourceCycles = [2,4,2];
  721. }
  722. def: InstRW<[BWWriteResGroup36], (instrs RCR8ri, RCR16ri, RCR32ri, RCR64ri)>;
  723. def BWWriteResGroup36b : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
  724. let Latency = 6;
  725. let NumMicroOps = 8;
  726. let ResourceCycles = [2,4,2];
  727. }
  728. def: InstRW<[BWWriteResGroup36b], (instrs RCL8ri, RCL16ri, RCL32ri, RCL64ri)>;
  729. def BWWriteResGroup37 : SchedWriteRes<[BWPort4,BWPort6,BWPort237,BWPort0156]> {
  730. let Latency = 3;
  731. let NumMicroOps = 4;
  732. let ResourceCycles = [1,1,1,1];
  733. }
  734. def: InstRW<[BWWriteResGroup37], (instregex "CALL(16|32|64)r")>;
  735. def BWWriteResGroup38 : SchedWriteRes<[BWPort4,BWPort237,BWPort06,BWPort0156]> {
  736. let Latency = 3;
  737. let NumMicroOps = 4;
  738. let ResourceCycles = [1,1,1,1];
  739. }
  740. def: InstRW<[BWWriteResGroup38], (instrs CALL64pcrel32)>;
  741. def BWWriteResGroup41 : SchedWriteRes<[BWPort0,BWPort0156]> {
  742. let Latency = 4;
  743. let NumMicroOps = 2;
  744. let ResourceCycles = [1,1];
  745. }
  746. def: InstRW<[BWWriteResGroup41], (instrs FNSTSW16r)>;
  747. def BWWriteResGroup42 : SchedWriteRes<[BWPort1,BWPort5]> {
  748. let Latency = 4;
  749. let NumMicroOps = 2;
  750. let ResourceCycles = [1,1];
  751. }
  752. def: InstRW<[BWWriteResGroup42], (instregex "MMX_CVT(T?)PS2PIrr")>;
  753. def BWWriteResGroup43 : SchedWriteRes<[BWPort0,BWPort4,BWPort237]> {
  754. let Latency = 4;
  755. let NumMicroOps = 3;
  756. let ResourceCycles = [1,1,1];
  757. }
  758. def: InstRW<[BWWriteResGroup43], (instrs FNSTSWm)>;
  759. def BWWriteResGroup44 : SchedWriteRes<[BWPort1,BWPort4,BWPort237]> {
  760. let Latency = 4;
  761. let NumMicroOps = 3;
  762. let ResourceCycles = [1,1,1];
  763. }
  764. def: InstRW<[BWWriteResGroup44], (instregex "IST(T?)_FP(16|32|64)m",
  765. "IST_F(16|32)m")>;
  766. def BWWriteResGroup45 : SchedWriteRes<[BWPort0156]> {
  767. let Latency = 4;
  768. let NumMicroOps = 4;
  769. let ResourceCycles = [4];
  770. }
  771. def: InstRW<[BWWriteResGroup45], (instrs FNCLEX)>;
  772. def BWWriteResGroup46 : SchedWriteRes<[]> {
  773. let Latency = 0;
  774. let NumMicroOps = 4;
  775. let ResourceCycles = [];
  776. }
  777. def: InstRW<[BWWriteResGroup46], (instrs VZEROUPPER)>;
  778. def BWWriteResGroup47 : SchedWriteRes<[BWPort0]> {
  779. let Latency = 5;
  780. let NumMicroOps = 1;
  781. let ResourceCycles = [1];
  782. }
  783. def: InstRW<[BWWriteResGroup47], (instregex "MUL_(FPrST0|FST0r|FrST0)")>;
  784. def BWWriteResGroup49 : SchedWriteRes<[BWPort23]> {
  785. let Latency = 5;
  786. let NumMicroOps = 1;
  787. let ResourceCycles = [1];
  788. }
  789. def: InstRW<[BWWriteResGroup49], (instrs VBROADCASTSSrm,
  790. VMOVDDUPrm, MOVDDUPrm,
  791. VMOVSHDUPrm, MOVSHDUPrm,
  792. VMOVSLDUPrm, MOVSLDUPrm,
  793. VPBROADCASTDrm,
  794. VPBROADCASTQrm)>;
  795. def BWWriteResGroup50 : SchedWriteRes<[BWPort1,BWPort5]> {
  796. let Latency = 5;
  797. let NumMicroOps = 3;
  798. let ResourceCycles = [1,2];
  799. }
  800. def: InstRW<[BWWriteResGroup50], (instregex "(V?)CVTSI642SSrr")>;
  801. def BWWriteResGroup51 : SchedWriteRes<[BWPort1,BWPort6,BWPort06]> {
  802. let Latency = 5;
  803. let NumMicroOps = 3;
  804. let ResourceCycles = [1,1,1];
  805. }
  806. def: InstRW<[BWWriteResGroup51], (instregex "STR(16|32|64)r")>;
  807. def BWWriteResGroup54 : SchedWriteRes<[BWPort6,BWPort0156]> {
  808. let Latency = 5;
  809. let NumMicroOps = 5;
  810. let ResourceCycles = [1,4];
  811. }
  812. def: InstRW<[BWWriteResGroup54], (instrs PAUSE)>;
  813. def BWWriteResGroup55 : SchedWriteRes<[BWPort06,BWPort0156]> {
  814. let Latency = 5;
  815. let NumMicroOps = 5;
  816. let ResourceCycles = [1,4];
  817. }
  818. def: InstRW<[BWWriteResGroup55], (instrs XSETBV)>;
  819. def BWWriteResGroup57 : SchedWriteRes<[BWPort4,BWPort237,BWPort0156]> {
  820. let Latency = 5;
  821. let NumMicroOps = 6;
  822. let ResourceCycles = [1,1,4];
  823. }
  824. def: InstRW<[BWWriteResGroup57], (instregex "PUSHF(16|64)")>;
  825. def BWWriteResGroup58 : SchedWriteRes<[BWPort23]> {
  826. let Latency = 6;
  827. let NumMicroOps = 1;
  828. let ResourceCycles = [1];
  829. }
  830. def: InstRW<[BWWriteResGroup58], (instregex "LD_F(32|64|80)m")>;
  831. def: InstRW<[BWWriteResGroup58], (instrs VBROADCASTF128,
  832. VBROADCASTI128,
  833. VBROADCASTSDYrm,
  834. VBROADCASTSSYrm,
  835. VMOVDDUPYrm,
  836. VMOVSHDUPYrm,
  837. VMOVSLDUPYrm,
  838. VPBROADCASTDYrm,
  839. VPBROADCASTQYrm)>;
  840. def BWWriteResGroup59 : SchedWriteRes<[BWPort0,BWPort23]> {
  841. let Latency = 6;
  842. let NumMicroOps = 2;
  843. let ResourceCycles = [1,1];
  844. }
  845. def: InstRW<[BWWriteResGroup59], (instrs VPSLLVQrm, VPSRLVQrm)>;
  846. def BWWriteResGroup62 : SchedWriteRes<[BWPort6,BWPort23]> {
  847. let Latency = 6;
  848. let NumMicroOps = 2;
  849. let ResourceCycles = [1,1];
  850. }
  851. def: InstRW<[BWWriteResGroup62], (instrs FARJMP64m)>;
  852. def: InstRW<[BWWriteResGroup62], (instregex "JMP(16|32|64)m")>;
  853. def BWWriteResGroup64 : SchedWriteRes<[BWPort23,BWPort15]> {
  854. let Latency = 6;
  855. let NumMicroOps = 2;
  856. let ResourceCycles = [1,1];
  857. }
  858. def: InstRW<[BWWriteResGroup64], (instregex "ANDN(32|64)rm",
  859. "MOVBE(16|32|64)rm")>;
  860. def BWWriteResGroup65 : SchedWriteRes<[BWPort23,BWPort015]> {
  861. let Latency = 6;
  862. let NumMicroOps = 2;
  863. let ResourceCycles = [1,1];
  864. }
  865. def: InstRW<[BWWriteResGroup65], (instrs VINSERTF128rm,
  866. VINSERTI128rm,
  867. VPBLENDDrmi)>;
  868. def BWWriteResGroup66 : SchedWriteRes<[BWPort23,BWPort0156]> {
  869. let Latency = 6;
  870. let NumMicroOps = 2;
  871. let ResourceCycles = [1,1];
  872. }
  873. def: InstRW<[BWWriteResGroup66], (instrs POP16r, POP32r, POP64r)>;
  874. def: InstRW<[BWWriteResGroup66], (instregex "POP(16|32|64)rmr")>;
  875. def BWWriteResGroup68 : SchedWriteRes<[BWPort1,BWPort6,BWPort06,BWPort0156]> {
  876. let Latency = 6;
  877. let NumMicroOps = 4;
  878. let ResourceCycles = [1,1,1,1];
  879. }
  880. def: InstRW<[BWWriteResGroup68], (instregex "SLDT(16|32|64)r")>;
  881. def BWWriteResGroup69 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06]> {
  882. let Latency = 6;
  883. let NumMicroOps = 4;
  884. let ResourceCycles = [1,1,1,1];
  885. }
  886. def: InstRW<[BWWriteResGroup69], (instregex "SAR(8|16|32|64)m(1|i)",
  887. "SHL(8|16|32|64)m(1|i)",
  888. "SHR(8|16|32|64)m(1|i)")>;
  889. def BWWriteResGroup70 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
  890. let Latency = 6;
  891. let NumMicroOps = 4;
  892. let ResourceCycles = [1,1,1,1];
  893. }
  894. def: InstRW<[BWWriteResGroup70], (instregex "POP(16|32|64)rmm",
  895. "PUSH(16|32|64)rmm")>;
  896. def BWWriteResGroup71 : SchedWriteRes<[BWPort6,BWPort0156]> {
  897. let Latency = 6;
  898. let NumMicroOps = 6;
  899. let ResourceCycles = [1,5];
  900. }
  901. def: InstRW<[BWWriteResGroup71], (instrs STD)>;
  902. def BWWriteResGroup73 : SchedWriteRes<[BWPort0,BWPort23]> {
  903. let Latency = 7;
  904. let NumMicroOps = 2;
  905. let ResourceCycles = [1,1];
  906. }
  907. def: InstRW<[BWWriteResGroup73], (instrs VPSLLVQYrm,
  908. VPSRLVQYrm)>;
  909. def BWWriteResGroup74 : SchedWriteRes<[BWPort1,BWPort23]> {
  910. let Latency = 7;
  911. let NumMicroOps = 2;
  912. let ResourceCycles = [1,1];
  913. }
  914. def: InstRW<[BWWriteResGroup74], (instregex "FCOM(P?)(32|64)m")>;
  915. def BWWriteResGroup77 : SchedWriteRes<[BWPort23,BWPort015]> {
  916. let Latency = 7;
  917. let NumMicroOps = 2;
  918. let ResourceCycles = [1,1];
  919. }
  920. def: InstRW<[BWWriteResGroup77], (instrs VPBLENDDYrmi)>;
  921. def BWWriteResGroup79 : SchedWriteRes<[BWPort5,BWPort23]> {
  922. let Latency = 7;
  923. let NumMicroOps = 3;
  924. let ResourceCycles = [2,1];
  925. }
  926. def: InstRW<[BWWriteResGroup79], (instrs MMX_PACKSSDWrm,
  927. MMX_PACKSSWBrm,
  928. MMX_PACKUSWBrm)>;
  929. def BWWriteResGroup80 : SchedWriteRes<[BWPort23,BWPort0156]> {
  930. let Latency = 7;
  931. let NumMicroOps = 3;
  932. let ResourceCycles = [1,2];
  933. }
  934. def: InstRW<[BWWriteResGroup80], (instrs LEAVE, LEAVE64,
  935. SCASB, SCASL, SCASQ, SCASW)>;
  936. def BWWriteResGroup82 : SchedWriteRes<[BWPort0,BWPort01,BWPort23]> {
  937. let Latency = 7;
  938. let NumMicroOps = 3;
  939. let ResourceCycles = [1,1,1];
  940. }
  941. def: InstRW<[BWWriteResGroup82], (instrs FLDCW16m)>;
  942. def BWWriteResGroup84 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
  943. let Latency = 7;
  944. let NumMicroOps = 3;
  945. let ResourceCycles = [1,1,1];
  946. }
  947. def: InstRW<[BWWriteResGroup84], (instrs LRET64, RET64)>;
  948. def BWWriteResGroup87 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06]> {
  949. let Latency = 7;
  950. let NumMicroOps = 5;
  951. let ResourceCycles = [1,1,1,2];
  952. }
  953. def: InstRW<[BWWriteResGroup87], (instregex "ROL(8|16|32|64)m(1|i)",
  954. "ROR(8|16|32|64)m(1|i)")>;
  955. def BWWriteResGroup87_1 : SchedWriteRes<[BWPort06]> {
  956. let Latency = 2;
  957. let NumMicroOps = 2;
  958. let ResourceCycles = [2];
  959. }
  960. def: InstRW<[BWWriteResGroup87_1], (instrs ROL8r1, ROL16r1, ROL32r1, ROL64r1,
  961. ROR8r1, ROR16r1, ROR32r1, ROR64r1)>;
  962. def BWWriteResGroup88 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
  963. let Latency = 7;
  964. let NumMicroOps = 5;
  965. let ResourceCycles = [1,1,1,2];
  966. }
  967. def: InstRW<[BWWriteResGroup88], (instregex "XADD(8|16|32|64)rm")>;
  968. def BWWriteResGroup89 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
  969. let Latency = 7;
  970. let NumMicroOps = 5;
  971. let ResourceCycles = [1,1,1,1,1];
  972. }
  973. def: InstRW<[BWWriteResGroup89], (instregex "CALL(16|32|64)m")>;
  974. def: InstRW<[BWWriteResGroup89], (instrs FARCALL64m)>;
  975. def BWWriteResGroup90 : SchedWriteRes<[BWPort6,BWPort06,BWPort15,BWPort0156]> {
  976. let Latency = 7;
  977. let NumMicroOps = 7;
  978. let ResourceCycles = [2,2,1,2];
  979. }
  980. def: InstRW<[BWWriteResGroup90], (instrs LOOP)>;
  981. def BWWriteResGroup91 : SchedWriteRes<[BWPort1,BWPort23]> {
  982. let Latency = 8;
  983. let NumMicroOps = 2;
  984. let ResourceCycles = [1,1];
  985. }
  986. def: InstRW<[BWWriteResGroup91], (instregex "P(DEP|EXT)(32|64)rm")>;
  987. def BWWriteResGroup92 : SchedWriteRes<[BWPort5,BWPort23]> {
  988. let Latency = 8;
  989. let NumMicroOps = 2;
  990. let ResourceCycles = [1,1];
  991. }
  992. def: InstRW<[BWWriteResGroup92], (instrs VPMOVSXBDYrm,
  993. VPMOVSXBQYrm,
  994. VPMOVSXBWYrm,
  995. VPMOVSXDQYrm,
  996. VPMOVSXWDYrm,
  997. VPMOVSXWQYrm,
  998. VPMOVZXWDYrm)>;
  999. def BWWriteResGroup97 : SchedWriteRes<[BWPort23,BWPort237,BWPort06,BWPort0156]> {
  1000. let Latency = 8;
  1001. let NumMicroOps = 5;
  1002. let ResourceCycles = [1,1,1,2];
  1003. }
  1004. def: InstRW<[BWWriteResGroup97], (instregex "RCL(8|16|32|64)m(1|i)",
  1005. "RCR(8|16|32|64)m(1|i)")>;
  1006. def BWWriteResGroup99 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort0156]> {
  1007. let Latency = 8;
  1008. let NumMicroOps = 6;
  1009. let ResourceCycles = [1,1,1,3];
  1010. }
  1011. def: InstRW<[BWWriteResGroup99], (instregex "XCHG(8|16|32|64)rm")>;
  1012. def BWWriteResGroup100 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06,BWPort0156]> {
  1013. let Latency = 8;
  1014. let NumMicroOps = 6;
  1015. let ResourceCycles = [1,1,1,2,1];
  1016. }
  1017. def : SchedAlias<WriteADCRMW, BWWriteResGroup100>;
  1018. def: InstRW<[BWWriteResGroup100], (instregex "ROL(8|16|32|64)mCL",
  1019. "ROR(8|16|32|64)mCL",
  1020. "SAR(8|16|32|64)mCL",
  1021. "SHL(8|16|32|64)mCL",
  1022. "SHR(8|16|32|64)mCL")>;
  1023. def BWWriteResGroup101 : SchedWriteRes<[BWPort1,BWPort23]> {
  1024. let Latency = 9;
  1025. let NumMicroOps = 2;
  1026. let ResourceCycles = [1,1];
  1027. }
  1028. def: InstRW<[BWWriteResGroup101], (instregex "(ADD|SUB|SUBR)_F(32|64)m",
  1029. "ILD_F(16|32|64)m")>;
  1030. def BWWriteResGroup108 : SchedWriteRes<[BWPort5,BWPort23,BWPort015]> {
  1031. let Latency = 9;
  1032. let NumMicroOps = 3;
  1033. let ResourceCycles = [1,1,1];
  1034. }
  1035. def: InstRW<[BWWriteResGroup108], (instregex "VPBROADCASTB(Y?)rm",
  1036. "VPBROADCASTW(Y?)rm")>;
  1037. def BWWriteResGroup112 : SchedWriteRes<[BWPort23,BWPort06,BWPort0156]> {
  1038. let Latency = 9;
  1039. let NumMicroOps = 5;
  1040. let ResourceCycles = [1,1,3];
  1041. }
  1042. def: InstRW<[BWWriteResGroup112], (instrs RDRAND16r, RDRAND32r, RDRAND64r)>;
  1043. def BWWriteResGroup113 : SchedWriteRes<[BWPort1,BWPort6,BWPort23,BWPort0156]> {
  1044. let Latency = 9;
  1045. let NumMicroOps = 5;
  1046. let ResourceCycles = [1,2,1,1];
  1047. }
  1048. def: InstRW<[BWWriteResGroup113], (instregex "LAR(16|32|64)rm",
  1049. "LSL(16|32|64)rm")>;
  1050. def BWWriteResGroup115 : SchedWriteRes<[BWPort0,BWPort23]> {
  1051. let Latency = 10;
  1052. let NumMicroOps = 2;
  1053. let ResourceCycles = [1,1];
  1054. }
  1055. def: InstRW<[BWWriteResGroup115], (instregex "(V?)PCMPGTQrm")>;
  1056. def BWWriteResGroup117 : SchedWriteRes<[BWPort1,BWPort23]> {
  1057. let Latency = 10;
  1058. let NumMicroOps = 3;
  1059. let ResourceCycles = [2,1];
  1060. }
  1061. def: InstRW<[BWWriteResGroup117], (instregex "FICOM(P?)(16|32)m")>;
  1062. def BWWriteResGroup122_1 : SchedWriteRes<[BWPort0,BWFPDivider]> {
  1063. let Latency = 11;
  1064. let NumMicroOps = 1;
  1065. let ResourceCycles = [1,3]; // Really 2.5 cycle throughput
  1066. }
  1067. def : SchedAlias<WriteFDiv, BWWriteResGroup122_1>; // TODO - convert to ZnWriteResFpuPair
  1068. def BWWriteResGroup123 : SchedWriteRes<[BWPort0,BWPort23]> {
  1069. let Latency = 11;
  1070. let NumMicroOps = 2;
  1071. let ResourceCycles = [1,1];
  1072. }
  1073. def: InstRW<[BWWriteResGroup123], (instregex "MUL_F(32|64)m")>;
  1074. def: InstRW<[BWWriteResGroup123], (instrs VPCMPGTQYrm)>;
  1075. def BWWriteResGroup131 : SchedWriteRes<[BWPort1,BWPort06,BWPort0156]> {
  1076. let Latency = 11;
  1077. let NumMicroOps = 7;
  1078. let ResourceCycles = [2,2,3];
  1079. }
  1080. def: InstRW<[BWWriteResGroup131], (instregex "RCL(16|32|64)rCL",
  1081. "RCR(16|32|64)rCL")>;
  1082. def BWWriteResGroup132 : SchedWriteRes<[BWPort1,BWPort06,BWPort15,BWPort0156]> {
  1083. let Latency = 11;
  1084. let NumMicroOps = 9;
  1085. let ResourceCycles = [1,4,1,3];
  1086. }
  1087. def: InstRW<[BWWriteResGroup132], (instrs RCL8rCL)>;
  1088. def BWWriteResGroup133 : SchedWriteRes<[BWPort06,BWPort0156]> {
  1089. let Latency = 11;
  1090. let NumMicroOps = 11;
  1091. let ResourceCycles = [2,9];
  1092. }
  1093. def: InstRW<[BWWriteResGroup133], (instrs LOOPE)>;
  1094. def: InstRW<[BWWriteResGroup133], (instrs LOOPNE)>;
  1095. def BWWriteResGroup135 : SchedWriteRes<[BWPort1,BWPort23]> {
  1096. let Latency = 12;
  1097. let NumMicroOps = 3;
  1098. let ResourceCycles = [2,1];
  1099. }
  1100. def: InstRW<[BWWriteResGroup135], (instregex "(ADD|SUB|SUBR)_FI(16|32)m")>;
  1101. def BWWriteResGroup139_1 : SchedWriteRes<[BWPort0,BWFPDivider]> {
  1102. let Latency = 14;
  1103. let NumMicroOps = 1;
  1104. let ResourceCycles = [1,4];
  1105. }
  1106. def : SchedAlias<WriteFDiv64, BWWriteResGroup139_1>; // TODO - convert to ZnWriteResFpuPair
  1107. def BWWriteResGroup141 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
  1108. let Latency = 14;
  1109. let NumMicroOps = 3;
  1110. let ResourceCycles = [1,1,1];
  1111. }
  1112. def: InstRW<[BWWriteResGroup141], (instregex "MUL_FI(16|32)m")>;
  1113. def BWWriteResGroup144 : SchedWriteRes<[BWPort1,BWPort6,BWPort23,BWPort0156]> {
  1114. let Latency = 14;
  1115. let NumMicroOps = 8;
  1116. let ResourceCycles = [2,2,1,3];
  1117. }
  1118. def: InstRW<[BWWriteResGroup144], (instregex "LAR(16|32|64)rr")>;
  1119. def BWWriteResGroup145 : SchedWriteRes<[BWPort1,BWPort06,BWPort15,BWPort0156]> {
  1120. let Latency = 14;
  1121. let NumMicroOps = 10;
  1122. let ResourceCycles = [2,3,1,4];
  1123. }
  1124. def: InstRW<[BWWriteResGroup145], (instrs RCR8rCL)>;
  1125. def BWWriteResGroup146 : SchedWriteRes<[BWPort0,BWPort1,BWPort6,BWPort0156]> {
  1126. let Latency = 14;
  1127. let NumMicroOps = 12;
  1128. let ResourceCycles = [2,1,4,5];
  1129. }
  1130. def: InstRW<[BWWriteResGroup146], (instrs XCH_F)>;
  1131. def BWWriteResGroup147 : SchedWriteRes<[BWPort0]> {
  1132. let Latency = 15;
  1133. let NumMicroOps = 1;
  1134. let ResourceCycles = [1];
  1135. }
  1136. def: InstRW<[BWWriteResGroup147], (instregex "DIVR_(FPrST0|FST0r|FrST0)")>;
  1137. def BWWriteResGroup149 : SchedWriteRes<[BWPort1,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
  1138. let Latency = 15;
  1139. let NumMicroOps = 10;
  1140. let ResourceCycles = [1,1,1,4,1,2];
  1141. }
  1142. def: InstRW<[BWWriteResGroup149], (instregex "RCL(8|16|32|64)mCL")>;
  1143. def BWWriteResGroup150 : SchedWriteRes<[BWPort0,BWPort23,BWFPDivider]> {
  1144. let Latency = 16;
  1145. let NumMicroOps = 2;
  1146. let ResourceCycles = [1,1,5];
  1147. }
  1148. def : SchedAlias<WriteFDivLd, BWWriteResGroup150>; // TODO - convert to ZnWriteResFpuPair
  1149. def BWWriteResGroup153 : SchedWriteRes<[BWPort4,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
  1150. let Latency = 16;
  1151. let NumMicroOps = 14;
  1152. let ResourceCycles = [1,1,1,4,2,5];
  1153. }
  1154. def: InstRW<[BWWriteResGroup153], (instrs CMPXCHG8B)>;
  1155. def BWWriteResGroup154 : SchedWriteRes<[BWPort5,BWPort6]> {
  1156. let Latency = 8;
  1157. let NumMicroOps = 20;
  1158. let ResourceCycles = [1,1];
  1159. }
  1160. def: InstRW<[BWWriteResGroup154], (instrs VZEROALL)>;
  1161. def BWWriteResGroup159 : SchedWriteRes<[BWPort5,BWPort6,BWPort06,BWPort0156]> {
  1162. let Latency = 18;
  1163. let NumMicroOps = 8;
  1164. let ResourceCycles = [1,1,1,5];
  1165. }
  1166. def: InstRW<[BWWriteResGroup159], (instrs CPUID)>;
  1167. def: InstRW<[BWWriteResGroup159], (instrs RDTSC)>;
  1168. def BWWriteResGroup160 : SchedWriteRes<[BWPort1,BWPort23,BWPort237,BWPort06,BWPort15,BWPort0156]> {
  1169. let Latency = 18;
  1170. let NumMicroOps = 11;
  1171. let ResourceCycles = [2,1,1,3,1,3];
  1172. }
  1173. def: InstRW<[BWWriteResGroup160], (instregex "RCR(8|16|32|64)mCL")>;
  1174. def BWWriteResGroup161 : SchedWriteRes<[BWPort0,BWPort23,BWFPDivider]> {
  1175. let Latency = 19;
  1176. let NumMicroOps = 2;
  1177. let ResourceCycles = [1,1,8];
  1178. }
  1179. def : SchedAlias<WriteFDiv64Ld, BWWriteResGroup161>; // TODO - convert to ZnWriteResFpuPair
  1180. def BWWriteResGroup165 : SchedWriteRes<[BWPort0]> {
  1181. let Latency = 20;
  1182. let NumMicroOps = 1;
  1183. let ResourceCycles = [1];
  1184. }
  1185. def: InstRW<[BWWriteResGroup165], (instregex "DIV_(FPrST0|FST0r|FrST0)")>;
  1186. def BWWriteResGroup167 : SchedWriteRes<[BWPort4,BWPort5,BWPort6,BWPort23,BWPort237,BWPort06,BWPort0156]> {
  1187. let Latency = 20;
  1188. let NumMicroOps = 8;
  1189. let ResourceCycles = [1,1,1,1,1,1,2];
  1190. }
  1191. def: InstRW<[BWWriteResGroup167], (instrs INSB, INSL, INSW)>;
  1192. def BWWriteResGroup169 : SchedWriteRes<[BWPort0,BWPort23]> {
  1193. let Latency = 21;
  1194. let NumMicroOps = 2;
  1195. let ResourceCycles = [1,1];
  1196. }
  1197. def: InstRW<[BWWriteResGroup169], (instregex "DIV_F(32|64)m")>;
  1198. def BWWriteResGroup171 : SchedWriteRes<[BWPort0,BWPort4,BWPort5,BWPort23,BWPort237,BWPort06,BWPort0156]> {
  1199. let Latency = 21;
  1200. let NumMicroOps = 19;
  1201. let ResourceCycles = [2,1,4,1,1,4,6];
  1202. }
  1203. def: InstRW<[BWWriteResGroup171], (instrs CMPXCHG16B)>;
  1204. def BWWriteResGroup172 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
  1205. let Latency = 22;
  1206. let NumMicroOps = 18;
  1207. let ResourceCycles = [1,1,16];
  1208. }
  1209. def: InstRW<[BWWriteResGroup172], (instrs POPF64)>;
  1210. def BWWriteResGroup176 : SchedWriteRes<[BWPort6,BWPort23,BWPort0156]> {
  1211. let Latency = 23;
  1212. let NumMicroOps = 19;
  1213. let ResourceCycles = [3,1,15];
  1214. }
  1215. def: InstRW<[BWWriteResGroup176], (instregex "XRSTOR(64)?")>;
  1216. def BWWriteResGroup177 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
  1217. let Latency = 24;
  1218. let NumMicroOps = 3;
  1219. let ResourceCycles = [1,1,1];
  1220. }
  1221. def: InstRW<[BWWriteResGroup177], (instregex "DIV_FI(16|32)m")>;
  1222. def BWWriteResGroup180 : SchedWriteRes<[BWPort0,BWPort23]> {
  1223. let Latency = 26;
  1224. let NumMicroOps = 2;
  1225. let ResourceCycles = [1,1];
  1226. }
  1227. def: InstRW<[BWWriteResGroup180], (instregex "DIVR_F(32|64)m")>;
  1228. def BWWriteResGroup182 : SchedWriteRes<[BWPort0,BWPort1,BWPort23]> {
  1229. let Latency = 29;
  1230. let NumMicroOps = 3;
  1231. let ResourceCycles = [1,1,1];
  1232. }
  1233. def: InstRW<[BWWriteResGroup182], (instregex "DIVR_FI(16|32)m")>;
  1234. def BWWriteResGroup183_1 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
  1235. let Latency = 17;
  1236. let NumMicroOps = 7;
  1237. let ResourceCycles = [1,3,2,1];
  1238. }
  1239. def: InstRW<[BWWriteResGroup183_1], (instrs VGATHERDPDrm, VPGATHERDQrm,
  1240. VGATHERQPDrm, VPGATHERQQrm)>;
  1241. def BWWriteResGroup183_2 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
  1242. let Latency = 18;
  1243. let NumMicroOps = 9;
  1244. let ResourceCycles = [1,3,4,1];
  1245. }
  1246. def: InstRW<[BWWriteResGroup183_2], (instrs VGATHERDPDYrm, VPGATHERDQYrm,
  1247. VGATHERQPDYrm, VPGATHERQQYrm)>;
  1248. def BWWriteResGroup183_3 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
  1249. let Latency = 19;
  1250. let NumMicroOps = 9;
  1251. let ResourceCycles = [1,5,2,1];
  1252. }
  1253. def: InstRW<[BWWriteResGroup183_3], (instrs VGATHERQPSrm, VPGATHERQDrm)>;
  1254. def BWWriteResGroup183_4 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
  1255. let Latency = 19;
  1256. let NumMicroOps = 10;
  1257. let ResourceCycles = [1,4,4,1];
  1258. }
  1259. def: InstRW<[BWWriteResGroup183_4], (instrs VGATHERDPSrm, VPGATHERDDrm,
  1260. VGATHERQPSYrm, VPGATHERQDYrm)>;
  1261. def BWWriteResGroup183_5 : SchedWriteRes<[BWPort4, BWPort5, BWPort23, BWPort0156]> {
  1262. let Latency = 21;
  1263. let NumMicroOps = 14;
  1264. let ResourceCycles = [1,4,8,1];
  1265. }
  1266. def: InstRW<[BWWriteResGroup183_5], (instrs VGATHERDPSYrm, VPGATHERDDYrm)>;
  1267. def BWWriteResGroup185 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
  1268. let Latency = 29;
  1269. let NumMicroOps = 27;
  1270. let ResourceCycles = [1,5,1,1,19];
  1271. }
  1272. def: InstRW<[BWWriteResGroup185], (instrs XSAVE64)>;
  1273. def BWWriteResGroup186 : SchedWriteRes<[BWPort4,BWPort6,BWPort23,BWPort237,BWPort0156]> {
  1274. let Latency = 30;
  1275. let NumMicroOps = 28;
  1276. let ResourceCycles = [1,6,1,1,19];
  1277. }
  1278. def: InstRW<[BWWriteResGroup186], (instrs XSAVE)>;
  1279. def: InstRW<[BWWriteResGroup186], (instregex "XSAVEC", "XSAVES", "XSAVEOPT")>;
  1280. def BWWriteResGroup191 : SchedWriteRes<[BWPort5,BWPort6,BWPort23,BWPort06,BWPort0156]> {
  1281. let Latency = 34;
  1282. let NumMicroOps = 23;
  1283. let ResourceCycles = [1,5,3,4,10];
  1284. }
  1285. def: InstRW<[BWWriteResGroup191], (instregex "IN(8|16|32)ri",
  1286. "IN(8|16|32)rr")>;
  1287. def BWWriteResGroup194 : SchedWriteRes<[BWPort5,BWPort6,BWPort23,BWPort237,BWPort06,BWPort0156]> {
  1288. let Latency = 35;
  1289. let NumMicroOps = 23;
  1290. let ResourceCycles = [1,5,2,1,4,10];
  1291. }
  1292. def: InstRW<[BWWriteResGroup194], (instregex "OUT(8|16|32)ir",
  1293. "OUT(8|16|32)rr")>;
  1294. def BWWriteResGroup196 : SchedWriteRes<[BWPort5,BWPort0156]> {
  1295. let Latency = 42;
  1296. let NumMicroOps = 22;
  1297. let ResourceCycles = [2,20];
  1298. }
  1299. def: InstRW<[BWWriteResGroup196], (instrs RDTSCP)>;
  1300. def BWWriteResGroup197 : SchedWriteRes<[BWPort0,BWPort01,BWPort23,BWPort05,BWPort06,BWPort015,BWPort0156]> {
  1301. let Latency = 60;
  1302. let NumMicroOps = 64;
  1303. let ResourceCycles = [2,2,8,1,10,2,39];
  1304. }
  1305. def: InstRW<[BWWriteResGroup197], (instrs FLDENVm)>;
  1306. def BWWriteResGroup198 : SchedWriteRes<[BWPort0,BWPort6,BWPort23,BWPort05,BWPort06,BWPort15,BWPort0156]> {
  1307. let Latency = 63;
  1308. let NumMicroOps = 88;
  1309. let ResourceCycles = [4,4,31,1,2,1,45];
  1310. }
  1311. def: InstRW<[BWWriteResGroup198], (instrs FXRSTOR64)>;
  1312. def BWWriteResGroup199 : SchedWriteRes<[BWPort0,BWPort6,BWPort23,BWPort05,BWPort06,BWPort15,BWPort0156]> {
  1313. let Latency = 63;
  1314. let NumMicroOps = 90;
  1315. let ResourceCycles = [4,2,33,1,2,1,47];
  1316. }
  1317. def: InstRW<[BWWriteResGroup199], (instrs FXRSTOR)>;
  1318. def BWWriteResGroup200 : SchedWriteRes<[BWPort5,BWPort01,BWPort0156]> {
  1319. let Latency = 75;
  1320. let NumMicroOps = 15;
  1321. let ResourceCycles = [6,3,6];
  1322. }
  1323. def: InstRW<[BWWriteResGroup200], (instrs FNINIT)>;
  1324. def BWWriteResGroup202 : SchedWriteRes<[BWPort0,BWPort1,BWPort4,BWPort5,BWPort6,BWPort237,BWPort06,BWPort0156]> {
  1325. let Latency = 115;
  1326. let NumMicroOps = 100;
  1327. let ResourceCycles = [9,9,11,8,1,11,21,30];
  1328. }
  1329. def: InstRW<[BWWriteResGroup202], (instrs FSTENVm)>;
  1330. def: InstRW<[WriteZero], (instrs CLC)>;
  1331. // Instruction variants handled by the renamer. These might not need execution
  1332. // ports in certain conditions.
  1333. // See Agner's Fog "The microarchitecture of Intel, AMD and VIA CPUs",
  1334. // section "Haswell and Broadwell Pipeline" > "Register allocation and
  1335. // renaming".
  1336. // These can be investigated with llvm-exegesis, e.g.
  1337. // echo 'pxor %mm0, %mm0' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
  1338. // echo 'vxorpd %xmm0, %xmm0, %xmm1' | /tmp/llvm-exegesis -mode=uops -snippets-file=-
  1339. def BWWriteZeroLatency : SchedWriteRes<[]> {
  1340. let Latency = 0;
  1341. }
  1342. def BWWriteZeroIdiom : SchedWriteVariant<[
  1343. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1344. SchedVar<NoSchedPred, [WriteALU]>
  1345. ]>;
  1346. def : InstRW<[BWWriteZeroIdiom], (instrs SUB32rr, SUB64rr,
  1347. XOR32rr, XOR64rr)>;
  1348. def BWWriteFZeroIdiom : SchedWriteVariant<[
  1349. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1350. SchedVar<NoSchedPred, [WriteFLogic]>
  1351. ]>;
  1352. def : InstRW<[BWWriteFZeroIdiom], (instrs XORPSrr, VXORPSrr, XORPDrr,
  1353. VXORPDrr)>;
  1354. def BWWriteFZeroIdiomY : SchedWriteVariant<[
  1355. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1356. SchedVar<NoSchedPred, [WriteFLogicY]>
  1357. ]>;
  1358. def : InstRW<[BWWriteFZeroIdiomY], (instrs VXORPSYrr, VXORPDYrr)>;
  1359. def BWWriteVZeroIdiomLogicX : SchedWriteVariant<[
  1360. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1361. SchedVar<NoSchedPred, [WriteVecLogicX]>
  1362. ]>;
  1363. def : InstRW<[BWWriteVZeroIdiomLogicX], (instrs PXORrr, VPXORrr)>;
  1364. def BWWriteVZeroIdiomLogicY : SchedWriteVariant<[
  1365. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1366. SchedVar<NoSchedPred, [WriteVecLogicY]>
  1367. ]>;
  1368. def : InstRW<[BWWriteVZeroIdiomLogicY], (instrs VPXORYrr)>;
  1369. def BWWriteVZeroIdiomALUX : SchedWriteVariant<[
  1370. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1371. SchedVar<NoSchedPred, [WriteVecALUX]>
  1372. ]>;
  1373. def : InstRW<[BWWriteVZeroIdiomALUX], (instrs PSUBBrr, VPSUBBrr,
  1374. PSUBDrr, VPSUBDrr,
  1375. PSUBQrr, VPSUBQrr,
  1376. PSUBWrr, VPSUBWrr,
  1377. PCMPGTBrr, VPCMPGTBrr,
  1378. PCMPGTDrr, VPCMPGTDrr,
  1379. PCMPGTWrr, VPCMPGTWrr)>;
  1380. def BWWriteVZeroIdiomALUY : SchedWriteVariant<[
  1381. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1382. SchedVar<NoSchedPred, [WriteVecALUY]>
  1383. ]>;
  1384. def : InstRW<[BWWriteVZeroIdiomALUY], (instrs VPSUBBYrr,
  1385. VPSUBDYrr,
  1386. VPSUBQYrr,
  1387. VPSUBWYrr,
  1388. VPCMPGTBYrr,
  1389. VPCMPGTDYrr,
  1390. VPCMPGTWYrr)>;
  1391. def BWWritePCMPGTQ : SchedWriteRes<[BWPort0]> {
  1392. let Latency = 5;
  1393. let NumMicroOps = 1;
  1394. let ResourceCycles = [1];
  1395. }
  1396. def BWWriteVZeroIdiomPCMPGTQ : SchedWriteVariant<[
  1397. SchedVar<MCSchedPredicate<ZeroIdiomPredicate>, [BWWriteZeroLatency]>,
  1398. SchedVar<NoSchedPred, [BWWritePCMPGTQ]>
  1399. ]>;
  1400. def : InstRW<[BWWriteVZeroIdiomPCMPGTQ], (instrs PCMPGTQrr, VPCMPGTQrr,
  1401. VPCMPGTQYrr)>;
  1402. // CMOVs that use both Z and C flag require an extra uop.
  1403. def BWWriteCMOVA_CMOVBErr : SchedWriteRes<[BWPort06,BWPort0156]> {
  1404. let Latency = 2;
  1405. let ResourceCycles = [1,1];
  1406. let NumMicroOps = 2;
  1407. }
  1408. def BWWriteCMOVA_CMOVBErm : SchedWriteRes<[BWPort23,BWPort06,BWPort0156]> {
  1409. let Latency = 7;
  1410. let ResourceCycles = [1,1,1];
  1411. let NumMicroOps = 3;
  1412. }
  1413. def BWCMOVA_CMOVBErr : SchedWriteVariant<[
  1414. SchedVar<MCSchedPredicate<IsCMOVArr_Or_CMOVBErr>, [BWWriteCMOVA_CMOVBErr]>,
  1415. SchedVar<NoSchedPred, [WriteCMOV]>
  1416. ]>;
  1417. def BWCMOVA_CMOVBErm : SchedWriteVariant<[
  1418. SchedVar<MCSchedPredicate<IsCMOVArm_Or_CMOVBErm>, [BWWriteCMOVA_CMOVBErm]>,
  1419. SchedVar<NoSchedPred, [WriteCMOV.Folded]>
  1420. ]>;
  1421. def : InstRW<[BWCMOVA_CMOVBErr], (instrs CMOV16rr, CMOV32rr, CMOV64rr)>;
  1422. def : InstRW<[BWCMOVA_CMOVBErm], (instrs CMOV16rm, CMOV32rm, CMOV64rm)>;
  1423. // SETCCs that use both Z and C flag require an extra uop.
  1424. def BWWriteSETA_SETBEr : SchedWriteRes<[BWPort06,BWPort0156]> {
  1425. let Latency = 2;
  1426. let ResourceCycles = [1,1];
  1427. let NumMicroOps = 2;
  1428. }
  1429. def BWWriteSETA_SETBEm : SchedWriteRes<[BWPort4,BWPort237,BWPort06,BWPort0156]> {
  1430. let Latency = 3;
  1431. let ResourceCycles = [1,1,1,1];
  1432. let NumMicroOps = 4;
  1433. }
  1434. def BWSETA_SETBErr : SchedWriteVariant<[
  1435. SchedVar<MCSchedPredicate<IsSETAr_Or_SETBEr>, [BWWriteSETA_SETBEr]>,
  1436. SchedVar<NoSchedPred, [WriteSETCC]>
  1437. ]>;
  1438. def BWSETA_SETBErm : SchedWriteVariant<[
  1439. SchedVar<MCSchedPredicate<IsSETAm_Or_SETBEm>, [BWWriteSETA_SETBEm]>,
  1440. SchedVar<NoSchedPred, [WriteSETCCStore]>
  1441. ]>;
  1442. def : InstRW<[BWSETA_SETBErr], (instrs SETCCr)>;
  1443. def : InstRW<[BWSETA_SETBErm], (instrs SETCCm)>;
  1444. ///////////////////////////////////////////////////////////////////////////////
  1445. // Dependency breaking instructions.
  1446. ///////////////////////////////////////////////////////////////////////////////
  1447. def : IsZeroIdiomFunction<[
  1448. // GPR Zero-idioms.
  1449. DepBreakingClass<[ SUB32rr, SUB64rr, XOR32rr, XOR64rr ], ZeroIdiomPredicate>,
  1450. // SSE Zero-idioms.
  1451. DepBreakingClass<[
  1452. // fp variants.
  1453. XORPSrr, XORPDrr,
  1454. // int variants.
  1455. PXORrr,
  1456. PSUBBrr, PSUBWrr, PSUBDrr, PSUBQrr,
  1457. PCMPGTBrr, PCMPGTDrr, PCMPGTQrr, PCMPGTWrr
  1458. ], ZeroIdiomPredicate>,
  1459. // AVX Zero-idioms.
  1460. DepBreakingClass<[
  1461. // xmm fp variants.
  1462. VXORPSrr, VXORPDrr,
  1463. // xmm int variants.
  1464. VPXORrr,
  1465. VPSUBBrr, VPSUBWrr, VPSUBDrr, VPSUBQrr,
  1466. VPCMPGTBrr, VPCMPGTWrr, VPCMPGTDrr, VPCMPGTQrr,
  1467. // ymm variants.
  1468. VXORPSYrr, VXORPDYrr, VPXORYrr,
  1469. VPSUBBYrr, VPSUBWYrr, VPSUBDYrr, VPSUBQYrr,
  1470. VPCMPGTBYrr, VPCMPGTWYrr, VPCMPGTDYrr, VPCMPGTQYrr
  1471. ], ZeroIdiomPredicate>,
  1472. ]>;
  1473. } // SchedModel