ARMScheduleSwift.td 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. //=- ARMScheduleSwift.td - Swift Scheduling Definitions -*- 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 itinerary class data for the Swift processor..
  10. //
  11. //===----------------------------------------------------------------------===//
  12. // ===---------------------------------------------------------------------===//
  13. // This section contains legacy support for itineraries. This is
  14. // required until SD and PostRA schedulers are replaced by MachineScheduler.
  15. def SW_DIS0 : FuncUnit;
  16. def SW_DIS1 : FuncUnit;
  17. def SW_DIS2 : FuncUnit;
  18. def SW_ALU0 : FuncUnit;
  19. def SW_ALU1 : FuncUnit;
  20. def SW_LS : FuncUnit;
  21. def SW_IDIV : FuncUnit;
  22. def SW_FDIV : FuncUnit;
  23. // FIXME: Need bypasses.
  24. // FIXME: Model the multiple stages of IIC_iMOVix2, IIC_iMOVix2addpc, and
  25. // IIC_iMOVix2ld better.
  26. // FIXME: Model the special immediate shifts that are not microcoded.
  27. // FIXME: Do we need to model the fact that uses of r15 in a micro-op force it
  28. // to issue on pipe 1?
  29. // FIXME: Model the pipelined behavior of CMP / TST instructions.
  30. // FIXME: Better model the microcode stages of multiply instructions, especially
  31. // conditional variants.
  32. // FIXME: Add preload instruction when it is documented.
  33. // FIXME: Model non-pipelined nature of FP div / sqrt unit.
  34. // Swift machine model for scheduling and other instruction cost heuristics.
  35. def SwiftModel : SchedMachineModel {
  36. let IssueWidth = 3; // 3 micro-ops are dispatched per cycle.
  37. let MicroOpBufferSize = 45; // Based on NEON renamed registers.
  38. let LoadLatency = 3;
  39. let MispredictPenalty = 14; // A branch direction mispredict.
  40. let CompleteModel = 0; // FIXME: Remove if all instructions are covered.
  41. // FIXME: Remove when all errors have been fixed.
  42. let FullInstRWOverlapCheck = 0;
  43. }
  44. // Swift predicates.
  45. def IsFastImmShiftSwiftPred : SchedPredicate<[{TII->isSwiftFastImmShift(MI)}]>;
  46. // Swift resource mapping.
  47. let SchedModel = SwiftModel in {
  48. // Processor resources.
  49. def SwiftUnitP01 : ProcResource<2>; // ALU unit.
  50. def SwiftUnitP0 : ProcResource<1> { let Super = SwiftUnitP01; } // Mul unit.
  51. def SwiftUnitP1 : ProcResource<1> { let Super = SwiftUnitP01; } // Br unit.
  52. def SwiftUnitP2 : ProcResource<1>; // LS unit.
  53. def SwiftUnitDiv : ProcResource<1>;
  54. // Generic resource requirements.
  55. def SwiftWriteP0OneCycle : SchedWriteRes<[SwiftUnitP0]>;
  56. def SwiftWriteP0TwoCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 2; }
  57. def SwiftWriteP0FourCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 4; }
  58. def SwiftWriteP0SixCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 6; }
  59. def SwiftWriteP0P1FourCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP1]> {
  60. let Latency = 4;
  61. }
  62. def SwiftWriteP0P1SixCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP1]> {
  63. let Latency = 6;
  64. }
  65. def SwiftWriteP01OneCycle : SchedWriteRes<[SwiftUnitP01]>;
  66. def SwiftWriteP1TwoCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 2; }
  67. def SwiftWriteP1FourCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 4; }
  68. def SwiftWriteP1SixCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 6; }
  69. def SwiftWriteP1EightCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 8; }
  70. def SwiftWriteP1TwelveCyc : SchedWriteRes<[SwiftUnitP1]> { let Latency = 12; }
  71. def SwiftWriteP01OneCycle2x : WriteSequence<[SwiftWriteP01OneCycle], 2>;
  72. def SwiftWriteP01OneCycle3x : WriteSequence<[SwiftWriteP01OneCycle], 3>;
  73. def SwiftWriteP01TwoCycle : SchedWriteRes<[SwiftUnitP01]> { let Latency = 2; }
  74. def SwiftWriteP01ThreeCycleTwoUops : SchedWriteRes<[SwiftUnitP01,
  75. SwiftUnitP01]> {
  76. let Latency = 3;
  77. let NumMicroOps = 2;
  78. }
  79. def SwiftWriteP0ThreeCycleThreeUops : SchedWriteRes<[SwiftUnitP0]> {
  80. let Latency = 3;
  81. let NumMicroOps = 3;
  82. let ResourceCycles = [3];
  83. }
  84. // Plain load without writeback.
  85. def SwiftWriteP2ThreeCycle : SchedWriteRes<[SwiftUnitP2]> {
  86. let Latency = 3;
  87. }
  88. def SwiftWriteP2FourCycle : SchedWriteRes<[SwiftUnitP2]> {
  89. let Latency = 4;
  90. }
  91. // A store does not write to a register.
  92. def SwiftWriteP2 : SchedWriteRes<[SwiftUnitP2]> {
  93. let Latency = 0;
  94. }
  95. foreach Num = 1-4 in {
  96. def SwiftWrite#Num#xP2 : WriteSequence<[SwiftWriteP2], Num>;
  97. }
  98. def SwiftWriteP01OneCycle2x_load : WriteSequence<[SwiftWriteP01OneCycle,
  99. SwiftWriteP01OneCycle,
  100. SwiftWriteP2ThreeCycle]>;
  101. // 4.2.4 Arithmetic and Logical.
  102. // ALU operation register shifted by immediate variant.
  103. def SwiftWriteALUsi : SchedWriteVariant<[
  104. // lsl #2, lsl #1, or lsr #1.
  105. SchedVar<IsFastImmShiftSwiftPred, [SwiftWriteP01TwoCycle]>,
  106. SchedVar<NoSchedPred, [WriteALU]>
  107. ]>;
  108. def SwiftWriteALUsr : SchedWriteVariant<[
  109. SchedVar<IsPredicatedPred, [SwiftWriteP01ThreeCycleTwoUops]>,
  110. SchedVar<NoSchedPred, [SwiftWriteP01TwoCycle]>
  111. ]>;
  112. def SwiftWriteALUSsr : SchedWriteVariant<[
  113. SchedVar<IsPredicatedPred, [SwiftWriteP0ThreeCycleThreeUops]>,
  114. SchedVar<NoSchedPred, [SwiftWriteP01TwoCycle]>
  115. ]>;
  116. def SwiftReadAdvanceALUsr : SchedReadVariant<[
  117. SchedVar<IsPredicatedPred, [SchedReadAdvance<2>]>,
  118. SchedVar<NoSchedPred, [NoReadAdvance]>
  119. ]>;
  120. // ADC,ADD,NEG,RSB,RSC,SBC,SUB,ADR
  121. // AND,BIC,EOR,ORN,ORR
  122. // CLZ,RBIT,REV,REV16,REVSH,PKH
  123. def : WriteRes<WriteALU, [SwiftUnitP01]>;
  124. def : SchedAlias<WriteALUsi, SwiftWriteALUsi>;
  125. def : SchedAlias<WriteALUsr, SwiftWriteALUsr>;
  126. def : SchedAlias<WriteALUSsr, SwiftWriteALUSsr>;
  127. def : ReadAdvance<ReadALU, 0>;
  128. def : SchedAlias<ReadALUsr, SwiftReadAdvanceALUsr>;
  129. def : SchedAlias<WriteLd, SwiftWriteP2ThreeCycle>;
  130. def : SchedAlias<WriteST, SwiftWriteP2>;
  131. def SwiftChooseShiftKindP01OneOrTwoCycle : SchedWriteVariant<[
  132. SchedVar<IsFastImmShiftSwiftPred, [SwiftWriteP01OneCycle]>,
  133. SchedVar<NoSchedPred, [SwiftWriteP01TwoCycle]>
  134. ]>;
  135. // 4.2.5 Integer comparison
  136. def : WriteRes<WriteCMP, [SwiftUnitP01]>;
  137. def : SchedAlias<WriteCMPsi, SwiftChooseShiftKindP01OneOrTwoCycle>;
  138. def : SchedAlias<WriteCMPsr, SwiftWriteP01TwoCycle>;
  139. // 4.2.6 Shift, Move
  140. // Shift
  141. // ASR,LSL,ROR,RRX
  142. // MOV(register-shiftedregister) MVN(register-shiftedregister)
  143. // Move
  144. // MOV,MVN
  145. // MOVT
  146. // Sign/Zero extension
  147. def : InstRW<[SwiftWriteP01OneCycle],
  148. (instregex "SXTB", "SXTH", "SXTB16", "UXTB", "UXTH", "UXTB16",
  149. "t2SXTB", "t2SXTH", "t2SXTB16", "t2UXTB", "t2UXTH",
  150. "t2UXTB16")>;
  151. // Pseudo instructions.
  152. def : InstRW<[SwiftWriteP01OneCycle2x],
  153. (instregex "MOVCCi32imm", "MOVi32imm", "t2MOVCCi32imm",
  154. "t2MOVi32imm")>;
  155. def : InstRW<[SwiftWriteP01OneCycle3x],
  156. (instregex "MOV_ga_pcrel", "t2MOV_ga_pcrel", "t2MOVi16_ga_pcrel")>;
  157. def : InstRW<[SwiftWriteP01OneCycle2x_load],
  158. (instregex "MOV_ga_pcrel_ldr")>;
  159. def SwiftWriteP0TwoCycleTwoUops : WriteSequence<[SwiftWriteP0OneCycle], 2>;
  160. def SwiftPredP0OneOrTwoCycle : SchedWriteVariant<[
  161. SchedVar<IsPredicatedPred, [ SwiftWriteP0TwoCycleTwoUops ]>,
  162. SchedVar<NoSchedPred, [ SwiftWriteP0OneCycle ]>
  163. ]>;
  164. // 4.2.7 Select
  165. // SEL
  166. def : InstRW<[SwiftPredP0OneOrTwoCycle], (instregex "SEL", "t2SEL")>;
  167. // 4.2.8 Bitfield
  168. // BFI,BFC, SBFX,UBFX
  169. def : InstRW< [SwiftWriteP01TwoCycle],
  170. (instregex "BFC", "BFI", "UBFX", "SBFX", "(t|t2)BFC", "(t|t2)BFI",
  171. "(t|t2)UBFX", "(t|t2)SBFX")>;
  172. // 4.2.9 Saturating arithmetic
  173. def : InstRW< [SwiftWriteP01TwoCycle],
  174. (instregex "QADD", "QSUB", "QDADD", "QDSUB", "SSAT", "SSAT16", "USAT",
  175. "USAT16", "QADD8", "QADD16", "QSUB8", "QSUB16", "QASX", "QSAX",
  176. "UQADD8", "UQADD16","UQSUB8","UQSUB16","UQASX","UQSAX", "t2QADD",
  177. "t2QSUB", "t2QDADD", "t2QDSUB", "t2SSAT", "t2SSAT16", "t2USAT",
  178. "t2QADD8", "t2QADD16", "t2QSUB8", "t2QSUB16", "t2QASX", "t2QSAX",
  179. "t2UQADD8", "t2UQADD16","t2UQSUB8","t2UQSUB16","t2UQASX","t2UQSAX")>;
  180. // 4.2.10 Parallel Arithmetic
  181. // Not flag setting.
  182. def : InstRW< [SwiftWriteALUsr],
  183. (instregex "SADD8", "SADD16", "SSUB8", "SSUB16", "SASX", "SSAX",
  184. "UADD8", "UADD16", "USUB8", "USUB16", "UASX", "USAX", "t2SADD8",
  185. "t2SADD16", "t2SSUB8", "t2SSUB16", "t2SASX", "t2SSAX", "t2UADD8",
  186. "t2UADD16", "t2USUB8", "t2USUB16", "t2UASX", "t2USAX")>;
  187. // Flag setting.
  188. def : InstRW< [SwiftWriteP01TwoCycle],
  189. (instregex "SHADD8", "SHADD16", "SHSUB8", "SHSUB16", "SHASX", "SHSAX",
  190. "SXTAB", "SXTAB16", "SXTAH", "UHADD8", "UHADD16", "UHSUB8", "UHSUB16",
  191. "UHASX", "UHSAX", "UXTAB", "UXTAB16", "UXTAH", "t2SHADD8", "t2SHADD16",
  192. "t2SHSUB8", "t2SHSUB16", "t2SHASX", "t2SHSAX", "t2SXTAB", "t2SXTAB16",
  193. "t2SXTAH", "t2UHADD8", "t2UHADD16", "t2UHSUB8", "t2UHSUB16", "t2UHASX",
  194. "t2UHSAX", "t2UXTAB", "t2UXTAB16", "t2UXTAH")>;
  195. // 4.2.11 Sum of Absolute Difference
  196. def : InstRW< [SwiftWriteP0P1FourCycle], (instregex "USAD8") >;
  197. def : InstRW<[SwiftWriteP0P1FourCycle, ReadALU, ReadALU, SchedReadAdvance<2>],
  198. (instregex "USADA8")>;
  199. // 4.2.12 Integer Multiply (32-bit result)
  200. // Two sources.
  201. def : InstRW< [SwiftWriteP0FourCycle],
  202. (instregex "MUL", "SMMUL", "SMMULR", "SMULBB", "SMULBT",
  203. "SMULTB", "SMULTT", "SMULWB", "SMULWT", "SMUSD", "SMUSDX", "t2MUL",
  204. "t2SMMUL", "t2SMMULR", "t2SMULBB", "t2SMULBT", "t2SMULTB", "t2SMULTT",
  205. "t2SMULWB", "t2SMULWT", "t2SMUSD")>;
  206. def SwiftWriteP0P01FiveCycleTwoUops :
  207. SchedWriteRes<[SwiftUnitP0, SwiftUnitP01]> {
  208. let Latency = 5;
  209. }
  210. def SwiftPredP0P01FourFiveCycle : SchedWriteVariant<[
  211. SchedVar<IsPredicatedPred, [ SwiftWriteP0P01FiveCycleTwoUops ]>,
  212. SchedVar<NoSchedPred, [ SwiftWriteP0FourCycle ]>
  213. ]>;
  214. def SwiftReadAdvanceFourCyclesPred : SchedReadVariant<[
  215. SchedVar<IsPredicatedPred, [SchedReadAdvance<4>]>,
  216. SchedVar<NoSchedPred, [ReadALU]>
  217. ]>;
  218. // Multiply accumulate, three sources
  219. def : InstRW< [SwiftPredP0P01FourFiveCycle, ReadALU, ReadALU,
  220. SwiftReadAdvanceFourCyclesPred],
  221. (instregex "MLA", "MLS", "SMMLA", "SMMLAR", "SMMLS", "SMMLSR",
  222. "t2MLA", "t2MLS", "t2SMMLA", "t2SMMLAR", "t2SMMLS",
  223. "t2SMMLSR")>;
  224. // 4.2.13 Integer Multiply (32-bit result, Q flag)
  225. def : InstRW< [SwiftWriteP0FourCycle],
  226. (instregex "SMUAD", "SMUADX", "t2SMUAD", "t2SMUADX")>;
  227. def : InstRW< [SwiftPredP0P01FourFiveCycle, ReadALU, ReadALU,
  228. SwiftReadAdvanceFourCyclesPred],
  229. (instregex "SMLABB", "SMLABT", "SMLATB", "SMLATT", "SMLSD", "SMLSDX",
  230. "SMLAWB", "SMLAWT", "t2SMLABB", "t2SMLABT", "t2SMLATB", "t2SMLATT",
  231. "t2SMLSD", "t2SMLSDX", "t2SMLAWB", "t2SMLAWT")>;
  232. def : InstRW< [SwiftPredP0P01FourFiveCycle],
  233. (instregex "SMLAD", "SMLADX", "t2SMLAD", "t2SMLADX")>;
  234. def SwiftP0P0P01FiveCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP01]> {
  235. let Latency = 5;
  236. let NumMicroOps = 3;
  237. let ResourceCycles = [2, 1];
  238. }
  239. def SwiftWrite1Cycle : SchedWriteRes<[]> {
  240. let Latency = 1;
  241. let NumMicroOps = 0;
  242. }
  243. def SwiftWrite5Cycle : SchedWriteRes<[]> {
  244. let Latency = 5;
  245. let NumMicroOps = 0;
  246. }
  247. def SwiftWrite6Cycle : SchedWriteRes<[]> {
  248. let Latency = 6;
  249. let NumMicroOps = 0;
  250. }
  251. // 4.2.14 Integer Multiply, Long
  252. def : InstRW< [SwiftP0P0P01FiveCycle, SwiftWrite5Cycle],
  253. (instregex "SMULL$", "UMULL$", "t2SMULL$", "t2UMULL$")>;
  254. def Swift2P03P01FiveCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP01]> {
  255. let Latency = 7;
  256. let NumMicroOps = 5;
  257. let ResourceCycles = [2, 3];
  258. }
  259. // Aliasing sub-target specific WriteRes to generic ones
  260. def : SchedAlias<WriteMUL16, SwiftWriteP0FourCycle>;
  261. def : SchedAlias<WriteMUL32, SwiftWriteP0FourCycle>;
  262. def : SchedAlias<WriteMUL64Lo, SwiftP0P0P01FiveCycle>;
  263. def : SchedAlias<WriteMUL64Hi, SwiftWrite5Cycle>;
  264. def : SchedAlias<WriteMAC16, SwiftPredP0P01FourFiveCycle>;
  265. def : SchedAlias<WriteMAC32, SwiftPredP0P01FourFiveCycle>;
  266. def : SchedAlias<WriteMAC64Lo, SwiftWrite5Cycle>;
  267. def : SchedAlias<WriteMAC64Hi, Swift2P03P01FiveCycle>;
  268. def : ReadAdvance<ReadMUL, 0>;
  269. def : SchedAlias<ReadMAC, SwiftReadAdvanceFourCyclesPred>;
  270. // 4.2.15 Integer Multiply Accumulate, Long
  271. // 4.2.16 Integer Multiply Accumulate, Dual
  272. // 4.2.17 Integer Multiply Accumulate Accumulate, Long
  273. // We are being a bit inaccurate here.
  274. def : InstRW< [SwiftWrite5Cycle, Swift2P03P01FiveCycle, ReadALU, ReadALU,
  275. SchedReadAdvance<4>, SchedReadAdvance<3>],
  276. (instregex "SMLAL", "UMLAL", "SMLALBT",
  277. "SMLALTB", "SMLALTT", "SMLALD", "SMLALDX", "SMLSLD", "SMLSLDX",
  278. "UMAAL", "t2SMLAL", "t2UMLAL", "t2SMLALBB", "t2SMLALBT",
  279. "t2SMLALTB", "t2SMLALTT", "t2SMLALD", "t2SMLALDX", "t2SMLSLD", "t2SMLSLDX",
  280. "t2UMAAL")>;
  281. def SwiftDiv : SchedWriteRes<[SwiftUnitP0, SwiftUnitDiv]> {
  282. let NumMicroOps = 1;
  283. let Latency = 14;
  284. let ResourceCycles = [1, 14];
  285. }
  286. // 4.2.18 Integer Divide
  287. def : WriteRes<WriteDIV, [SwiftUnitDiv]>; // Workaround.
  288. def : InstRW <[SwiftDiv],
  289. (instregex "SDIV", "UDIV", "t2SDIV", "t2UDIV")>;
  290. // 4.2.19 Integer Load Single Element
  291. // 4.2.20 Integer Load Signextended
  292. def SwiftWriteP2P01ThreeCycle : SchedWriteRes<[SwiftUnitP2, SwiftUnitP01]> {
  293. let Latency = 3;
  294. let NumMicroOps = 2;
  295. }
  296. def SwiftWriteP2P01FourCycle : SchedWriteRes<[SwiftUnitP2, SwiftUnitP01]> {
  297. let Latency = 4;
  298. let NumMicroOps = 2;
  299. }
  300. def SwiftWriteP2P01P01FourCycle : SchedWriteRes<[SwiftUnitP2, SwiftUnitP01,
  301. SwiftUnitP01]> {
  302. let Latency = 4;
  303. let NumMicroOps = 3;
  304. }
  305. def SwiftWriteP2P2ThreeCycle : SchedWriteRes<[SwiftUnitP2, SwiftUnitP2]> {
  306. let Latency = 3;
  307. let NumMicroOps = 2;
  308. }
  309. def SwiftWriteP2P2P01ThreeCycle : SchedWriteRes<[SwiftUnitP2, SwiftUnitP2,
  310. SwiftUnitP01]> {
  311. let Latency = 3;
  312. let NumMicroOps = 3;
  313. }
  314. def SwiftWrBackOne : SchedWriteRes<[]> {
  315. let Latency = 1;
  316. let NumMicroOps = 0;
  317. }
  318. def SwiftWriteLdFour : SchedWriteRes<[]> {
  319. let Latency = 4;
  320. let NumMicroOps = 0;
  321. }
  322. // Not accurate.
  323. def : InstRW<[SwiftWriteP2ThreeCycle],
  324. (instregex "LDR(i12|rs)$", "LDRB(i12|rs)$", "t2LDR(i8|i12|s|pci)",
  325. "t2LDR(H|B)(i8|i12|s|pci)", "LDREX", "tLDR[BH](r|i|spi|pci|pciASM)",
  326. "tLDR(r|i|spi|pci|pciASM)")>;
  327. def : InstRW<[SwiftWriteP2ThreeCycle],
  328. (instregex "LDRH$", "PICLDR$", "PICLDR(H|B)$", "LDRcp$")>;
  329. def : InstRW<[SwiftWriteP2P01FourCycle],
  330. (instregex "PICLDRS(H|B)$", "t2LDRS(H|B)(i|r|p|s)", "LDRS(H|B)$",
  331. "t2LDRpci_pic", "tLDRS(B|H)")>;
  332. def : InstRW<[SwiftWriteP2P01ThreeCycle, SwiftWrBackOne],
  333. (instregex "LD(RB|R)(_|T_)(POST|PRE)_(IMM|REG)", "LDRH(_PRE|_POST)",
  334. "LDR(T|BT)_POST_(REG|IMM)", "LDRHT(i|r)",
  335. "t2LD(R|RB|RH)_(PRE|POST)", "t2LD(R|RB|RH)T")>;
  336. def : InstRW<[SwiftWriteP2P01P01FourCycle, SwiftWrBackOne],
  337. (instregex "LDR(SH|SB)(_POST|_PRE)", "t2LDR(SH|SB)(_POST|_PRE)",
  338. "LDRS(B|H)T(i|r)", "t2LDRS(B|H)T(i|r)?")>;
  339. // 4.2.21 Integer Dual Load
  340. // Not accurate.
  341. def : InstRW<[SwiftWriteP2P2ThreeCycle, SwiftWriteLdFour],
  342. (instregex "t2LDRDi8", "LDRD$")>;
  343. def : InstRW<[SwiftWriteP2P2P01ThreeCycle, SwiftWriteLdFour, SwiftWrBackOne],
  344. (instregex "LDRD_(POST|PRE)", "t2LDRD_(POST|PRE)")>;
  345. // 4.2.22 Integer Load, Multiple
  346. // NumReg = 1 .. 16
  347. foreach Lat = 3-25 in {
  348. def SwiftWriteLM#Lat#Cy : SchedWriteRes<[SwiftUnitP2]> {
  349. let Latency = Lat;
  350. }
  351. def SwiftWriteLM#Lat#CyNo : SchedWriteRes<[]> {
  352. let Latency = Lat;
  353. let NumMicroOps = 0;
  354. }
  355. }
  356. // Predicate.
  357. foreach NumAddr = 1-16 in {
  358. def SwiftLMAddr#NumAddr#Pred : SchedPredicate<"TII->getNumLDMAddresses(*MI) == "#NumAddr>;
  359. }
  360. def SwiftWriteLDMAddrNoWB : SchedWriteRes<[SwiftUnitP01]> { let Latency = 0; }
  361. def SwiftWriteLDMAddrWB : SchedWriteRes<[SwiftUnitP01, SwiftUnitP01]>;
  362. def SwiftWriteLM : SchedWriteVariant<[
  363. SchedVar<SwiftLMAddr2Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy]>,
  364. SchedVar<SwiftLMAddr3Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  365. SwiftWriteLM5Cy]>,
  366. SchedVar<SwiftLMAddr4Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  367. SwiftWriteLM5Cy, SwiftWriteLM6Cy]>,
  368. SchedVar<SwiftLMAddr5Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  369. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  370. SwiftWriteLM7Cy]>,
  371. SchedVar<SwiftLMAddr6Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  372. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  373. SwiftWriteLM7Cy, SwiftWriteLM8Cy]>,
  374. SchedVar<SwiftLMAddr7Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  375. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  376. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  377. SwiftWriteLM9Cy]>,
  378. SchedVar<SwiftLMAddr8Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  379. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  380. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  381. SwiftWriteLM9Cy, SwiftWriteLM10Cy]>,
  382. SchedVar<SwiftLMAddr9Pred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  383. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  384. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  385. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  386. SwiftWriteLM11Cy]>,
  387. SchedVar<SwiftLMAddr10Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  388. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  389. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  390. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  391. SwiftWriteLM11Cy, SwiftWriteLM12Cy]>,
  392. SchedVar<SwiftLMAddr11Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  393. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  394. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  395. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  396. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  397. SwiftWriteLM13Cy]>,
  398. SchedVar<SwiftLMAddr12Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  399. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  400. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  401. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  402. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  403. SwiftWriteLM13Cy, SwiftWriteLM14Cy]>,
  404. SchedVar<SwiftLMAddr13Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  405. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  406. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  407. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  408. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  409. SwiftWriteLM13Cy, SwiftWriteLM14Cy,
  410. SwiftWriteLM15Cy]>,
  411. SchedVar<SwiftLMAddr14Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  412. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  413. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  414. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  415. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  416. SwiftWriteLM13Cy, SwiftWriteLM14Cy,
  417. SwiftWriteLM15Cy, SwiftWriteLM16Cy]>,
  418. SchedVar<SwiftLMAddr15Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  419. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  420. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  421. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  422. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  423. SwiftWriteLM13Cy, SwiftWriteLM14Cy,
  424. SwiftWriteLM15Cy, SwiftWriteLM16Cy,
  425. SwiftWriteLM17Cy]>,
  426. SchedVar<SwiftLMAddr16Pred,[SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  427. SwiftWriteLM5Cy, SwiftWriteLM6Cy,
  428. SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  429. SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  430. SwiftWriteLM11Cy, SwiftWriteLM12Cy,
  431. SwiftWriteLM13Cy, SwiftWriteLM14Cy,
  432. SwiftWriteLM15Cy, SwiftWriteLM16Cy,
  433. SwiftWriteLM17Cy, SwiftWriteLM18Cy]>,
  434. // Unknow number of registers, just use resources for two registers.
  435. SchedVar<NoSchedPred, [SwiftWriteLM3Cy, SwiftWriteLM4Cy,
  436. SwiftWriteLM5CyNo, SwiftWriteLM6CyNo,
  437. SwiftWriteLM7CyNo, SwiftWriteLM8CyNo,
  438. SwiftWriteLM9CyNo, SwiftWriteLM10CyNo,
  439. SwiftWriteLM11CyNo, SwiftWriteLM12CyNo,
  440. SwiftWriteLM13CyNo, SwiftWriteLM14CyNo,
  441. SwiftWriteLM15CyNo, SwiftWriteLM16CyNo,
  442. SwiftWriteLM17CyNo, SwiftWriteLM18CyNo]>
  443. ]> { let Variadic=1; }
  444. def : InstRW<[SwiftWriteLM, SwiftWriteLDMAddrNoWB],
  445. (instregex "LDM(IA|DA|DB|IB)$", "t2LDM(IA|DA|DB|IB)$",
  446. "(t|sys)LDM(IA|DA|DB|IB)$")>;
  447. def : InstRW<[SwiftWriteLDMAddrWB, SwiftWriteLM],
  448. (instregex /*"t2LDMIA_RET", "tLDMIA_RET", "LDMIA_RET",*/
  449. "LDM(IA|DA|DB|IB)_UPD", "(t2|sys|t)LDM(IA|DA|DB|IB)_UPD")>;
  450. def : InstRW<[SwiftWriteLDMAddrWB, SwiftWriteLM, SwiftWriteP1TwoCycle],
  451. (instregex "LDMIA_RET", "(t|t2)LDMIA_RET", "tPOP")>;
  452. // 4.2.23 Integer Store, Single Element
  453. def : InstRW<[SwiftWriteP2],
  454. (instregex "PICSTR", "STR(i12|rs)", "STRB(i12|rs)", "STRH$", "STREX",
  455. "t2STR(i12|i8|s)$", "t2STR[BH](i12|i8|s)$", "tSTR[BH](i|r)", "tSTR(i|r)", "tSTRspi")>;
  456. def : InstRW<[SwiftWriteP01OneCycle, SwiftWriteP2],
  457. (instregex "STR(B_|_|BT_|T_)(PRE_IMM|PRE_REG|POST_REG|POST_IMM)",
  458. "STR(i|r)_preidx", "STRB(i|r)_preidx", "STRH_preidx", "STR(H_|HT_)(PRE|POST)",
  459. "STR(BT|HT|T)", "t2STR_(PRE|POST)", "t2STR[BH]_(PRE|POST)",
  460. "t2STR_preidx", "t2STR[BH]_preidx", "t2ST(RB|RH|R)T")>;
  461. // 4.2.24 Integer Store, Dual
  462. def : InstRW<[SwiftWriteP2, SwiftWriteP2, SwiftWriteP01OneCycle],
  463. (instregex "STRD$", "t2STRDi8")>;
  464. def : InstRW<[SwiftWriteP01OneCycle, SwiftWriteP2, SwiftWriteP2,
  465. SwiftWriteP01OneCycle],
  466. (instregex "(t2|t)STRD_(POST|PRE)", "STRD_(POST|PRE)")>;
  467. // 4.2.25 Integer Store, Multiple
  468. def SwiftWriteStIncAddr : SchedWriteRes<[SwiftUnitP2, SwiftUnitP01]> {
  469. let Latency = 0;
  470. let NumMicroOps = 2;
  471. }
  472. foreach NumAddr = 1-16 in {
  473. def SwiftWriteSTM#NumAddr : WriteSequence<[SwiftWriteStIncAddr], NumAddr>;
  474. }
  475. def SwiftWriteSTM : SchedWriteVariant<[
  476. SchedVar<SwiftLMAddr2Pred, [SwiftWriteSTM2]>,
  477. SchedVar<SwiftLMAddr3Pred, [SwiftWriteSTM3]>,
  478. SchedVar<SwiftLMAddr4Pred, [SwiftWriteSTM4]>,
  479. SchedVar<SwiftLMAddr5Pred, [SwiftWriteSTM5]>,
  480. SchedVar<SwiftLMAddr6Pred, [SwiftWriteSTM6]>,
  481. SchedVar<SwiftLMAddr7Pred, [SwiftWriteSTM7]>,
  482. SchedVar<SwiftLMAddr8Pred, [SwiftWriteSTM8]>,
  483. SchedVar<SwiftLMAddr9Pred, [SwiftWriteSTM9]>,
  484. SchedVar<SwiftLMAddr10Pred,[SwiftWriteSTM10]>,
  485. SchedVar<SwiftLMAddr11Pred,[SwiftWriteSTM11]>,
  486. SchedVar<SwiftLMAddr12Pred,[SwiftWriteSTM12]>,
  487. SchedVar<SwiftLMAddr13Pred,[SwiftWriteSTM13]>,
  488. SchedVar<SwiftLMAddr14Pred,[SwiftWriteSTM14]>,
  489. SchedVar<SwiftLMAddr15Pred,[SwiftWriteSTM15]>,
  490. SchedVar<SwiftLMAddr16Pred,[SwiftWriteSTM16]>,
  491. // Unknow number of registers, just use resources for two registers.
  492. SchedVar<NoSchedPred, [SwiftWriteSTM2]>
  493. ]>;
  494. def : InstRW<[SwiftWriteSTM],
  495. (instregex "STM(IB|IA|DB|DA)$", "(t2|sys|t)STM(IB|IA|DB|DA)$")>;
  496. def : InstRW<[SwiftWriteP01OneCycle, SwiftWriteSTM],
  497. (instregex "STM(IB|IA|DB|DA)_UPD", "(t2|sys|t)STM(IB|IA|DB|DA)_UPD",
  498. "tPUSH")>;
  499. // LDRLIT pseudo instructions, they expand to LDR + PICADD
  500. def : InstRW<[SwiftWriteP2ThreeCycle, WriteALU],
  501. (instregex "t?LDRLIT_ga_abs", "t?LDRLIT_ga_pcrel")>;
  502. // LDRLIT_ga_pcrel_ldr expands to LDR + PICLDR
  503. def : InstRW<[SwiftWriteP2ThreeCycle, SwiftWriteP2ThreeCycle],
  504. (instregex "LDRLIT_ga_pcrel_ldr")>;
  505. // 4.2.26 Branch
  506. def : WriteRes<WriteBr, [SwiftUnitP1]> { let Latency = 0; }
  507. def : WriteRes<WriteBrL, [SwiftUnitP1]> { let Latency = 2; }
  508. def : WriteRes<WriteBrTbl, [SwiftUnitP1, SwiftUnitP2]> { let Latency = 0; }
  509. // 4.2.27 Not issued
  510. def : WriteRes<WriteNoop, []> { let Latency = 0; let NumMicroOps = 0; }
  511. def : InstRW<[WriteNoop], (instregex "t2IT", "IT")>;
  512. // 4.2.28 Advanced SIMD, Integer, 2 cycle
  513. def : InstRW<[SwiftWriteP0TwoCycle],
  514. (instregex "VADDv", "VSUBv", "VNEG(s|f|v)", "VADDL", "VSUBL",
  515. "VADDW", "VSUBW", "VHADD", "VHSUB", "VRHADD", "VPADDi",
  516. "VPADDL", "VAND", "VBIC", "VEOR", "VORN", "VORR", "VTST",
  517. "VSHL", "VSHR(s|u)", "VSHLL", "VQSHL(s|u)", "VBIF", "VBIT",
  518. "VBSL", "VBSP", "VSLI", "VSRI", "VCLS", "VCLZ", "VCNT")>;
  519. def : InstRW<[SwiftWriteP1TwoCycle],
  520. (instregex "VEXT", "VREV16", "VREV32", "VREV64")>;
  521. // 4.2.29 Advanced SIMD, Integer, 4 cycle
  522. // 4.2.30 Advanced SIMD, Integer with Accumulate
  523. def : InstRW<[SwiftWriteP0FourCycle],
  524. (instregex "VABA", "VABAL", "VPADAL", "VRSRA", "VSRA", "VACGE", "VACGT",
  525. "VCEQ", "VCGE", "VCGT", "VCLE", "VCLT", "VRSHL",
  526. "VQRSHL", "VRSHR(u|s)", "VABS(f|v)", "VQABS", "VQNEG", "VQADD",
  527. "VQSUB")>;
  528. def : InstRW<[SwiftWriteP1FourCycle],
  529. (instregex "VRECPE", "VRSQRTE")>;
  530. // 4.2.31 Advanced SIMD, Add and Shift with Narrow
  531. def : InstRW<[SwiftWriteP0P1FourCycle],
  532. (instregex "VADDHN", "VSUBHN", "VSHRN")>;
  533. def : InstRW<[SwiftWriteP0P1SixCycle],
  534. (instregex "VRADDHN", "VRSUBHN", "VRSHRN", "VQSHRN", "VQSHRUN",
  535. "VQRSHRN", "VQRSHRUN")>;
  536. // 4.2.32 Advanced SIMD, Vector Table Lookup
  537. foreach Num = 1-4 in {
  538. def SwiftWrite#Num#xP1TwoCycle : WriteSequence<[SwiftWriteP1TwoCycle], Num>;
  539. }
  540. def : InstRW<[SwiftWrite1xP1TwoCycle],
  541. (instregex "VTB(L|X)1")>;
  542. def : InstRW<[SwiftWrite2xP1TwoCycle],
  543. (instregex "VTB(L|X)2")>;
  544. def : InstRW<[SwiftWrite3xP1TwoCycle],
  545. (instregex "VTB(L|X)3")>;
  546. def : InstRW<[SwiftWrite4xP1TwoCycle],
  547. (instregex "VTB(L|X)4")>;
  548. // 4.2.33 Advanced SIMD, Transpose
  549. def : InstRW<[SwiftWriteP1FourCycle, SwiftWriteP1FourCycle,
  550. SwiftWriteP1TwoCycle/*RsrcOnly*/, SchedReadAdvance<2>],
  551. (instregex "VSWP", "VTRN", "VUZP", "VZIP")>;
  552. // 4.2.34 Advanced SIMD and VFP, Floating Point
  553. def : InstRW<[SwiftWriteP0TwoCycle], (instregex "VABS(S|D)$", "VNEG(S|D)$")>;
  554. def : InstRW<[SwiftWriteP0FourCycle],
  555. (instregex "VCMP(D|S|ZD|ZS)$", "VCMPE(D|S|ZD|ZS)")>;
  556. def : InstRW<[SwiftWriteP0FourCycle],
  557. (instregex "VADD(S|f)", "VSUB(S|f)", "VABD", "VPADDf", "VMAX", "VMIN", "VPMAX",
  558. "VPMIN")>;
  559. def : InstRW<[SwiftWriteP0SixCycle], (instregex "VADDD$", "VSUBD$")>;
  560. def : InstRW<[SwiftWriteP1EightCycle], (instregex "VRECPS", "VRSQRTS")>;
  561. // 4.2.35 Advanced SIMD and VFP, Multiply
  562. def : InstRW<[SwiftWriteP1FourCycle],
  563. (instregex "VMUL(S|v|p|f|s)", "VNMULS", "VQDMULH", "VQRDMULH",
  564. "VMULL", "VQDMULL")>;
  565. def : InstRW<[SwiftWriteP1FourCycle],
  566. (instregex "VMLA", "VMLS", "VNMLA", "VNMLS", "VFMA(S|D)", "VFMS(S|D)",
  567. "VFNMA", "VFNMS", "VMLAL", "VMLSL","VQDMLAL", "VQDMLSL")>;
  568. def : InstRW<[SwiftWriteP1EightCycle], (instregex "VFMAfd", "VFMSfd")>;
  569. def : InstRW<[SwiftWriteP1TwelveCyc], (instregex "VFMAfq", "VFMSfq")>;
  570. // 4.2.36 Advanced SIMD and VFP, Convert
  571. def : InstRW<[SwiftWriteP1FourCycle], (instregex "VCVT", "V(S|U)IT", "VTO(S|U)")>;
  572. // 4.2.37 Advanced SIMD and VFP, Move
  573. def : InstRW<[SwiftWriteP0TwoCycle],
  574. (instregex "VMOVv", "VMOV(S|D)$", "VMOV(S|D)cc",
  575. "VMVNv", "VMVN(d|q)",
  576. "FCONST(D|S)")>;
  577. def : InstRW<[SwiftWriteP1TwoCycle], (instregex "VMOVN", "VMOVL")>;
  578. def : InstRW<[WriteSequence<[SwiftWriteP0FourCycle, SwiftWriteP1TwoCycle]>],
  579. (instregex "VQMOVN")>;
  580. def : InstRW<[SwiftWriteP1TwoCycle], (instregex "VDUPLN")>;
  581. def : InstRW<[WriteSequence<[SwiftWriteP2FourCycle, SwiftWriteP1TwoCycle]>],
  582. (instregex "VDUP(8|16|32)")>;
  583. def : InstRW<[SwiftWriteP2ThreeCycle], (instregex "VMOVRS$")>;
  584. def : InstRW<[WriteSequence<[SwiftWriteP2FourCycle, SwiftWriteP0TwoCycle]>],
  585. (instregex "VMOVSR$", "VSETLN")>;
  586. def : InstRW<[SwiftWriteP2ThreeCycle, SwiftWriteP2FourCycle],
  587. (instregex "VMOVRR(D|S)$")>;
  588. def : InstRW<[SwiftWriteP2FourCycle], (instregex "VMOVDRR$")>;
  589. def : InstRW<[WriteSequence<[SwiftWriteP2FourCycle, SwiftWriteP1TwoCycle]>,
  590. WriteSequence<[SwiftWrite1Cycle, SwiftWriteP2FourCycle,
  591. SwiftWriteP1TwoCycle]>],
  592. (instregex "VMOVSRR$")>;
  593. def : InstRW<[WriteSequence<[SwiftWriteP1TwoCycle, SwiftWriteP2ThreeCycle]>],
  594. (instregex "VGETLN(u|i)")>;
  595. def : InstRW<[WriteSequence<[SwiftWriteP1TwoCycle, SwiftWriteP2ThreeCycle,
  596. SwiftWriteP01OneCycle]>],
  597. (instregex "VGETLNs")>;
  598. // 4.2.38 Advanced SIMD and VFP, Move FPSCR
  599. // Serializing instructions.
  600. def SwiftWaitP0For15Cy : SchedWriteRes<[SwiftUnitP0]> {
  601. let Latency = 15;
  602. let ResourceCycles = [15];
  603. }
  604. def SwiftWaitP1For15Cy : SchedWriteRes<[SwiftUnitP1]> {
  605. let Latency = 15;
  606. let ResourceCycles = [15];
  607. }
  608. def SwiftWaitP2For15Cy : SchedWriteRes<[SwiftUnitP2]> {
  609. let Latency = 15;
  610. let ResourceCycles = [15];
  611. }
  612. def : InstRW<[SwiftWaitP0For15Cy, SwiftWaitP1For15Cy, SwiftWaitP2For15Cy],
  613. (instregex "VMRS")>;
  614. def : InstRW<[SwiftWaitP0For15Cy, SwiftWaitP1For15Cy, SwiftWaitP2For15Cy],
  615. (instregex "VMSR")>;
  616. // Not serializing.
  617. def : InstRW<[SwiftWriteP0TwoCycle], (instregex "FMSTAT")>;
  618. // 4.2.39 Advanced SIMD and VFP, Load Single Element
  619. def : InstRW<[SwiftWriteLM4Cy], (instregex "VLDRD$", "VLDRS$")>;
  620. // 4.2.40 Advanced SIMD and VFP, Store Single Element
  621. def : InstRW<[SwiftWriteLM4Cy], (instregex "VSTRD$", "VSTRS$")>;
  622. // 4.2.41 Advanced SIMD and VFP, Load Multiple
  623. // 4.2.42 Advanced SIMD and VFP, Store Multiple
  624. // Resource requirement for permuting, just reserves the resources.
  625. foreach Num = 1-28 in {
  626. def SwiftVLDMPerm#Num : SchedWriteRes<[SwiftUnitP1]> {
  627. let Latency = 0;
  628. let NumMicroOps = Num;
  629. let ResourceCycles = [Num];
  630. }
  631. }
  632. // Pre RA pseudos - load/store to a Q register as a D register pair.
  633. def : InstRW<[SwiftWriteLM4Cy], (instregex "VLDMQIA$", "VSTMQIA$")>;
  634. // Post RA not modelled accurately. We assume that register use of width 64
  635. // bit maps to a D register, 128 maps to a Q register. Not all different kinds
  636. // are accurately represented.
  637. def SwiftWriteVLDM : SchedWriteVariant<[
  638. // Load of one S register.
  639. SchedVar<SwiftLMAddr1Pred, [SwiftWriteLM4Cy]>,
  640. // Load of one D register.
  641. SchedVar<SwiftLMAddr2Pred, [SwiftWriteLM4Cy, SwiftWriteLM4CyNo]>,
  642. // Load of 3 S register.
  643. SchedVar<SwiftLMAddr3Pred, [SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  644. SwiftWriteLM13CyNo, SwiftWriteP01OneCycle,
  645. SwiftVLDMPerm3]>,
  646. // Load of a Q register (not necessarily true). We should not be mapping to
  647. // 4 S registers, either.
  648. SchedVar<SwiftLMAddr4Pred, [SwiftWriteLM4Cy, SwiftWriteLM4CyNo,
  649. SwiftWriteLM4CyNo, SwiftWriteLM4CyNo]>,
  650. // Load of 5 S registers.
  651. SchedVar<SwiftLMAddr5Pred, [SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  652. SwiftWriteLM13CyNo, SwiftWriteLM14CyNo,
  653. SwiftWriteLM17CyNo, SwiftWriteP01OneCycle,
  654. SwiftVLDMPerm5]>,
  655. // Load of 3 D registers. (Must also be able to handle s register list -
  656. // though, not accurate)
  657. SchedVar<SwiftLMAddr6Pred, [SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  658. SwiftWriteLM10Cy, SwiftWriteLM14CyNo,
  659. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  660. SwiftWriteP01OneCycle, SwiftVLDMPerm5]>,
  661. // Load of 7 S registers.
  662. SchedVar<SwiftLMAddr7Pred, [SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  663. SwiftWriteLM13Cy, SwiftWriteLM14CyNo,
  664. SwiftWriteLM17CyNo, SwiftWriteLM18CyNo,
  665. SwiftWriteLM21CyNo, SwiftWriteP01OneCycle,
  666. SwiftVLDMPerm7]>,
  667. // Load of two Q registers.
  668. SchedVar<SwiftLMAddr8Pred, [SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  669. SwiftWriteLM13Cy, SwiftWriteLM13CyNo,
  670. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  671. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  672. SwiftWriteP01OneCycle, SwiftVLDMPerm2]>,
  673. // Load of 9 S registers.
  674. SchedVar<SwiftLMAddr9Pred, [SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  675. SwiftWriteLM13Cy, SwiftWriteLM14CyNo,
  676. SwiftWriteLM17CyNo, SwiftWriteLM18CyNo,
  677. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  678. SwiftWriteLM25CyNo, SwiftWriteP01OneCycle,
  679. SwiftVLDMPerm9]>,
  680. // Load of 5 D registers.
  681. SchedVar<SwiftLMAddr10Pred,[SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  682. SwiftWriteLM10Cy, SwiftWriteLM14Cy,
  683. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  684. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  685. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  686. SwiftWriteP01OneCycle, SwiftVLDMPerm5]>,
  687. // Inaccurate: reuse description from 9 S registers.
  688. SchedVar<SwiftLMAddr11Pred,[SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  689. SwiftWriteLM13Cy, SwiftWriteLM14CyNo,
  690. SwiftWriteLM17CyNo, SwiftWriteLM18CyNo,
  691. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  692. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  693. SwiftWriteLM25CyNo, SwiftWriteP01OneCycle,
  694. SwiftVLDMPerm9]>,
  695. // Load of three Q registers.
  696. SchedVar<SwiftLMAddr12Pred,[SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  697. SwiftWriteLM11Cy, SwiftWriteLM11Cy,
  698. SwiftWriteLM11CyNo, SwiftWriteLM11CyNo,
  699. SwiftWriteLM11CyNo, SwiftWriteLM11CyNo,
  700. SwiftWriteLM11CyNo, SwiftWriteLM11CyNo,
  701. SwiftWriteLM11CyNo, SwiftWriteLM11CyNo,
  702. SwiftWriteP01OneCycle, SwiftVLDMPerm3]>,
  703. // Inaccurate: reuse description from 9 S registers.
  704. SchedVar<SwiftLMAddr13Pred, [SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  705. SwiftWriteLM13Cy, SwiftWriteLM14CyNo,
  706. SwiftWriteLM17CyNo, SwiftWriteLM18CyNo,
  707. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  708. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  709. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  710. SwiftWriteLM25CyNo, SwiftWriteP01OneCycle,
  711. SwiftVLDMPerm9]>,
  712. // Load of 7 D registers inaccurate.
  713. SchedVar<SwiftLMAddr14Pred,[SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  714. SwiftWriteLM10Cy, SwiftWriteLM14Cy,
  715. SwiftWriteLM14Cy, SwiftWriteLM14CyNo,
  716. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  717. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  718. SwiftWriteLM14CyNo, SwiftWriteLM14CyNo,
  719. SwiftWriteP01OneCycle, SwiftVLDMPerm7]>,
  720. SchedVar<SwiftLMAddr15Pred,[SwiftWriteLM9Cy, SwiftWriteLM10Cy,
  721. SwiftWriteLM13Cy, SwiftWriteLM14Cy,
  722. SwiftWriteLM17Cy, SwiftWriteLM18CyNo,
  723. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  724. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  725. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  726. SwiftWriteLM21CyNo, SwiftWriteLM22CyNo,
  727. SwiftWriteLM25CyNo, SwiftWriteP01OneCycle,
  728. SwiftVLDMPerm9]>,
  729. // Load of 4 Q registers.
  730. SchedVar<SwiftLMAddr16Pred,[SwiftWriteLM7Cy, SwiftWriteLM10Cy,
  731. SwiftWriteLM11Cy, SwiftWriteLM14Cy,
  732. SwiftWriteLM15Cy, SwiftWriteLM18CyNo,
  733. SwiftWriteLM19CyNo, SwiftWriteLM22CyNo,
  734. SwiftWriteLM19CyNo, SwiftWriteLM22CyNo,
  735. SwiftWriteLM19CyNo, SwiftWriteLM22CyNo,
  736. SwiftWriteLM19CyNo, SwiftWriteLM22CyNo,
  737. SwiftWriteLM19CyNo, SwiftWriteLM22CyNo,
  738. SwiftWriteP01OneCycle, SwiftVLDMPerm4]>,
  739. // Unknow number of registers, just use resources for two registers.
  740. SchedVar<NoSchedPred, [SwiftWriteLM7Cy, SwiftWriteLM8Cy,
  741. SwiftWriteLM13Cy, SwiftWriteLM13CyNo,
  742. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  743. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  744. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  745. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  746. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  747. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  748. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  749. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  750. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  751. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  752. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  753. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  754. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  755. SwiftWriteLM13CyNo, SwiftWriteLM13CyNo,
  756. SwiftWriteP01OneCycle, SwiftVLDMPerm2]>
  757. ]> { let Variadic = 1; }
  758. def : InstRW<[SwiftWriteVLDM], (instregex "VLDM[SD](IA|DB)$")>;
  759. def : InstRW<[SwiftWriteP01OneCycle2x, SwiftWriteVLDM],
  760. (instregex "VLDM[SD](IA|DB)_UPD$")>;
  761. def SwiftWriteVSTM : SchedWriteVariant<[
  762. // One S register.
  763. SchedVar<SwiftLMAddr1Pred, [SwiftWriteSTM1]>,
  764. // One D register.
  765. SchedVar<SwiftLMAddr2Pred, [SwiftWriteSTM1]>,
  766. // Three S registers.
  767. SchedVar<SwiftLMAddr3Pred, [SwiftWriteSTM4]>,
  768. // Assume one Q register.
  769. SchedVar<SwiftLMAddr4Pred, [SwiftWriteSTM1]>,
  770. SchedVar<SwiftLMAddr5Pred, [SwiftWriteSTM6]>,
  771. // Assume three D registers.
  772. SchedVar<SwiftLMAddr6Pred, [SwiftWriteSTM4]>,
  773. SchedVar<SwiftLMAddr7Pred, [SwiftWriteSTM8]>,
  774. // Assume two Q registers.
  775. SchedVar<SwiftLMAddr8Pred, [SwiftWriteSTM3]>,
  776. SchedVar<SwiftLMAddr9Pred, [SwiftWriteSTM10]>,
  777. // Assume 5 D registers.
  778. SchedVar<SwiftLMAddr10Pred, [SwiftWriteSTM6]>,
  779. SchedVar<SwiftLMAddr11Pred, [SwiftWriteSTM12]>,
  780. // Assume three Q registers.
  781. SchedVar<SwiftLMAddr12Pred, [SwiftWriteSTM4]>,
  782. SchedVar<SwiftLMAddr13Pred, [SwiftWriteSTM14]>,
  783. // Assume 7 D registers.
  784. SchedVar<SwiftLMAddr14Pred, [SwiftWriteSTM8]>,
  785. SchedVar<SwiftLMAddr15Pred, [SwiftWriteSTM16]>,
  786. // Assume four Q registers.
  787. SchedVar<SwiftLMAddr16Pred, [SwiftWriteSTM5]>,
  788. // Asumme two Q registers.
  789. SchedVar<NoSchedPred, [SwiftWriteSTM3]>
  790. ]> { let Variadic = 1; }
  791. def : InstRW<[SwiftWriteVSTM], (instregex "VSTM[SD](IA|DB)$")>;
  792. def : InstRW<[SwiftWriteP01OneCycle2x, SwiftWriteVSTM],
  793. (instregex "VSTM[SD](IA|DB)_UPD")>;
  794. // 4.2.43 Advanced SIMD, Element or Structure Load and Store
  795. def SwiftWrite2xP2FourCy : SchedWriteRes<[SwiftUnitP2]> {
  796. let Latency = 4;
  797. let ResourceCycles = [2];
  798. }
  799. def SwiftWrite3xP2FourCy : SchedWriteRes<[SwiftUnitP2]> {
  800. let Latency = 4;
  801. let ResourceCycles = [3];
  802. }
  803. foreach Num = 1-2 in {
  804. def SwiftExt#Num#xP0 : SchedWriteRes<[SwiftUnitP0]> {
  805. let Latency = 0;
  806. let NumMicroOps = Num;
  807. let ResourceCycles = [Num];
  808. }
  809. }
  810. // VLDx
  811. // Multiple structures.
  812. // Single element structure loads.
  813. // We assume aligned.
  814. // Single/two register.
  815. def : InstRW<[SwiftWriteLM4Cy], (instregex "VLD1(d|q)(8|16|32|64)$")>;
  816. def : InstRW<[SwiftWriteLM4Cy, SwiftWriteP01OneCycle],
  817. (instregex "VLD1(d|q)(8|16|32|64)wb")>;
  818. // Three register.
  819. def : InstRW<[SwiftWrite3xP2FourCy],
  820. (instregex "VLD1(d|q)(8|16|32|64)T$", "VLD1d64TPseudo")>;
  821. def : InstRW<[SwiftWrite3xP2FourCy, SwiftWriteP01OneCycle],
  822. (instregex "VLD1(d|q)(8|16|32|64)Twb")>;
  823. /// Four Register.
  824. def : InstRW<[SwiftWrite2xP2FourCy],
  825. (instregex "VLD1(d|q)(8|16|32|64)Q$", "VLD1d64QPseudo")>;
  826. def : InstRW<[SwiftWrite2xP2FourCy, SwiftWriteP01OneCycle],
  827. (instregex "VLD1(d|q)(8|16|32|64)Qwb")>;
  828. // Two element structure loads.
  829. // Two/four register.
  830. def : InstRW<[SwiftWriteLM9Cy, SwiftExt2xP0, SwiftVLDMPerm2],
  831. (instregex "VLD2(d|q|b)(8|16|32)$", "VLD2q(8|16|32)Pseudo$")>;
  832. def : InstRW<[SwiftWriteLM9Cy, SwiftWriteP01OneCycle, SwiftExt2xP0,
  833. SwiftVLDMPerm2],
  834. (instregex "VLD2(d|q|b)(8|16|32)wb", "VLD2q(8|16|32)PseudoWB")>;
  835. // Three element structure.
  836. def : InstRW<[SwiftWriteLM9Cy, SwiftWriteLM9CyNo, SwiftWriteLM9CyNo,
  837. SwiftVLDMPerm3, SwiftWrite3xP2FourCy],
  838. (instregex "VLD3(d|q)(8|16|32)$")>;
  839. def : InstRW<[SwiftWriteLM9Cy, SwiftVLDMPerm3, SwiftWrite3xP2FourCy],
  840. (instregex "VLD3(d|q)(8|16|32)(oddP|P)seudo$")>;
  841. def : InstRW<[SwiftWriteLM9Cy, SwiftWriteLM9CyNo, SwiftWriteLM9CyNo,
  842. SwiftWriteP01OneCycle, SwiftVLDMPerm3, SwiftWrite3xP2FourCy],
  843. (instregex "VLD3(d|q)(8|16|32)_UPD$")>;
  844. def : InstRW<[SwiftWriteLM9Cy, SwiftWriteP01OneCycle, SwiftVLDMPerm3,
  845. SwiftWrite3xP2FourCy],
  846. (instregex "VLD3(d|q)(8|16|32)(oddP|P)seudo_UPD")>;
  847. // Four element structure loads.
  848. def : InstRW<[SwiftWriteLM11Cy, SwiftWriteLM11Cy, SwiftWriteLM11Cy,
  849. SwiftWriteLM11Cy, SwiftExt2xP0, SwiftVLDMPerm4,
  850. SwiftWrite3xP2FourCy],
  851. (instregex "VLD4(d|q)(8|16|32)$")>;
  852. def : InstRW<[SwiftWriteLM11Cy, SwiftExt2xP0, SwiftVLDMPerm4,
  853. SwiftWrite3xP2FourCy],
  854. (instregex "VLD4(d|q)(8|16|32)(oddP|P)seudo$")>;
  855. def : InstRW<[SwiftWriteLM11Cy, SwiftWriteLM11Cy, SwiftWriteLM11Cy,
  856. SwiftWriteLM11Cy, SwiftWriteP01OneCycle, SwiftExt2xP0,
  857. SwiftVLDMPerm4, SwiftWrite3xP2FourCy],
  858. (instregex "VLD4(d|q)(8|16|32)_UPD")>;
  859. def : InstRW<[SwiftWriteLM11Cy, SwiftWriteP01OneCycle, SwiftExt2xP0,
  860. SwiftVLDMPerm4, SwiftWrite3xP2FourCy],
  861. (instregex "VLD4(d|q)(8|16|32)(oddP|P)seudo_UPD")>;
  862. // Single all/lane loads.
  863. // One element structure.
  864. def : InstRW<[SwiftWriteLM6Cy, SwiftVLDMPerm2],
  865. (instregex "VLD1(LN|DUP)(d|q)(8|16|32)$", "VLD1(LN|DUP)(d|q)(8|16|32)Pseudo$")>;
  866. def : InstRW<[SwiftWriteLM6Cy, SwiftWriteP01OneCycle, SwiftVLDMPerm2],
  867. (instregex "VLD1(LN|DUP)(d|q)(8|16|32)(wb|_UPD)",
  868. "VLD1LNq(8|16|32)Pseudo_UPD")>;
  869. // Two element structure.
  870. def : InstRW<[SwiftWriteLM6Cy, SwiftWriteLM6Cy, SwiftExt1xP0, SwiftVLDMPerm2],
  871. (instregex "VLD2(DUP|LN)(d|q)(8|16|32|8x2|16x2|32x2)$",
  872. "VLD2LN(d|q)(8|16|32)Pseudo$")>;
  873. def : InstRW<[SwiftWriteLM6Cy, SwiftWriteLM6Cy, SwiftWriteP01OneCycle,
  874. SwiftExt1xP0, SwiftVLDMPerm2],
  875. (instregex "VLD2LN(d|q)(8|16|32)_UPD$")>;
  876. def : InstRW<[SwiftWriteLM6Cy, SwiftWriteP01OneCycle, SwiftWriteLM6Cy,
  877. SwiftExt1xP0, SwiftVLDMPerm2],
  878. (instregex "VLD2DUPd(8|16|32|8x2|16x2|32x2)wb")>;
  879. def : InstRW<[SwiftWriteLM6Cy, SwiftWriteP01OneCycle, SwiftWriteLM6Cy,
  880. SwiftExt1xP0, SwiftVLDMPerm2],
  881. (instregex "VLD2LN(d|q)(8|16|32)Pseudo_UPD")>;
  882. // Three element structure.
  883. def : InstRW<[SwiftWriteLM7Cy, SwiftWriteLM8Cy, SwiftWriteLM8Cy, SwiftExt1xP0,
  884. SwiftVLDMPerm3],
  885. (instregex "VLD3(DUP|LN)(d|q)(8|16|32)$",
  886. "VLD3(LN|DUP)(d|q)(8|16|32)Pseudo$")>;
  887. def : InstRW<[SwiftWriteLM7Cy, SwiftWriteLM8Cy, SwiftWriteLM8Cy,
  888. SwiftWriteP01OneCycle, SwiftExt1xP0, SwiftVLDMPerm3],
  889. (instregex "VLD3(LN|DUP)(d|q)(8|16|32)_UPD")>;
  890. def : InstRW<[SwiftWriteLM7Cy, SwiftWriteP01OneCycle, SwiftWriteLM8Cy,
  891. SwiftWriteLM8Cy, SwiftExt1xP0, SwiftVLDMPerm3],
  892. (instregex "VLD3(LN|DUP)(d|q)(8|16|32)Pseudo_UPD")>;
  893. // Four element structure.
  894. def : InstRW<[SwiftWriteLM8Cy, SwiftWriteLM9Cy, SwiftWriteLM10CyNo,
  895. SwiftWriteLM10CyNo, SwiftExt1xP0, SwiftVLDMPerm5],
  896. (instregex "VLD4(LN|DUP)(d|q)(8|16|32)$",
  897. "VLD4(LN|DUP)(d|q)(8|16|32)Pseudo$")>;
  898. def : InstRW<[SwiftWriteLM8Cy, SwiftWriteLM9Cy, SwiftWriteLM10CyNo,
  899. SwiftWriteLM10CyNo, SwiftWriteP01OneCycle, SwiftExt1xP0,
  900. SwiftVLDMPerm5],
  901. (instregex "VLD4(DUP|LN)(d|q)(8|16|32)_UPD")>;
  902. def : InstRW<[SwiftWriteLM8Cy, SwiftWriteP01OneCycle, SwiftWriteLM9Cy,
  903. SwiftWriteLM10CyNo, SwiftWriteLM10CyNo, SwiftExt1xP0,
  904. SwiftVLDMPerm5],
  905. (instregex "VLD4(DUP|LN)(d|q)(8|16|32)Pseudo_UPD")>;
  906. // VSTx
  907. // Multiple structures.
  908. // Single element structure store.
  909. def : InstRW<[SwiftWrite1xP2], (instregex "VST1d(8|16|32|64)$")>;
  910. def : InstRW<[SwiftWrite2xP2], (instregex "VST1q(8|16|32|64)$")>;
  911. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite1xP2],
  912. (instregex "VST1d(8|16|32|64)wb")>;
  913. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite2xP2],
  914. (instregex "VST1q(8|16|32|64)wb")>;
  915. def : InstRW<[SwiftWrite3xP2],
  916. (instregex "VST1d(8|16|32|64)T$", "VST1d64TPseudo$")>;
  917. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite3xP2],
  918. (instregex "VST1d(8|16|32|64)Twb", "VST1d64TPseudoWB")>;
  919. def : InstRW<[SwiftWrite4xP2],
  920. (instregex "VST1d(8|16|32|64)(Q|QPseudo)$")>;
  921. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite4xP2],
  922. (instregex "VST1d(8|16|32|64)(Qwb|QPseudoWB)")>;
  923. // Two element structure store.
  924. def : InstRW<[SwiftWrite1xP2, SwiftVLDMPerm1],
  925. (instregex "VST2(d|b)(8|16|32)$")>;
  926. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite1xP2, SwiftVLDMPerm1],
  927. (instregex "VST2(b|d)(8|16|32)wb")>;
  928. def : InstRW<[SwiftWrite2xP2, SwiftVLDMPerm2],
  929. (instregex "VST2q(8|16|32)$", "VST2q(8|16|32)Pseudo$")>;
  930. def : InstRW<[SwiftWrite2xP2, SwiftVLDMPerm2],
  931. (instregex "VST2q(8|16|32)wb", "VST2q(8|16|32)PseudoWB")>;
  932. // Three element structure store.
  933. def : InstRW<[SwiftWrite4xP2, SwiftVLDMPerm2],
  934. (instregex "VST3(d|q)(8|16|32)$", "VST3(d|q)(8|16|32)(oddP|P)seudo$")>;
  935. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite4xP2, SwiftVLDMPerm2],
  936. (instregex "VST3(d|q)(8|16|32)_UPD",
  937. "VST3(d|q)(8|16|32)(oddP|P)seudo_UPD$")>;
  938. // Four element structure store.
  939. def : InstRW<[SwiftWrite4xP2, SwiftVLDMPerm2],
  940. (instregex "VST4(d|q)(8|16|32)$", "VST4(d|q)(8|16|32)(oddP|P)seudo$")>;
  941. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite4xP2, SwiftVLDMPerm4],
  942. (instregex "VST4(d|q)(8|16|32)_UPD",
  943. "VST4(d|q)(8|16|32)(oddP|P)seudo_UPD$")>;
  944. // Single/all lane store.
  945. // One element structure.
  946. def : InstRW<[SwiftWrite1xP2, SwiftVLDMPerm1],
  947. (instregex "VST1LNd(8|16|32)$", "VST1LNq(8|16|32)Pseudo$")>;
  948. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite1xP2, SwiftVLDMPerm1],
  949. (instregex "VST1LNd(8|16|32)_UPD", "VST1LNq(8|16|32)Pseudo_UPD")>;
  950. // Two element structure.
  951. def : InstRW<[SwiftWrite1xP2, SwiftVLDMPerm2],
  952. (instregex "VST2LN(d|q)(8|16|32)$", "VST2LN(d|q)(8|16|32)Pseudo$")>;
  953. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite1xP2, SwiftVLDMPerm2],
  954. (instregex "VST2LN(d|q)(8|16|32)_UPD",
  955. "VST2LN(d|q)(8|16|32)Pseudo_UPD")>;
  956. // Three element structure.
  957. def : InstRW<[SwiftWrite4xP2, SwiftVLDMPerm2],
  958. (instregex "VST3LN(d|q)(8|16|32)$", "VST3LN(d|q)(8|16|32)Pseudo$")>;
  959. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite4xP2, SwiftVLDMPerm2],
  960. (instregex "VST3LN(d|q)(8|16|32)_UPD",
  961. "VST3LN(d|q)(8|16|32)Pseudo_UPD")>;
  962. // Four element structure.
  963. def : InstRW<[SwiftWrite2xP2, SwiftVLDMPerm2],
  964. (instregex "VST4LN(d|q)(8|16|32)$", "VST4LN(d|q)(8|16|32)Pseudo$")>;
  965. def : InstRW<[SwiftWriteP01OneCycle, SwiftWrite2xP2, SwiftVLDMPerm2],
  966. (instregex "VST4LN(d|q)(8|16|32)_UPD",
  967. "VST4LN(d|q)(8|16|32)Pseudo_UPD")>;
  968. // 4.2.44 VFP, Divide and Square Root
  969. def SwiftDiv17 : SchedWriteRes<[SwiftUnitP0, SwiftUnitDiv]> {
  970. let NumMicroOps = 1;
  971. let Latency = 17;
  972. let ResourceCycles = [1, 15];
  973. }
  974. def SwiftDiv32 : SchedWriteRes<[SwiftUnitP0, SwiftUnitDiv]> {
  975. let NumMicroOps = 1;
  976. let Latency = 32;
  977. let ResourceCycles = [1, 30];
  978. }
  979. def : InstRW<[SwiftDiv17], (instregex "VDIVS", "VSQRTS")>;
  980. def : InstRW<[SwiftDiv32], (instregex "VDIVD", "VSQRTD")>;
  981. // ===---------------------------------------------------------------------===//
  982. // Floating-point. Map target defined SchedReadWrite to processor specific ones
  983. //
  984. def : SchedAlias<WriteFPCVT, SwiftWriteP1FourCycle>;
  985. def : SchedAlias<WriteFPMOV, SwiftWriteP2ThreeCycle>;
  986. def : SchedAlias<WriteFPALU32, SwiftWriteP0FourCycle>;
  987. def : SchedAlias<WriteFPALU64, SwiftWriteP0SixCycle>;
  988. def : SchedAlias<WriteFPMUL32, SwiftWriteP1FourCycle>;
  989. def : SchedAlias<WriteFPMUL64, SwiftWriteP1SixCycle>;
  990. def : SchedAlias<WriteFPMAC32, SwiftWriteP1FourCycle>;
  991. def : SchedAlias<WriteFPMAC64, SwiftWriteP1FourCycle>;
  992. def : SchedAlias<WriteFPDIV32, SwiftDiv17>;
  993. def : SchedAlias<WriteFPSQRT32, SwiftDiv17>;
  994. def : SchedAlias<WriteFPDIV64, SwiftDiv32>;
  995. def : SchedAlias<WriteFPSQRT64, SwiftDiv32>;
  996. def : ReadAdvance<ReadFPMUL, 0>;
  997. def : ReadAdvance<ReadFPMAC, 0>;
  998. // Overriden via InstRW for this processor.
  999. def : WriteRes<WriteVLD1, []>;
  1000. def : WriteRes<WriteVLD2, []>;
  1001. def : WriteRes<WriteVLD3, []>;
  1002. def : WriteRes<WriteVLD4, []>;
  1003. def : WriteRes<WriteVST1, []>;
  1004. def : WriteRes<WriteVST2, []>;
  1005. def : WriteRes<WriteVST3, []>;
  1006. def : WriteRes<WriteVST4, []>;
  1007. // Not specified.
  1008. def : InstRW<[SwiftWriteP01OneCycle2x], (instregex "ABS")>;
  1009. // Preload.
  1010. def : WriteRes<WritePreLd, [SwiftUnitP2]> { let Latency = 0;
  1011. let ResourceCycles = [0];
  1012. }
  1013. }