X86ScheduleSLM.td 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. //=- X86ScheduleSLM.td - X86 Silvermont 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 Intel Silvermont to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. def SLMModel : SchedMachineModel {
  14. // All x86 instructions are modeled as a single micro-op, and SLM can decode 2
  15. // instructions per cycle.
  16. let IssueWidth = 2;
  17. let MicroOpBufferSize = 32; // Based on the reorder buffer.
  18. let LoadLatency = 3;
  19. let MispredictPenalty = 10;
  20. let PostRAScheduler = 1;
  21. // For small loops, expand by a small factor to hide the backedge cost.
  22. let LoopMicroOpBufferSize = 10;
  23. // FIXME: SSE4 is unimplemented. This flag is set to allow
  24. // the scheduler to assign a default model to unrecognized opcodes.
  25. let CompleteModel = 0;
  26. }
  27. let SchedModel = SLMModel in {
  28. // Silvermont has 5 reservation stations for micro-ops
  29. def SLM_IEC_RSV0 : ProcResource<1>;
  30. def SLM_IEC_RSV1 : ProcResource<1>;
  31. def SLM_FPC_RSV0 : ProcResource<1> { let BufferSize = 1; }
  32. def SLM_FPC_RSV1 : ProcResource<1> { let BufferSize = 1; }
  33. def SLM_MEC_RSV : ProcResource<1>;
  34. // Many micro-ops are capable of issuing on multiple ports.
  35. def SLM_IEC_RSV01 : ProcResGroup<[SLM_IEC_RSV0, SLM_IEC_RSV1]>;
  36. def SLM_FPC_RSV01 : ProcResGroup<[SLM_FPC_RSV0, SLM_FPC_RSV1]>;
  37. def SLMDivider : ProcResource<1>;
  38. def SLMFPMultiplier : ProcResource<1>;
  39. def SLMFPDivider : ProcResource<1>;
  40. // Loads are 3 cycles, so ReadAfterLd registers needn't be available until 3
  41. // cycles after the memory operand.
  42. def : ReadAdvance<ReadAfterLd, 3>;
  43. def : ReadAdvance<ReadAfterVecLd, 3>;
  44. def : ReadAdvance<ReadAfterVecXLd, 3>;
  45. def : ReadAdvance<ReadAfterVecYLd, 3>;
  46. def : ReadAdvance<ReadInt2Fpu, 0>;
  47. // Many SchedWrites are defined in pairs with and without a folded load.
  48. // Instructions with folded loads are usually micro-fused, so they only appear
  49. // as two micro-ops when queued in the reservation station.
  50. // This multiclass defines the resource usage for variants with and without
  51. // folded loads.
  52. multiclass SLMWriteResPair<X86FoldableSchedWrite SchedRW,
  53. list<ProcResourceKind> ExePorts,
  54. int Lat, list<int> Res = [1], int UOps = 1,
  55. int LoadUOps = 0, int LoadLat = 3> {
  56. // Register variant is using a single cycle on ExePort.
  57. def : WriteRes<SchedRW, ExePorts> {
  58. let Latency = Lat;
  59. let ResourceCycles = Res;
  60. let NumMicroOps = UOps;
  61. }
  62. // Memory variant also uses a cycle on MEC_RSV and adds LoadLat cycles to
  63. // the latency (default = 3).
  64. def : WriteRes<SchedRW.Folded, !listconcat([SLM_MEC_RSV], ExePorts)> {
  65. let Latency = !add(Lat, LoadLat);
  66. let ResourceCycles = !listconcat([1], Res);
  67. let NumMicroOps = !add(UOps, LoadUOps);
  68. }
  69. }
  70. // A folded store needs a cycle on MEC_RSV for the store data (using the same uop),
  71. // but it does not need an extra port cycle to recompute the address.
  72. def : WriteRes<WriteRMW, [SLM_MEC_RSV]> { let NumMicroOps = 0; }
  73. def : WriteRes<WriteStore, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
  74. def : WriteRes<WriteStoreNT, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
  75. def : WriteRes<WriteLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  76. def : WriteRes<WriteMove, [SLM_IEC_RSV01]>;
  77. def : WriteRes<WriteZero, []>;
  78. defm : X86WriteResUnsupported<WriteVecMaskedGatherWriteback>;
  79. // Load/store MXCSR.
  80. defm : X86WriteRes<WriteSTMXCSR, [SLM_MEC_RSV], 12,[11], 4>;
  81. defm : X86WriteRes<WriteLDMXCSR, [SLM_MEC_RSV], 10, [8], 5>;
  82. // Treat misc copies as a move.
  83. def : InstRW<[WriteMove], (instrs COPY)>;
  84. defm : SLMWriteResPair<WriteALU, [SLM_IEC_RSV01], 1>;
  85. defm : SLMWriteResPair<WriteADC, [SLM_IEC_RSV01], 1>;
  86. defm : SLMWriteResPair<WriteIMul8, [SLM_IEC_RSV1], 5, [5], 3>;
  87. defm : SLMWriteResPair<WriteIMul16, [SLM_IEC_RSV1], 5, [5], 4, 1>;
  88. defm : SLMWriteResPair<WriteIMul16Imm, [SLM_IEC_RSV1], 4, [4], 2, 1>;
  89. defm : SLMWriteResPair<WriteIMul16Reg, [SLM_IEC_RSV1], 4, [4], 2, 1>;
  90. defm : SLMWriteResPair<WriteIMul32, [SLM_IEC_RSV1], 5, [5], 3, 1>;
  91. defm : SLMWriteResPair<WriteIMul32Imm, [SLM_IEC_RSV1], 3>;
  92. defm : SLMWriteResPair<WriteIMul32Reg, [SLM_IEC_RSV1], 3>;
  93. defm : SLMWriteResPair<WriteIMul64, [SLM_IEC_RSV1], 7, [7], 3>;
  94. defm : SLMWriteResPair<WriteIMul64Imm, [SLM_IEC_RSV1], 5, [2]>;
  95. defm : SLMWriteResPair<WriteIMul64Reg, [SLM_IEC_RSV1], 5, [2]>;
  96. defm : X86WriteResUnsupported<WriteIMulH>;
  97. defm : X86WriteResUnsupported<WriteIMulHLd>;
  98. defm : X86WriteResPairUnsupported<WriteMULX32>;
  99. defm : X86WriteResPairUnsupported<WriteMULX64>;
  100. defm : X86WriteRes<WriteBSWAP32, [SLM_IEC_RSV01], 1, [1], 1>;
  101. defm : X86WriteRes<WriteBSWAP64, [SLM_IEC_RSV01], 1, [1], 1>;
  102. defm : X86WriteRes<WriteCMPXCHG, [SLM_IEC_RSV01], 6, [6], 5>;
  103. defm : X86WriteRes<WriteCMPXCHGRMW, [SLM_IEC_RSV01, SLM_MEC_RSV], 10, [6, 2], 8>;
  104. defm : X86WriteRes<WriteXCHG, [SLM_IEC_RSV01], 3, [3], 3>;
  105. defm : SLMWriteResPair<WriteShift, [SLM_IEC_RSV0], 1>;
  106. defm : SLMWriteResPair<WriteShiftCL, [SLM_IEC_RSV0], 1>;
  107. defm : SLMWriteResPair<WriteRotate, [SLM_IEC_RSV0], 1>;
  108. defm : SLMWriteResPair<WriteRotateCL, [SLM_IEC_RSV0], 1>;
  109. defm : X86WriteRes<WriteSHDrri, [SLM_IEC_RSV0], 1, [1], 1>;
  110. defm : X86WriteRes<WriteSHDrrcl,[SLM_IEC_RSV0], 1, [1], 1>;
  111. defm : X86WriteRes<WriteSHDmri, [SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
  112. defm : X86WriteRes<WriteSHDmrcl,[SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
  113. defm : SLMWriteResPair<WriteJump, [SLM_IEC_RSV1], 1>;
  114. defm : SLMWriteResPair<WriteCRC32, [SLM_IEC_RSV1], 3>;
  115. defm : SLMWriteResPair<WriteCMOV, [SLM_IEC_RSV01], 2, [2]>;
  116. defm : X86WriteRes<WriteFCMOV, [SLM_FPC_RSV1], 3, [1], 1>; // x87 conditional move.
  117. def : WriteRes<WriteSETCC, [SLM_IEC_RSV01]>;
  118. def : WriteRes<WriteSETCCStore, [SLM_IEC_RSV01, SLM_MEC_RSV]> {
  119. // FIXME Latency and NumMicrOps?
  120. let ResourceCycles = [2,1];
  121. }
  122. defm : X86WriteRes<WriteLAHFSAHF, [SLM_IEC_RSV01], 1, [1], 1>;
  123. defm : X86WriteRes<WriteBitTest, [SLM_IEC_RSV0, SLM_IEC_RSV1], 1, [1,1], 1>;
  124. defm : X86WriteRes<WriteBitTestImmLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 4, [1,1,1], 1>;
  125. defm : X86WriteRes<WriteBitTestRegLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 4, [1,1,1], 7>;
  126. defm : X86WriteRes<WriteBitTestSet, [SLM_IEC_RSV0, SLM_IEC_RSV1], 1, [1,1], 1>;
  127. defm : X86WriteRes<WriteBitTestSetImmLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 3, [1,1,1], 1>;
  128. defm : X86WriteRes<WriteBitTestSetRegLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 3, [1,1,1], 8>;
  129. // This is for simple LEAs with one or two input operands.
  130. // The complex ones can only execute on port 1, and they require two cycles on
  131. // the port to read all inputs. We don't model that.
  132. def : WriteRes<WriteLEA, [SLM_IEC_RSV1]>;
  133. // Bit counts.
  134. defm : SLMWriteResPair<WriteBSF, [SLM_IEC_RSV0, SLM_IEC_RSV1], 10, [10,10], 10>;
  135. defm : SLMWriteResPair<WriteBSR, [SLM_IEC_RSV0, SLM_IEC_RSV1], 10, [10,10], 10>;
  136. defm : SLMWriteResPair<WriteLZCNT, [SLM_IEC_RSV0], 3>;
  137. defm : SLMWriteResPair<WriteTZCNT, [SLM_IEC_RSV0], 3>;
  138. defm : SLMWriteResPair<WritePOPCNT, [SLM_IEC_RSV0], 3>;
  139. // BMI1 BEXTR/BLS, BMI2 BZHI
  140. defm : X86WriteResPairUnsupported<WriteBEXTR>;
  141. defm : X86WriteResPairUnsupported<WriteBLS>;
  142. defm : X86WriteResPairUnsupported<WriteBZHI>;
  143. defm : SLMWriteResPair<WriteDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  144. defm : SLMWriteResPair<WriteDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  145. defm : SLMWriteResPair<WriteDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  146. defm : SLMWriteResPair<WriteDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  147. defm : SLMWriteResPair<WriteIDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  148. defm : SLMWriteResPair<WriteIDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  149. defm : SLMWriteResPair<WriteIDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  150. defm : SLMWriteResPair<WriteIDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  151. // Scalar and vector floating point.
  152. defm : X86WriteRes<WriteFLD0, [SLM_FPC_RSV01], 1, [1], 1>;
  153. defm : X86WriteRes<WriteFLD1, [SLM_FPC_RSV01], 1, [1], 1>;
  154. defm : X86WriteRes<WriteFLDC, [SLM_FPC_RSV01], 1, [2], 2>;
  155. def : WriteRes<WriteFLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  156. def : WriteRes<WriteFLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
  157. defm : X86WriteResUnsupported<WriteFLoadY>;
  158. def : WriteRes<WriteFMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  159. defm : X86WriteResUnsupported<WriteFMaskedLoadY>;
  160. def : WriteRes<WriteFStore, [SLM_MEC_RSV]>;
  161. def : WriteRes<WriteFStoreX, [SLM_MEC_RSV]>;
  162. defm : X86WriteResUnsupported<WriteFStoreY>;
  163. def : WriteRes<WriteFStoreNT, [SLM_MEC_RSV]>;
  164. def : WriteRes<WriteFStoreNTX, [SLM_MEC_RSV]>;
  165. defm : X86WriteResUnsupported<WriteFStoreNTY>;
  166. def : WriteRes<WriteFMaskedStore32, [SLM_MEC_RSV]>;
  167. defm : X86WriteResUnsupported<WriteFMaskedStore32Y>;
  168. def : WriteRes<WriteFMaskedStore64, [SLM_MEC_RSV]>;
  169. defm : X86WriteResUnsupported<WriteFMaskedStore64Y>;
  170. def : WriteRes<WriteFMove, [SLM_FPC_RSV01]>;
  171. def : WriteRes<WriteFMoveX, [SLM_FPC_RSV01]>;
  172. defm : X86WriteResUnsupported<WriteFMoveY>;
  173. defm : X86WriteResUnsupported<WriteFMoveZ>;
  174. defm : X86WriteRes<WriteEMMS, [SLM_FPC_RSV01], 10, [10], 9>;
  175. defm : SLMWriteResPair<WriteFAdd, [SLM_FPC_RSV1], 3>;
  176. defm : SLMWriteResPair<WriteFAddX, [SLM_FPC_RSV1], 3>;
  177. defm : X86WriteResPairUnsupported<WriteFAddY>;
  178. defm : X86WriteResPairUnsupported<WriteFAddZ>;
  179. defm : SLMWriteResPair<WriteFAdd64, [SLM_FPC_RSV1], 3>;
  180. defm : SLMWriteResPair<WriteFAdd64X, [SLM_FPC_RSV1], 4, [2]>;
  181. defm : X86WriteResPairUnsupported<WriteFAdd64Y>;
  182. defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
  183. defm : SLMWriteResPair<WriteFCmp, [SLM_FPC_RSV1], 3>;
  184. defm : SLMWriteResPair<WriteFCmpX, [SLM_FPC_RSV1], 3>;
  185. defm : X86WriteResPairUnsupported<WriteFCmpY>;
  186. defm : X86WriteResPairUnsupported<WriteFCmpZ>;
  187. defm : SLMWriteResPair<WriteFCmp64, [SLM_FPC_RSV1], 3>;
  188. defm : SLMWriteResPair<WriteFCmp64X, [SLM_FPC_RSV1], 3>;
  189. defm : X86WriteResPairUnsupported<WriteFCmp64Y>;
  190. defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
  191. defm : SLMWriteResPair<WriteFCom, [SLM_FPC_RSV1], 3>;
  192. defm : SLMWriteResPair<WriteFComX, [SLM_FPC_RSV1], 3>;
  193. defm : SLMWriteResPair<WriteFMul, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  194. defm : SLMWriteResPair<WriteFMulX, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  195. defm : X86WriteResPairUnsupported<WriteFMulY>;
  196. defm : X86WriteResPairUnsupported<WriteFMulZ>;
  197. defm : SLMWriteResPair<WriteFMul64, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  198. defm : SLMWriteResPair<WriteFMul64X, [SLM_FPC_RSV0, SLMFPMultiplier], 7, [1,4]>;
  199. defm : X86WriteResPairUnsupported<WriteFMul64Y>;
  200. defm : X86WriteResPairUnsupported<WriteFMul64Z>;
  201. defm : X86WriteResPairUnsupported<WriteFMA>;
  202. defm : X86WriteResPairUnsupported<WriteFMAX>;
  203. defm : X86WriteResPairUnsupported<WriteFMAY>;
  204. defm : X86WriteResPairUnsupported<WriteFMAZ>;
  205. defm : SLMWriteResPair<WriteFDiv, [SLM_FPC_RSV0, SLMFPDivider], 19, [1,17]>;
  206. defm : SLMWriteResPair<WriteFDivX, [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39], 6, 1>;
  207. defm : X86WriteResPairUnsupported<WriteFDivY>;
  208. defm : X86WriteResPairUnsupported<WriteFDivZ>;
  209. defm : SLMWriteResPair<WriteFDiv64, [SLM_FPC_RSV0, SLMFPDivider], 34, [1,32]>;
  210. defm : SLMWriteResPair<WriteFDiv64X, [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69], 6, 1>;
  211. defm : X86WriteResPairUnsupported<WriteFDiv64Y>;
  212. defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
  213. defm : SLMWriteResPair<WriteFRcp, [SLM_FPC_RSV0], 4>;
  214. defm : SLMWriteResPair<WriteFRcpX, [SLM_FPC_RSV0], 9, [8], 5, 1>;
  215. defm : X86WriteResPairUnsupported<WriteFRcpY>;
  216. defm : X86WriteResPairUnsupported<WriteFRcpZ>;
  217. defm : SLMWriteResPair<WriteFRsqrt, [SLM_FPC_RSV0], 4>;
  218. defm : SLMWriteResPair<WriteFRsqrtX, [SLM_FPC_RSV0], 9, [8], 5, 1>;
  219. defm : X86WriteResPairUnsupported<WriteFRsqrtY>;
  220. defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
  221. defm : SLMWriteResPair<WriteFSqrt, [SLM_FPC_RSV0, SLMFPDivider], 20, [1,20]>;
  222. defm : SLMWriteResPair<WriteFSqrtX, [SLM_FPC_RSV0, SLMFPDivider], 41, [1,40], 5, 1>;
  223. defm : X86WriteResPairUnsupported<WriteFSqrtY>;
  224. defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
  225. defm : SLMWriteResPair<WriteFSqrt64, [SLM_FPC_RSV0, SLMFPDivider], 35, [1,35]>;
  226. defm : SLMWriteResPair<WriteFSqrt64X, [SLM_FPC_RSV0, SLMFPDivider], 71, [1,70], 5, 1>;
  227. defm : X86WriteResPairUnsupported<WriteFSqrt64Y>;
  228. defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
  229. defm : SLMWriteResPair<WriteFSqrt80, [SLM_FPC_RSV0,SLMFPDivider], 40, [1,40]>;
  230. defm : SLMWriteResPair<WriteDPPD, [SLM_FPC_RSV1], 12, [8], 5, 1>;
  231. defm : SLMWriteResPair<WriteDPPS, [SLM_FPC_RSV1], 15, [12], 9, 1>;
  232. defm : X86WriteResPairUnsupported<WriteDPPSY>;
  233. defm : SLMWriteResPair<WriteFSign, [SLM_FPC_RSV01], 1>;
  234. defm : SLMWriteResPair<WriteFRnd, [SLM_FPC_RSV1], 3>;
  235. defm : X86WriteResPairUnsupported<WriteFRndY>;
  236. defm : X86WriteResPairUnsupported<WriteFRndZ>;
  237. defm : SLMWriteResPair<WriteFLogic, [SLM_FPC_RSV01], 1>;
  238. defm : X86WriteResPairUnsupported<WriteFLogicY>;
  239. defm : X86WriteResPairUnsupported<WriteFLogicZ>;
  240. defm : SLMWriteResPair<WriteFTest, [SLM_FPC_RSV01], 1>;
  241. defm : X86WriteResPairUnsupported<WriteFTestY>;
  242. defm : X86WriteResPairUnsupported<WriteFTestZ>;
  243. defm : SLMWriteResPair<WriteFShuffle, [SLM_FPC_RSV0], 1>;
  244. defm : X86WriteResPairUnsupported<WriteFShuffleY>;
  245. defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
  246. defm : SLMWriteResPair<WriteFVarShuffle, [SLM_FPC_RSV0], 1>;
  247. defm : X86WriteResPairUnsupported<WriteFVarShuffleY>;
  248. defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
  249. defm : SLMWriteResPair<WriteFBlend, [SLM_FPC_RSV0], 1>;
  250. defm : X86WriteResPairUnsupported<WriteFBlendY>;
  251. defm : X86WriteResPairUnsupported<WriteFBlendZ>;
  252. defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 1>;
  253. defm : X86WriteResPairUnsupported<WriteFVarBlendY>;
  254. defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
  255. defm : X86WriteResPairUnsupported<WriteFShuffle256>;
  256. defm : X86WriteResPairUnsupported<WriteFVarShuffle256>;
  257. // Conversion between integer and float.
  258. defm : SLMWriteResPair<WriteCvtSS2I, [SLM_FPC_RSV0], 5>;
  259. defm : SLMWriteResPair<WriteCvtPS2I, [SLM_FPC_RSV0], 5, [2]>;
  260. defm : X86WriteResPairUnsupported<WriteCvtPS2IY>;
  261. defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
  262. defm : SLMWriteResPair<WriteCvtSD2I, [SLM_FPC_RSV0], 5>;
  263. defm : SLMWriteResPair<WriteCvtPD2I, [SLM_FPC_RSV0], 5, [2]>;
  264. defm : X86WriteResPairUnsupported<WriteCvtPD2IY>;
  265. defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
  266. defm : SLMWriteResPair<WriteCvtI2SS, [SLM_FPC_RSV0], 5, [2]>;
  267. defm : SLMWriteResPair<WriteCvtI2PS, [SLM_FPC_RSV0], 5, [2]>;
  268. defm : X86WriteResPairUnsupported<WriteCvtI2PSY>;
  269. defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
  270. defm : SLMWriteResPair<WriteCvtI2SD, [SLM_FPC_RSV0], 5, [2]>;
  271. defm : SLMWriteResPair<WriteCvtI2PD, [SLM_FPC_RSV0], 5, [2]>;
  272. defm : X86WriteResPairUnsupported<WriteCvtI2PDY>;
  273. defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
  274. defm : SLMWriteResPair<WriteCvtSS2SD, [SLM_FPC_RSV0], 4, [2]>;
  275. defm : SLMWriteResPair<WriteCvtPS2PD, [SLM_FPC_RSV0], 5, [2]>;
  276. defm : X86WriteResPairUnsupported<WriteCvtPS2PDY>;
  277. defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
  278. defm : SLMWriteResPair<WriteCvtSD2SS, [SLM_FPC_RSV0], 4, [2]>;
  279. defm : SLMWriteResPair<WriteCvtPD2PS, [SLM_FPC_RSV0], 5, [2]>;
  280. defm : X86WriteResPairUnsupported<WriteCvtPD2PSY>;
  281. defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
  282. defm : X86WriteResPairUnsupported<WriteCvtPH2PS>;
  283. defm : X86WriteResPairUnsupported<WriteCvtPH2PSY>;
  284. defm : X86WriteResPairUnsupported<WriteCvtPH2PSZ>;
  285. defm : X86WriteResUnsupported<WriteCvtPS2PH>;
  286. defm : X86WriteResUnsupported<WriteCvtPS2PHY>;
  287. defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
  288. defm : X86WriteResUnsupported<WriteCvtPS2PHSt>;
  289. defm : X86WriteResUnsupported<WriteCvtPS2PHYSt>;
  290. defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
  291. // Vector integer operations.
  292. def : WriteRes<WriteVecLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  293. def : WriteRes<WriteVecLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
  294. defm : X86WriteResUnsupported<WriteVecLoadY>;
  295. def : WriteRes<WriteVecLoadNT, [SLM_MEC_RSV]> { let Latency = 3; }
  296. defm : X86WriteResUnsupported<WriteVecLoadNTY>;
  297. def : WriteRes<WriteVecMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  298. defm : X86WriteResUnsupported<WriteVecMaskedLoadY>;
  299. def : WriteRes<WriteVecStore, [SLM_MEC_RSV]>;
  300. def : WriteRes<WriteVecStoreX, [SLM_MEC_RSV]>;
  301. defm : X86WriteResUnsupported<WriteVecStoreY>;
  302. def : WriteRes<WriteVecStoreNT, [SLM_MEC_RSV]>;
  303. defm : X86WriteResUnsupported<WriteVecStoreNTY>;
  304. def : WriteRes<WriteVecMaskedStore32, [SLM_MEC_RSV]>;
  305. defm : X86WriteResUnsupported<WriteVecMaskedStore32Y>;
  306. def : WriteRes<WriteVecMaskedStore64, [SLM_MEC_RSV]>;
  307. defm : X86WriteResUnsupported<WriteVecMaskedStore64Y>;
  308. def : WriteRes<WriteVecMove, [SLM_FPC_RSV01]>;
  309. def : WriteRes<WriteVecMoveX, [SLM_FPC_RSV01]>;
  310. defm : X86WriteResUnsupported<WriteVecMoveY>;
  311. defm : X86WriteResUnsupported<WriteVecMoveZ>;
  312. def : WriteRes<WriteVecMoveToGpr, [SLM_IEC_RSV01]>;
  313. def : WriteRes<WriteVecMoveFromGpr, [SLM_IEC_RSV01]>;
  314. defm : SLMWriteResPair<WriteVecShift, [SLM_FPC_RSV0], 2, [2]>;
  315. defm : SLMWriteResPair<WriteVecShiftX, [SLM_FPC_RSV0], 2, [2]>;
  316. defm : X86WriteResPairUnsupported<WriteVecShiftY>;
  317. defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
  318. defm : SLMWriteResPair<WriteVecShiftImm, [SLM_FPC_RSV0], 1>;
  319. defm : SLMWriteResPair<WriteVecShiftImmX,[SLM_FPC_RSV0], 1>;
  320. defm : X86WriteResPairUnsupported<WriteVecShiftImmY>;
  321. defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
  322. defm : X86WriteResPairUnsupported<WriteVarVecShift>;
  323. defm : X86WriteResPairUnsupported<WriteVarVecShiftY>;
  324. defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
  325. defm : SLMWriteResPair<WriteVecLogic, [SLM_FPC_RSV01], 1>;
  326. defm : SLMWriteResPair<WriteVecLogicX,[SLM_FPC_RSV01], 1>;
  327. defm : X86WriteResPairUnsupported<WriteVecLogicY>;
  328. defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
  329. defm : SLMWriteResPair<WriteVecTest, [SLM_FPC_RSV01], 1>;
  330. defm : X86WriteResPairUnsupported<WriteVecTestY>;
  331. defm : X86WriteResPairUnsupported<WriteVecTestZ>;
  332. defm : SLMWriteResPair<WriteVecALU, [SLM_FPC_RSV01], 1>;
  333. defm : SLMWriteResPair<WriteVecALUX, [SLM_FPC_RSV01], 1>;
  334. defm : X86WriteResPairUnsupported<WriteVecALUY>;
  335. defm : X86WriteResPairUnsupported<WriteVecALUZ>;
  336. defm : SLMWriteResPair<WriteVecIMul, [SLM_FPC_RSV0], 4>;
  337. defm : SLMWriteResPair<WriteVecIMulX, [SLM_FPC_RSV0], 5, [2]>;
  338. defm : X86WriteResPairUnsupported<WriteVecIMulY>;
  339. defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
  340. defm : SLMWriteResPair<WritePMULLD, [SLM_FPC_RSV0], 11, [11], 7>;
  341. defm : X86WriteResPairUnsupported<WritePMULLDY>;
  342. defm : X86WriteResPairUnsupported<WritePMULLDZ>;
  343. defm : SLMWriteResPair<WriteShuffle, [SLM_FPC_RSV0], 1>;
  344. defm : X86WriteResPairUnsupported<WriteShuffleY>;
  345. defm : X86WriteResPairUnsupported<WriteShuffleZ>;
  346. defm : SLMWriteResPair<WriteShuffleX, [SLM_FPC_RSV0], 1>;
  347. defm : SLMWriteResPair<WriteVarShuffle, [SLM_FPC_RSV0], 1>;
  348. defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0], 5, [5], 4, 1>;
  349. defm : X86WriteResPairUnsupported<WriteVarShuffleY>;
  350. defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
  351. defm : SLMWriteResPair<WriteBlend, [SLM_FPC_RSV0], 1>;
  352. defm : X86WriteResPairUnsupported<WriteBlendY>;
  353. defm : X86WriteResPairUnsupported<WriteBlendZ>;
  354. defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 1>;
  355. defm : X86WriteResPairUnsupported<WriteVarBlendY>;
  356. defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
  357. defm : SLMWriteResPair<WriteMPSAD, [SLM_FPC_RSV0], 7, [5], 3, 1>;
  358. defm : X86WriteResPairUnsupported<WriteMPSADY>;
  359. defm : X86WriteResPairUnsupported<WriteMPSADZ>;
  360. defm : SLMWriteResPair<WritePSADBW, [SLM_FPC_RSV0], 4>;
  361. defm : SLMWriteResPair<WritePSADBWX, [SLM_FPC_RSV0], 5, [2]>;
  362. defm : X86WriteResPairUnsupported<WritePSADBWY>;
  363. defm : X86WriteResPairUnsupported<WritePSADBWZ>;
  364. defm : SLMWriteResPair<WritePHMINPOS, [SLM_FPC_RSV0], 4>;
  365. defm : X86WriteResPairUnsupported<WriteShuffle256>;
  366. defm : X86WriteResPairUnsupported<WriteVarShuffle256>;
  367. defm : X86WriteResPairUnsupported<WriteVPMOV256>;
  368. // Vector insert/extract operations.
  369. defm : SLMWriteResPair<WriteVecInsert, [SLM_FPC_RSV0], 1>;
  370. def : WriteRes<WriteVecExtract, [SLM_FPC_RSV0]> {
  371. let NumMicroOps = 2;
  372. }
  373. def : WriteRes<WriteVecExtractSt, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
  374. let Latency = 4;
  375. let NumMicroOps = 5;
  376. let ResourceCycles = [1, 2];
  377. }
  378. ////////////////////////////////////////////////////////////////////////////////
  379. // Horizontal add/sub instructions.
  380. ////////////////////////////////////////////////////////////////////////////////
  381. defm : SLMWriteResPair<WriteFHAdd, [SLM_FPC_RSV1], 6, [6], 4, 1>;
  382. defm : X86WriteResPairUnsupported<WriteFHAddY>;
  383. defm : X86WriteResPairUnsupported<WriteFHAddZ>;
  384. defm : SLMWriteResPair<WritePHAdd, [SLM_FPC_RSV01], 6, [6], 3, 1>;
  385. defm : SLMWriteResPair<WritePHAddX, [SLM_FPC_RSV01], 6, [6], 3, 1>;
  386. defm : X86WriteResPairUnsupported<WritePHAddY>;
  387. defm : X86WriteResPairUnsupported<WritePHAddZ>;
  388. // String instructions.
  389. // Packed Compare Implicit Length Strings, Return Mask
  390. defm : SLMWriteResPair<WritePCmpIStrM, [SLM_FPC_RSV0], 13, [13], 5, 1>;
  391. // Packed Compare Explicit Length Strings, Return Mask
  392. defm : SLMWriteResPair<WritePCmpEStrM, [SLM_FPC_RSV0], 17, [17], 8, 1>;
  393. // Packed Compare Implicit Length Strings, Return Index
  394. defm : SLMWriteResPair<WritePCmpIStrI, [SLM_FPC_RSV0], 17, [17], 6, 1>;
  395. // Packed Compare Explicit Length Strings, Return Index
  396. defm : SLMWriteResPair<WritePCmpEStrI, [SLM_FPC_RSV0], 21, [21], 9, 1>;
  397. // MOVMSK Instructions.
  398. def : WriteRes<WriteFMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  399. def : WriteRes<WriteVecMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  400. def : WriteRes<WriteMMXMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  401. defm : X86WriteResUnsupported<WriteVecMOVMSKY>;
  402. // AES Instructions.
  403. defm : SLMWriteResPair<WriteAESDecEnc, [SLM_FPC_RSV0], 8, [5], 4, 1>;
  404. defm : SLMWriteResPair<WriteAESIMC, [SLM_FPC_RSV0], 8, [4], 3, 1>;
  405. defm : SLMWriteResPair<WriteAESKeyGen, [SLM_FPC_RSV0], 8, [4], 3, 1>;
  406. // Carry-less multiplication instructions.
  407. defm : SLMWriteResPair<WriteCLMul, [SLM_FPC_RSV0], 10, [10], 8, 1>;
  408. def : WriteRes<WriteSystem, [SLM_FPC_RSV0]> { let Latency = 100; }
  409. def : WriteRes<WriteMicrocoded, [SLM_FPC_RSV0]> { let Latency = 100; }
  410. def : WriteRes<WriteFence, [SLM_MEC_RSV]>;
  411. def : WriteRes<WriteNop, []>;
  412. // Remaining SLM instrs.
  413. def SLMWriteResGroup1rr : SchedWriteRes<[SLM_FPC_RSV01]> {
  414. let Latency = 4;
  415. let NumMicroOps = 2;
  416. let ResourceCycles = [8];
  417. }
  418. def: InstRW<[SLMWriteResGroup1rr], (instrs MMX_PADDQrr, PADDQrr,
  419. MMX_PSUBQrr, PSUBQrr,
  420. PCMPEQQrr)>;
  421. def SLMWriteResGroup2rr : SchedWriteRes<[SLM_FPC_RSV0]> {
  422. let Latency = 5;
  423. let NumMicroOps = 1;
  424. let ResourceCycles = [2];
  425. }
  426. def: InstRW<[SLMWriteResGroup2rr], (instrs PCMPGTQrr)>;
  427. def SLMWriteResGroup1rm : SchedWriteRes<[SLM_MEC_RSV,SLM_FPC_RSV01]> {
  428. let Latency = 7;
  429. let NumMicroOps = 3;
  430. let ResourceCycles = [1,8];
  431. }
  432. def: InstRW<[SLMWriteResGroup1rm], (instrs MMX_PADDQrm, PADDQrm,
  433. MMX_PSUBQrm, PSUBQrm,
  434. PCMPEQQrm)>;
  435. def SLMWriteResGroup2rm : SchedWriteRes<[SLM_MEC_RSV,SLM_FPC_RSV0]> {
  436. let Latency = 8;
  437. let NumMicroOps = 2;
  438. let ResourceCycles = [1,2];
  439. }
  440. def: InstRW<[SLMWriteResGroup2rm], (instrs PCMPGTQrm)>;
  441. ///////////////////////////////////////////////////////////////////////////////
  442. // Dependency breaking instructions.
  443. ///////////////////////////////////////////////////////////////////////////////
  444. def : IsZeroIdiomFunction<[
  445. // GPR Zero-idioms.
  446. DepBreakingClass<[ XOR32rr ], ZeroIdiomPredicate>,
  447. // SSE Zero-idioms.
  448. DepBreakingClass<[
  449. // fp variants.
  450. XORPSrr, XORPDrr,
  451. // int variants.
  452. PXORrr,
  453. ], ZeroIdiomPredicate>,
  454. ]>;
  455. } // SchedModel