X86SchedHaswell.td 76 KB

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