X86ScheduleSLM.td 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  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. // FIXME: These are probably wrong. They are copy pasted from WriteStore/Load.
  81. def : WriteRes<WriteSTMXCSR, [SLM_IEC_RSV01, SLM_MEC_RSV]>;
  82. def : WriteRes<WriteLDMXCSR, [SLM_MEC_RSV]> { let Latency = 3; }
  83. // Treat misc copies as a move.
  84. def : InstRW<[WriteMove], (instrs COPY)>;
  85. defm : SLMWriteResPair<WriteALU, [SLM_IEC_RSV01], 1>;
  86. defm : SLMWriteResPair<WriteADC, [SLM_IEC_RSV01], 1>;
  87. defm : SLMWriteResPair<WriteIMul8, [SLM_IEC_RSV1], 5, [5], 3>;
  88. defm : SLMWriteResPair<WriteIMul16, [SLM_IEC_RSV1], 5, [5], 4, 1>;
  89. defm : SLMWriteResPair<WriteIMul16Imm, [SLM_IEC_RSV1], 4, [4], 2, 1>;
  90. defm : SLMWriteResPair<WriteIMul16Reg, [SLM_IEC_RSV1], 4, [4], 2, 1>;
  91. defm : SLMWriteResPair<WriteIMul32, [SLM_IEC_RSV1], 5, [5], 3, 1>;
  92. defm : SLMWriteResPair<WriteIMul32Imm, [SLM_IEC_RSV1], 3>;
  93. defm : SLMWriteResPair<WriteIMul32Reg, [SLM_IEC_RSV1], 3>;
  94. defm : SLMWriteResPair<WriteIMul64, [SLM_IEC_RSV1], 7, [7], 3>;
  95. defm : SLMWriteResPair<WriteIMul64Imm, [SLM_IEC_RSV1], 5, [2]>;
  96. defm : SLMWriteResPair<WriteIMul64Reg, [SLM_IEC_RSV1], 5, [2]>;
  97. defm : X86WriteResUnsupported<WriteIMulH>;
  98. defm : X86WriteResUnsupported<WriteIMulHLd>;
  99. defm : X86WriteResPairUnsupported<WriteMULX32>;
  100. defm : X86WriteResPairUnsupported<WriteMULX64>;
  101. defm : X86WriteRes<WriteBSWAP32, [SLM_IEC_RSV01], 1, [1], 1>;
  102. defm : X86WriteRes<WriteBSWAP64, [SLM_IEC_RSV01], 1, [1], 1>;
  103. defm : X86WriteRes<WriteCMPXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
  104. defm : X86WriteRes<WriteCMPXCHGRMW, [SLM_IEC_RSV01, SLM_MEC_RSV], 4, [1, 2], 2>;
  105. defm : X86WriteRes<WriteXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
  106. defm : SLMWriteResPair<WriteShift, [SLM_IEC_RSV0], 1>;
  107. defm : SLMWriteResPair<WriteShiftCL, [SLM_IEC_RSV0], 1>;
  108. defm : SLMWriteResPair<WriteRotate, [SLM_IEC_RSV0], 1>;
  109. defm : SLMWriteResPair<WriteRotateCL, [SLM_IEC_RSV0], 1>;
  110. defm : X86WriteRes<WriteSHDrri, [SLM_IEC_RSV0], 1, [1], 1>;
  111. defm : X86WriteRes<WriteSHDrrcl,[SLM_IEC_RSV0], 1, [1], 1>;
  112. defm : X86WriteRes<WriteSHDmri, [SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
  113. defm : X86WriteRes<WriteSHDmrcl,[SLM_MEC_RSV, SLM_IEC_RSV0], 4, [2, 1], 2>;
  114. defm : SLMWriteResPair<WriteJump, [SLM_IEC_RSV1], 1>;
  115. defm : SLMWriteResPair<WriteCRC32, [SLM_IEC_RSV1], 3>;
  116. defm : SLMWriteResPair<WriteCMOV, [SLM_IEC_RSV01], 2, [2]>;
  117. defm : X86WriteRes<WriteFCMOV, [SLM_FPC_RSV1], 3, [1], 1>; // x87 conditional move.
  118. def : WriteRes<WriteSETCC, [SLM_IEC_RSV01]>;
  119. def : WriteRes<WriteSETCCStore, [SLM_IEC_RSV01, SLM_MEC_RSV]> {
  120. // FIXME Latency and NumMicrOps?
  121. let ResourceCycles = [2,1];
  122. }
  123. defm : X86WriteRes<WriteLAHFSAHF, [SLM_IEC_RSV01], 1, [1], 1>;
  124. defm : X86WriteRes<WriteBitTest, [SLM_IEC_RSV0, SLM_IEC_RSV1], 1, [1,1], 1>;
  125. defm : X86WriteRes<WriteBitTestImmLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 4, [1,1,1], 1>;
  126. defm : X86WriteRes<WriteBitTestRegLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 4, [1,1,1], 7>;
  127. defm : X86WriteRes<WriteBitTestSet, [SLM_IEC_RSV0, SLM_IEC_RSV1], 1, [1,1], 1>;
  128. defm : X86WriteRes<WriteBitTestSetImmLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 3, [1,1,1], 1>;
  129. defm : X86WriteRes<WriteBitTestSetRegLd, [SLM_IEC_RSV0, SLM_IEC_RSV1, SLM_MEC_RSV], 3, [1,1,1], 7>;
  130. // This is for simple LEAs with one or two input operands.
  131. // The complex ones can only execute on port 1, and they require two cycles on
  132. // the port to read all inputs. We don't model that.
  133. def : WriteRes<WriteLEA, [SLM_IEC_RSV1]>;
  134. // Bit counts.
  135. defm : SLMWriteResPair<WriteBSF, [SLM_IEC_RSV0, SLM_IEC_RSV1], 10, [10,10], 10>;
  136. defm : SLMWriteResPair<WriteBSR, [SLM_IEC_RSV0, SLM_IEC_RSV1], 10, [10,10], 10>;
  137. defm : SLMWriteResPair<WriteLZCNT, [SLM_IEC_RSV0], 3>;
  138. defm : SLMWriteResPair<WriteTZCNT, [SLM_IEC_RSV0], 3>;
  139. defm : SLMWriteResPair<WritePOPCNT, [SLM_IEC_RSV0], 3>;
  140. // BMI1 BEXTR/BLS, BMI2 BZHI
  141. defm : X86WriteResPairUnsupported<WriteBEXTR>;
  142. defm : X86WriteResPairUnsupported<WriteBLS>;
  143. defm : X86WriteResPairUnsupported<WriteBZHI>;
  144. defm : SLMWriteResPair<WriteDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  145. defm : SLMWriteResPair<WriteDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  146. defm : SLMWriteResPair<WriteDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  147. defm : SLMWriteResPair<WriteDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  148. defm : SLMWriteResPair<WriteIDiv8, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  149. defm : SLMWriteResPair<WriteIDiv16, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  150. defm : SLMWriteResPair<WriteIDiv32, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  151. defm : SLMWriteResPair<WriteIDiv64, [SLM_IEC_RSV01, SLMDivider], 25, [1,25], 1, 0, 4>;
  152. // Scalar and vector floating point.
  153. defm : X86WriteRes<WriteFLD0, [SLM_FPC_RSV01], 1, [1], 1>;
  154. defm : X86WriteRes<WriteFLD1, [SLM_FPC_RSV01], 1, [1], 1>;
  155. defm : X86WriteRes<WriteFLDC, [SLM_FPC_RSV01], 1, [2], 2>;
  156. def : WriteRes<WriteFLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  157. def : WriteRes<WriteFLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
  158. def : WriteRes<WriteFLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
  159. def : WriteRes<WriteFMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  160. def : WriteRes<WriteFMaskedLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
  161. def : WriteRes<WriteFStore, [SLM_MEC_RSV]>;
  162. def : WriteRes<WriteFStoreX, [SLM_MEC_RSV]>;
  163. def : WriteRes<WriteFStoreY, [SLM_MEC_RSV]>;
  164. def : WriteRes<WriteFStoreNT, [SLM_MEC_RSV]>;
  165. def : WriteRes<WriteFStoreNTX, [SLM_MEC_RSV]>;
  166. def : WriteRes<WriteFStoreNTY, [SLM_MEC_RSV]>;
  167. def : WriteRes<WriteFMaskedStore32, [SLM_MEC_RSV]>;
  168. def : WriteRes<WriteFMaskedStore32Y, [SLM_MEC_RSV]>;
  169. def : WriteRes<WriteFMaskedStore64, [SLM_MEC_RSV]>;
  170. def : WriteRes<WriteFMaskedStore64Y, [SLM_MEC_RSV]>;
  171. def : WriteRes<WriteFMove, [SLM_FPC_RSV01]>;
  172. def : WriteRes<WriteFMoveX, [SLM_FPC_RSV01]>;
  173. def : WriteRes<WriteFMoveY, [SLM_FPC_RSV01]>;
  174. defm : X86WriteResUnsupported<WriteFMoveZ>;
  175. defm : X86WriteRes<WriteEMMS, [SLM_FPC_RSV01], 10, [10], 9>;
  176. defm : SLMWriteResPair<WriteFAdd, [SLM_FPC_RSV1], 3>;
  177. defm : SLMWriteResPair<WriteFAddX, [SLM_FPC_RSV1], 3>;
  178. defm : SLMWriteResPair<WriteFAddY, [SLM_FPC_RSV1], 3>;
  179. defm : X86WriteResPairUnsupported<WriteFAddZ>;
  180. defm : SLMWriteResPair<WriteFAdd64, [SLM_FPC_RSV1], 3>;
  181. defm : SLMWriteResPair<WriteFAdd64X, [SLM_FPC_RSV1], 4, [2]>;
  182. defm : SLMWriteResPair<WriteFAdd64Y, [SLM_FPC_RSV1], 4, [2]>;
  183. defm : X86WriteResPairUnsupported<WriteFAdd64Z>;
  184. defm : SLMWriteResPair<WriteFCmp, [SLM_FPC_RSV1], 3>;
  185. defm : SLMWriteResPair<WriteFCmpX, [SLM_FPC_RSV1], 3>;
  186. defm : SLMWriteResPair<WriteFCmpY, [SLM_FPC_RSV1], 3>;
  187. defm : X86WriteResPairUnsupported<WriteFCmpZ>;
  188. defm : SLMWriteResPair<WriteFCmp64, [SLM_FPC_RSV1], 3>;
  189. defm : SLMWriteResPair<WriteFCmp64X, [SLM_FPC_RSV1], 3>;
  190. defm : SLMWriteResPair<WriteFCmp64Y, [SLM_FPC_RSV1], 3>;
  191. defm : X86WriteResPairUnsupported<WriteFCmp64Z>;
  192. defm : SLMWriteResPair<WriteFCom, [SLM_FPC_RSV1], 3>;
  193. defm : SLMWriteResPair<WriteFComX, [SLM_FPC_RSV1], 3>;
  194. defm : SLMWriteResPair<WriteFMul, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  195. defm : SLMWriteResPair<WriteFMulX, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  196. defm : SLMWriteResPair<WriteFMulY, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  197. defm : X86WriteResPairUnsupported<WriteFMulZ>;
  198. defm : SLMWriteResPair<WriteFMul64, [SLM_FPC_RSV0, SLMFPMultiplier], 5, [1,2]>;
  199. defm : SLMWriteResPair<WriteFMul64X, [SLM_FPC_RSV0, SLMFPMultiplier], 7, [1,4]>;
  200. defm : SLMWriteResPair<WriteFMul64Y, [SLM_FPC_RSV0, SLMFPMultiplier], 7, [1,4]>;
  201. defm : X86WriteResPairUnsupported<WriteFMul64Z>;
  202. defm : X86WriteResPairUnsupported<WriteFMA>;
  203. defm : X86WriteResPairUnsupported<WriteFMAX>;
  204. defm : X86WriteResPairUnsupported<WriteFMAY>;
  205. defm : X86WriteResPairUnsupported<WriteFMAZ>;
  206. defm : SLMWriteResPair<WriteFDiv, [SLM_FPC_RSV0, SLMFPDivider], 19, [1,17]>;
  207. defm : SLMWriteResPair<WriteFDivX, [SLM_FPC_RSV0, SLMFPDivider], 39, [1,39], 6, 1>;
  208. defm : X86WriteResPairUnsupported<WriteFDivY>;
  209. defm : X86WriteResPairUnsupported<WriteFDivZ>;
  210. defm : SLMWriteResPair<WriteFDiv64, [SLM_FPC_RSV0, SLMFPDivider], 34, [1,32]>;
  211. defm : SLMWriteResPair<WriteFDiv64X, [SLM_FPC_RSV0, SLMFPDivider], 69, [1,69], 6, 1>;
  212. defm : X86WriteResPairUnsupported<WriteFDiv64Y>;
  213. defm : X86WriteResPairUnsupported<WriteFDiv64Z>;
  214. defm : SLMWriteResPair<WriteFRcp, [SLM_FPC_RSV0], 4>;
  215. defm : SLMWriteResPair<WriteFRcpX, [SLM_FPC_RSV0], 9, [8], 5, 1>;
  216. defm : X86WriteResPairUnsupported<WriteFRcpY>;
  217. defm : X86WriteResPairUnsupported<WriteFRcpZ>;
  218. defm : SLMWriteResPair<WriteFRsqrt, [SLM_FPC_RSV0], 4>;
  219. defm : SLMWriteResPair<WriteFRsqrtX, [SLM_FPC_RSV0], 9, [8], 5, 1>;
  220. defm : X86WriteResPairUnsupported<WriteFRsqrtY>;
  221. defm : X86WriteResPairUnsupported<WriteFRsqrtZ>;
  222. defm : SLMWriteResPair<WriteFSqrt, [SLM_FPC_RSV0, SLMFPDivider], 20, [1,20]>;
  223. defm : SLMWriteResPair<WriteFSqrtX, [SLM_FPC_RSV0, SLMFPDivider], 41, [1,40], 5, 1>;
  224. defm : X86WriteResPairUnsupported<WriteFSqrtY>;
  225. defm : X86WriteResPairUnsupported<WriteFSqrtZ>;
  226. defm : SLMWriteResPair<WriteFSqrt64, [SLM_FPC_RSV0, SLMFPDivider], 35, [1,35]>;
  227. defm : SLMWriteResPair<WriteFSqrt64X, [SLM_FPC_RSV0, SLMFPDivider], 71, [1,70], 5, 1>;
  228. defm : X86WriteResPairUnsupported<WriteFSqrt64Y>;
  229. defm : X86WriteResPairUnsupported<WriteFSqrt64Z>;
  230. defm : SLMWriteResPair<WriteFSqrt80, [SLM_FPC_RSV0,SLMFPDivider], 40, [1,40]>;
  231. defm : SLMWriteResPair<WriteDPPD, [SLM_FPC_RSV1], 12, [8], 5, 1>;
  232. defm : SLMWriteResPair<WriteDPPS, [SLM_FPC_RSV1], 15, [12], 9, 1>;
  233. defm : X86WriteResPairUnsupported<WriteDPPSY>;
  234. defm : X86WriteResPairUnsupported<WriteDPPSZ>;
  235. defm : SLMWriteResPair<WriteFSign, [SLM_FPC_RSV01], 1>;
  236. defm : SLMWriteResPair<WriteFRnd, [SLM_FPC_RSV1], 3>;
  237. defm : SLMWriteResPair<WriteFRndY, [SLM_FPC_RSV1], 3>;
  238. defm : X86WriteResPairUnsupported<WriteFRndZ>;
  239. defm : SLMWriteResPair<WriteFLogic, [SLM_FPC_RSV01], 1>;
  240. defm : SLMWriteResPair<WriteFLogicY, [SLM_FPC_RSV01], 1>;
  241. defm : X86WriteResPairUnsupported<WriteFLogicZ>;
  242. defm : SLMWriteResPair<WriteFTest, [SLM_FPC_RSV01], 1>;
  243. defm : SLMWriteResPair<WriteFTestY, [SLM_FPC_RSV01], 1>;
  244. defm : X86WriteResPairUnsupported<WriteFTestZ>;
  245. defm : SLMWriteResPair<WriteFShuffle, [SLM_FPC_RSV0], 1>;
  246. defm : SLMWriteResPair<WriteFShuffleY, [SLM_FPC_RSV0], 1>;
  247. defm : X86WriteResPairUnsupported<WriteFShuffleZ>;
  248. defm : SLMWriteResPair<WriteFVarShuffle, [SLM_FPC_RSV0], 1>;
  249. defm : SLMWriteResPair<WriteFVarShuffleY,[SLM_FPC_RSV0], 1>;
  250. defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
  251. defm : SLMWriteResPair<WriteFBlend, [SLM_FPC_RSV0], 1>;
  252. defm : X86WriteResPairUnsupported<WriteFBlendY>;
  253. defm : X86WriteResPairUnsupported<WriteFBlendZ>;
  254. defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 1>;
  255. defm : X86WriteResPairUnsupported<WriteFVarBlendY>;
  256. defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
  257. defm : X86WriteResPairUnsupported<WriteFShuffle256>;
  258. defm : X86WriteResPairUnsupported<WriteFVarShuffle256>;
  259. // Conversion between integer and float.
  260. defm : SLMWriteResPair<WriteCvtSS2I, [SLM_FPC_RSV0], 5>;
  261. defm : SLMWriteResPair<WriteCvtPS2I, [SLM_FPC_RSV0], 5, [2]>;
  262. defm : SLMWriteResPair<WriteCvtPS2IY, [SLM_FPC_RSV0], 5, [2]>;
  263. defm : X86WriteResPairUnsupported<WriteCvtPS2IZ>;
  264. defm : SLMWriteResPair<WriteCvtSD2I, [SLM_FPC_RSV0], 5>;
  265. defm : SLMWriteResPair<WriteCvtPD2I, [SLM_FPC_RSV0], 5, [2]>;
  266. defm : SLMWriteResPair<WriteCvtPD2IY, [SLM_FPC_RSV0], 5, [2]>;
  267. defm : X86WriteResPairUnsupported<WriteCvtPD2IZ>;
  268. defm : SLMWriteResPair<WriteCvtI2SS, [SLM_FPC_RSV0], 5, [2]>;
  269. defm : SLMWriteResPair<WriteCvtI2PS, [SLM_FPC_RSV0], 5, [2]>;
  270. defm : SLMWriteResPair<WriteCvtI2PSY, [SLM_FPC_RSV0], 5, [2]>;
  271. defm : X86WriteResPairUnsupported<WriteCvtI2PSZ>;
  272. defm : SLMWriteResPair<WriteCvtI2SD, [SLM_FPC_RSV0], 5, [2]>;
  273. defm : SLMWriteResPair<WriteCvtI2PD, [SLM_FPC_RSV0], 5, [2]>;
  274. defm : SLMWriteResPair<WriteCvtI2PDY, [SLM_FPC_RSV0], 5, [2]>;
  275. defm : X86WriteResPairUnsupported<WriteCvtI2PDZ>;
  276. defm : SLMWriteResPair<WriteCvtSS2SD, [SLM_FPC_RSV0], 4, [2]>;
  277. defm : SLMWriteResPair<WriteCvtPS2PD, [SLM_FPC_RSV0], 5, [2]>;
  278. defm : SLMWriteResPair<WriteCvtPS2PDY, [SLM_FPC_RSV0], 5, [2]>;
  279. defm : X86WriteResPairUnsupported<WriteCvtPS2PDZ>;
  280. defm : SLMWriteResPair<WriteCvtSD2SS, [SLM_FPC_RSV0], 4, [2]>;
  281. defm : SLMWriteResPair<WriteCvtPD2PS, [SLM_FPC_RSV0], 5, [2]>;
  282. defm : SLMWriteResPair<WriteCvtPD2PSY, [SLM_FPC_RSV0], 5, [2]>;
  283. defm : X86WriteResPairUnsupported<WriteCvtPD2PSZ>;
  284. defm : X86WriteResPairUnsupported<WriteCvtPH2PS>;
  285. defm : X86WriteResPairUnsupported<WriteCvtPH2PSY>;
  286. defm : X86WriteResPairUnsupported<WriteCvtPH2PSZ>;
  287. defm : X86WriteResUnsupported<WriteCvtPS2PH>;
  288. defm : X86WriteResUnsupported<WriteCvtPS2PHY>;
  289. defm : X86WriteResUnsupported<WriteCvtPS2PHZ>;
  290. defm : X86WriteResUnsupported<WriteCvtPS2PHSt>;
  291. defm : X86WriteResUnsupported<WriteCvtPS2PHYSt>;
  292. defm : X86WriteResUnsupported<WriteCvtPS2PHZSt>;
  293. // Vector integer operations.
  294. def : WriteRes<WriteVecLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  295. def : WriteRes<WriteVecLoadX, [SLM_MEC_RSV]> { let Latency = 3; }
  296. def : WriteRes<WriteVecLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
  297. def : WriteRes<WriteVecLoadNT, [SLM_MEC_RSV]> { let Latency = 3; }
  298. def : WriteRes<WriteVecLoadNTY, [SLM_MEC_RSV]> { let Latency = 3; }
  299. def : WriteRes<WriteVecMaskedLoad, [SLM_MEC_RSV]> { let Latency = 3; }
  300. def : WriteRes<WriteVecMaskedLoadY, [SLM_MEC_RSV]> { let Latency = 3; }
  301. def : WriteRes<WriteVecStore, [SLM_MEC_RSV]>;
  302. def : WriteRes<WriteVecStoreX, [SLM_MEC_RSV]>;
  303. def : WriteRes<WriteVecStoreY, [SLM_MEC_RSV]>;
  304. def : WriteRes<WriteVecStoreNT, [SLM_MEC_RSV]>;
  305. def : WriteRes<WriteVecStoreNTY, [SLM_MEC_RSV]>;
  306. def : WriteRes<WriteVecMaskedStore32, [SLM_MEC_RSV]>;
  307. def : WriteRes<WriteVecMaskedStore32Y, [SLM_MEC_RSV]>;
  308. def : WriteRes<WriteVecMaskedStore64, [SLM_MEC_RSV]>;
  309. def : WriteRes<WriteVecMaskedStore64Y, [SLM_MEC_RSV]>;
  310. def : WriteRes<WriteVecMove, [SLM_FPC_RSV01]>;
  311. def : WriteRes<WriteVecMoveX, [SLM_FPC_RSV01]>;
  312. def : WriteRes<WriteVecMoveY, [SLM_FPC_RSV01]>;
  313. defm : X86WriteResUnsupported<WriteVecMoveZ>;
  314. def : WriteRes<WriteVecMoveToGpr, [SLM_IEC_RSV01]>;
  315. def : WriteRes<WriteVecMoveFromGpr, [SLM_IEC_RSV01]>;
  316. defm : SLMWriteResPair<WriteVecShift, [SLM_FPC_RSV0], 2, [2], 2>;
  317. defm : SLMWriteResPair<WriteVecShiftX, [SLM_FPC_RSV0], 2, [2], 2>;
  318. defm : SLMWriteResPair<WriteVecShiftY, [SLM_FPC_RSV0], 2, [2], 2>;
  319. defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
  320. defm : SLMWriteResPair<WriteVecShiftImm, [SLM_FPC_RSV0], 1>;
  321. defm : SLMWriteResPair<WriteVecShiftImmX,[SLM_FPC_RSV0], 1>;
  322. defm : SLMWriteResPair<WriteVecShiftImmY,[SLM_FPC_RSV0], 1>;
  323. defm : X86WriteResPairUnsupported<WriteVecShiftImmZ>;
  324. defm : SLMWriteResPair<WriteVarVecShift, [SLM_FPC_RSV0], 1>;
  325. defm : X86WriteResPairUnsupported<WriteVarVecShiftY>;
  326. defm : X86WriteResPairUnsupported<WriteVarVecShiftZ>;
  327. defm : SLMWriteResPair<WriteVecLogic, [SLM_FPC_RSV01], 1>;
  328. defm : SLMWriteResPair<WriteVecLogicX,[SLM_FPC_RSV01], 1>;
  329. defm : SLMWriteResPair<WriteVecLogicY,[SLM_FPC_RSV01], 1>;
  330. defm : X86WriteResPairUnsupported<WriteVecLogicZ>;
  331. defm : SLMWriteResPair<WriteVecTest, [SLM_FPC_RSV01], 1>;
  332. defm : SLMWriteResPair<WriteVecTestY, [SLM_FPC_RSV01], 1>;
  333. defm : X86WriteResPairUnsupported<WriteVecTestZ>;
  334. defm : SLMWriteResPair<WriteVecALU, [SLM_FPC_RSV01], 1>;
  335. defm : SLMWriteResPair<WriteVecALUX, [SLM_FPC_RSV01], 1>;
  336. defm : SLMWriteResPair<WriteVecALUY, [SLM_FPC_RSV01], 1>;
  337. defm : X86WriteResPairUnsupported<WriteVecALUZ>;
  338. defm : SLMWriteResPair<WriteVecIMul, [SLM_FPC_RSV0], 4>;
  339. defm : SLMWriteResPair<WriteVecIMulX, [SLM_FPC_RSV0], 5, [2]>;
  340. defm : SLMWriteResPair<WriteVecIMulY, [SLM_FPC_RSV0], 5, [2]>;
  341. defm : X86WriteResPairUnsupported<WriteVecIMulZ>;
  342. // FIXME: The below is closer to correct, but caused some perf regressions.
  343. //defm : SLMWriteResPair<WritePMULLD, [SLM_FPC_RSV0], 11, [11], 7>;
  344. defm : SLMWriteResPair<WritePMULLD, [SLM_FPC_RSV0], 4>;
  345. defm : SLMWriteResPair<WritePMULLDY, [SLM_FPC_RSV0], 4>;
  346. defm : X86WriteResPairUnsupported<WritePMULLDZ>;
  347. defm : SLMWriteResPair<WriteShuffle, [SLM_FPC_RSV0], 1>;
  348. defm : SLMWriteResPair<WriteShuffleY, [SLM_FPC_RSV0], 1>;
  349. defm : X86WriteResPairUnsupported<WriteShuffleZ>;
  350. defm : SLMWriteResPair<WriteShuffleX, [SLM_FPC_RSV0], 1>;
  351. defm : SLMWriteResPair<WriteVarShuffle, [SLM_FPC_RSV0], 1>;
  352. defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0], 5, [5], 4, 1>;
  353. defm : X86WriteResPairUnsupported<WriteVarShuffleY>;
  354. defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
  355. defm : SLMWriteResPair<WriteBlend, [SLM_FPC_RSV0], 1>;
  356. defm : SLMWriteResPair<WriteBlendY, [SLM_FPC_RSV0], 1>;
  357. defm : X86WriteResPairUnsupported<WriteBlendZ>;
  358. defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 1>;
  359. defm : X86WriteResPairUnsupported<WriteVarBlendY>;
  360. defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
  361. defm : SLMWriteResPair<WriteMPSAD, [SLM_FPC_RSV0], 7, [5], 3, 1>;
  362. defm : X86WriteResPairUnsupported<WriteMPSADY>;
  363. defm : X86WriteResPairUnsupported<WriteMPSADZ>;
  364. defm : SLMWriteResPair<WritePSADBW, [SLM_FPC_RSV0], 4>;
  365. defm : SLMWriteResPair<WritePSADBWX, [SLM_FPC_RSV0], 5, [2]>;
  366. defm : X86WriteResPairUnsupported<WritePSADBWY>;
  367. defm : X86WriteResPairUnsupported<WritePSADBWZ>;
  368. defm : SLMWriteResPair<WritePHMINPOS, [SLM_FPC_RSV0], 4>;
  369. defm : X86WriteResPairUnsupported<WriteShuffle256>;
  370. defm : X86WriteResPairUnsupported<WriteVarShuffle256>;
  371. defm : X86WriteResPairUnsupported<WriteVPMOV256>;
  372. // Vector insert/extract operations.
  373. defm : SLMWriteResPair<WriteVecInsert, [SLM_FPC_RSV0], 1>;
  374. def : WriteRes<WriteVecExtract, [SLM_FPC_RSV0]>;
  375. def : WriteRes<WriteVecExtractSt, [SLM_FPC_RSV0, SLM_MEC_RSV]> {
  376. let Latency = 4;
  377. let NumMicroOps = 2;
  378. let ResourceCycles = [1, 2];
  379. }
  380. ////////////////////////////////////////////////////////////////////////////////
  381. // Horizontal add/sub instructions.
  382. ////////////////////////////////////////////////////////////////////////////////
  383. defm : SLMWriteResPair<WriteFHAdd, [SLM_FPC_RSV1], 6, [6], 4, 1>;
  384. defm : X86WriteResPairUnsupported<WriteFHAddY>;
  385. defm : X86WriteResPairUnsupported<WriteFHAddZ>;
  386. defm : SLMWriteResPair<WritePHAdd, [SLM_FPC_RSV01], 6, [6], 3, 1>;
  387. defm : SLMWriteResPair<WritePHAddX, [SLM_FPC_RSV01], 6, [6], 3, 1>;
  388. defm : X86WriteResPairUnsupported<WritePHAddY>;
  389. defm : X86WriteResPairUnsupported<WritePHAddZ>;
  390. // String instructions.
  391. // Packed Compare Implicit Length Strings, Return Mask
  392. defm : SLMWriteResPair<WritePCmpIStrM, [SLM_FPC_RSV0], 13, [13], 5, 1>;
  393. // Packed Compare Explicit Length Strings, Return Mask
  394. defm : SLMWriteResPair<WritePCmpEStrM, [SLM_FPC_RSV0], 17, [17], 8, 1>;
  395. // Packed Compare Implicit Length Strings, Return Index
  396. defm : SLMWriteResPair<WritePCmpIStrI, [SLM_FPC_RSV0], 17, [17], 6, 1>;
  397. // Packed Compare Explicit Length Strings, Return Index
  398. defm : SLMWriteResPair<WritePCmpEStrI, [SLM_FPC_RSV0], 21, [21], 9, 1>;
  399. // MOVMSK Instructions.
  400. def : WriteRes<WriteFMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  401. def : WriteRes<WriteVecMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  402. def : WriteRes<WriteVecMOVMSKY, [SLM_FPC_RSV1]> { let Latency = 4; }
  403. def : WriteRes<WriteMMXMOVMSK, [SLM_FPC_RSV1]> { let Latency = 4; }
  404. // AES Instructions.
  405. defm : SLMWriteResPair<WriteAESDecEnc, [SLM_FPC_RSV0], 8, [5]>;
  406. defm : SLMWriteResPair<WriteAESIMC, [SLM_FPC_RSV0], 8, [5]>;
  407. defm : SLMWriteResPair<WriteAESKeyGen, [SLM_FPC_RSV0], 8, [5]>;
  408. // Carry-less multiplication instructions.
  409. defm : SLMWriteResPair<WriteCLMul, [SLM_FPC_RSV0], 10, [10], 8, 1>;
  410. def : WriteRes<WriteSystem, [SLM_FPC_RSV0]> { let Latency = 100; }
  411. def : WriteRes<WriteMicrocoded, [SLM_FPC_RSV0]> { let Latency = 100; }
  412. def : WriteRes<WriteFence, [SLM_MEC_RSV]>;
  413. def : WriteRes<WriteNop, []>;
  414. // Remaining SLM instrs.
  415. def SLMWriteResGroup1rr : SchedWriteRes<[SLM_FPC_RSV01]> {
  416. let Latency = 4;
  417. let NumMicroOps = 2;
  418. let ResourceCycles = [8];
  419. }
  420. def: InstRW<[SLMWriteResGroup1rr], (instrs MMX_PADDQrr, PADDQrr,
  421. MMX_PSUBQrr, PSUBQrr,
  422. PCMPEQQrr)>;
  423. def SLMWriteResGroup1rm : SchedWriteRes<[SLM_MEC_RSV,SLM_FPC_RSV01]> {
  424. let Latency = 7;
  425. let NumMicroOps = 3;
  426. let ResourceCycles = [1,8];
  427. }
  428. def: InstRW<[SLMWriteResGroup1rm], (instrs MMX_PADDQrm, PADDQrm,
  429. MMX_PSUBQrm, PSUBQrm,
  430. PCMPEQQrm)>;
  431. ///////////////////////////////////////////////////////////////////////////////
  432. // Dependency breaking instructions.
  433. ///////////////////////////////////////////////////////////////////////////////
  434. def : IsZeroIdiomFunction<[
  435. // GPR Zero-idioms.
  436. DepBreakingClass<[ XOR32rr ], ZeroIdiomPredicate>,
  437. // SSE Zero-idioms.
  438. DepBreakingClass<[
  439. // fp variants.
  440. XORPSrr, XORPDrr,
  441. // int variants.
  442. PXORrr,
  443. ], ZeroIdiomPredicate>,
  444. ]>;
  445. } // SchedModel