AArch64SchedExynosM5.td 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. //=- AArch64SchedExynosM5.td - Samsung Exynos M5 Sched Defs --*- 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 the Samsung Exynos M5 to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // The Exynos-M5 is an advanced superscalar microprocessor with a 6-wide
  15. // in-order stage for decode and dispatch and a wider issue stage.
  16. // The execution units and loads and stores are out-of-order.
  17. def ExynosM5Model : SchedMachineModel {
  18. let IssueWidth = 6; // Up to 6 uops per cycle.
  19. let MicroOpBufferSize = 228; // ROB size.
  20. let LoopMicroOpBufferSize = 60; // Based on the instruction queue size.
  21. let LoadLatency = 4; // Optimistic load cases.
  22. let MispredictPenalty = 15; // Minimum branch misprediction penalty.
  23. let CompleteModel = 1; // Use the default model otherwise.
  24. list<Predicate> UnsupportedFeatures = !listconcat(SVEUnsupported.F,
  25. PAUnsupported.F,
  26. SMEUnsupported.F,
  27. [HasMTE]);
  28. }
  29. //===----------------------------------------------------------------------===//
  30. // Define each kind of processor resource and number available on the Exynos-M5.
  31. let SchedModel = ExynosM5Model in {
  32. def M5UnitA : ProcResource<2>; // Simple integer
  33. def M5UnitC : ProcResource<2>; // Simple and complex integer
  34. let Super = M5UnitC, BufferSize = 1 in
  35. def M5UnitD : ProcResource<1>; // Integer division (inside C0, serialized)
  36. def M5UnitE : ProcResource<2>; // Simple 32-bit integer
  37. let Super = M5UnitC in
  38. def M5UnitF : ProcResource<2>; // CRC (inside C)
  39. def M5UnitB : ProcResource<1>; // Branch
  40. def M5UnitL0 : ProcResource<1>; // Load
  41. def M5UnitS0 : ProcResource<1>; // Store
  42. def M5PipeLS : ProcResource<1>; // Load/Store
  43. let Super = M5PipeLS in {
  44. def M5UnitL1 : ProcResource<1>;
  45. def M5UnitS1 : ProcResource<1>;
  46. }
  47. def M5PipeF0 : ProcResource<1>; // FP #0
  48. let Super = M5PipeF0 in {
  49. def M5UnitFMAC0 : ProcResource<1>; // FP multiplication
  50. def M5UnitFADD0 : ProcResource<1>; // Simple FP
  51. def M5UnitNALU0 : ProcResource<1>; // Simple vector
  52. def M5UnitNDOT0 : ProcResource<1>; // Dot product vector
  53. def M5UnitNHAD : ProcResource<1>; // Horizontal vector
  54. def M5UnitNMSC : ProcResource<1>; // FP and vector miscellanea
  55. def M5UnitNMUL0 : ProcResource<1>; // Vector multiplication
  56. def M5UnitNSHT0 : ProcResource<1>; // Vector shifting
  57. def M5UnitNSHF0 : ProcResource<1>; // Vector shuffling
  58. def M5UnitNCRY0 : ProcResource<1>; // Cryptographic
  59. }
  60. def M5PipeF1 : ProcResource<1>; // FP #1
  61. let Super = M5PipeF1 in {
  62. def M5UnitFMAC1 : ProcResource<1>; // FP multiplication
  63. def M5UnitFADD1 : ProcResource<1>; // Simple FP
  64. def M5UnitFCVT0 : ProcResource<1>; // FP conversion
  65. def M5UnitFDIV0 : ProcResource<2>; // FP division (serialized)
  66. def M5UnitFSQR0 : ProcResource<2>; // FP square root (serialized)
  67. def M5UnitFST0 : ProcResource<1>; // FP store
  68. def M5UnitNALU1 : ProcResource<1>; // Simple vector
  69. def M5UnitNDOT1 : ProcResource<1>; // Dot product vector
  70. def M5UnitNSHT1 : ProcResource<1>; // Vector shifting
  71. def M5UnitNSHF1 : ProcResource<1>; // Vector shuffling
  72. }
  73. def M5PipeF2 : ProcResource<1>; // FP #2
  74. let Super = M5PipeF2 in {
  75. def M5UnitFMAC2 : ProcResource<1>; // FP multiplication
  76. def M5UnitFADD2 : ProcResource<1>; // Simple FP
  77. def M5UnitFCVT1 : ProcResource<1>; // FP conversion
  78. def M5UnitFDIV1 : ProcResource<2>; // FP division (serialized)
  79. def M5UnitFSQR1 : ProcResource<2>; // FP square root (serialized)
  80. def M5UnitFST1 : ProcResource<1>; // FP store
  81. def M5UnitNALU2 : ProcResource<1>; // Simple vector
  82. def M5UnitNDOT2 : ProcResource<1>; // Dot product vector
  83. def M5UnitNMUL1 : ProcResource<1>; // Vector multiplication
  84. def M5UnitNSHT2 : ProcResource<1>; // Vector shifting
  85. def M5UnitNCRY1 : ProcResource<1>; // Cryptographic
  86. }
  87. def M5UnitAX : ProcResGroup<[M5UnitA,
  88. M5UnitC]>;
  89. def M5UnitAW : ProcResGroup<[M5UnitA,
  90. M5UnitC,
  91. M5UnitE]>;
  92. def M5UnitL : ProcResGroup<[M5UnitL0,
  93. M5UnitL1]>;
  94. def M5UnitS : ProcResGroup<[M5UnitS0,
  95. M5UnitS1]>;
  96. def M5UnitFMAC : ProcResGroup<[M5UnitFMAC0,
  97. M5UnitFMAC1,
  98. M5UnitFMAC2]>;
  99. def M5UnitFADD : ProcResGroup<[M5UnitFADD0,
  100. M5UnitFADD1,
  101. M5UnitFADD2]>;
  102. def M5UnitFCVT : ProcResGroup<[M5UnitFCVT0,
  103. M5UnitFCVT1]>;
  104. def M5UnitFDIV : ProcResGroup<[M5UnitFDIV0,
  105. M5UnitFDIV1]>;
  106. def M5UnitFSQR : ProcResGroup<[M5UnitFSQR0,
  107. M5UnitFSQR1]>;
  108. def M5UnitFST : ProcResGroup<[M5UnitFST0,
  109. M5UnitFST1]>;
  110. def M5UnitNALU : ProcResGroup<[M5UnitNALU0,
  111. M5UnitNALU1,
  112. M5UnitNALU2]>;
  113. def M5UnitNDOT : ProcResGroup<[M5UnitNDOT0,
  114. M5UnitNDOT1,
  115. M5UnitNDOT2]>;
  116. def M5UnitNMUL : ProcResGroup<[M5UnitNMUL0,
  117. M5UnitNMUL1]>;
  118. def M5UnitNSHT : ProcResGroup<[M5UnitNSHT0,
  119. M5UnitNSHT1,
  120. M5UnitNSHT2]>;
  121. def M5UnitNSHF : ProcResGroup<[M5UnitNSHF0,
  122. M5UnitNSHF1]>;
  123. def M5UnitNCRY : ProcResGroup<[M5UnitNCRY0,
  124. M5UnitNCRY1]>;
  125. //===----------------------------------------------------------------------===//
  126. // Resources details.
  127. def M5WriteZ0 : SchedWriteRes<[]> { let Latency = 0; }
  128. def M5WriteZ1 : SchedWriteRes<[]> { let Latency = 1;
  129. let NumMicroOps = 0; }
  130. def M5WriteZ4 : SchedWriteRes<[]> { let Latency = 4;
  131. let NumMicroOps = 0; }
  132. def M5WriteA1W : SchedWriteRes<[M5UnitAW]> { let Latency = 1; }
  133. def M5WriteA1X : SchedWriteRes<[M5UnitAX]> { let Latency = 1; }
  134. def M5WriteAAW : SchedWriteRes<[M5UnitAW]> { let Latency = 2;
  135. let ResourceCycles = [2]; }
  136. def M5WriteAAX : SchedWriteRes<[M5UnitAX]> { let Latency = 2;
  137. let ResourceCycles = [2]; }
  138. def M5WriteAB : SchedWriteRes<[M5UnitAX,
  139. M5UnitC,
  140. M5UnitE]> { let Latency = 2;
  141. let NumMicroOps = 2; }
  142. def M5WriteAC : SchedWriteRes<[M5UnitAX,
  143. M5UnitAX,
  144. M5UnitC]> { let Latency = 3;
  145. let NumMicroOps = 3; }
  146. def M5WriteAD : SchedWriteRes<[M5UnitAW,
  147. M5UnitC]> { let Latency = 2;
  148. let NumMicroOps = 2; }
  149. def M5WriteAFW : SchedWriteRes<[M5UnitAW]> { let Latency = 2;
  150. let NumMicroOps = 2; }
  151. def M5WriteAFX : SchedWriteRes<[M5UnitAX]> { let Latency = 2;
  152. let NumMicroOps = 2; }
  153. def M5WriteAUW : SchedWriteVariant<[SchedVar<IsCopyIdiomPred, [M5WriteZ0]>,
  154. SchedVar<ExynosArithPred, [M5WriteA1W]>,
  155. SchedVar<ExynosLogicExPred, [M5WriteA1W]>,
  156. SchedVar<NoSchedPred, [M5WriteAAW]>]>;
  157. def M5WriteAUX : SchedWriteVariant<[SchedVar<IsCopyIdiomPred, [M5WriteZ0]>,
  158. SchedVar<ExynosArithPred, [M5WriteA1X]>,
  159. SchedVar<ExynosLogicExPred, [M5WriteA1X]>,
  160. SchedVar<NoSchedPred, [M5WriteAAX]>]>;
  161. def M5WriteAVW : SchedWriteVariant<[SchedVar<ExynosResetPred, [M5WriteZ0]>,
  162. SchedVar<ExynosArithPred, [M5WriteA1W]>,
  163. SchedVar<ExynosLogicExPred, [M5WriteA1W]>,
  164. SchedVar<NoSchedPred, [M5WriteAAW]>]>;
  165. def M5WriteAVX : SchedWriteVariant<[SchedVar<ExynosResetPred, [M5WriteZ0]>,
  166. SchedVar<ExynosArithPred, [M5WriteA1X]>,
  167. SchedVar<ExynosLogicExPred, [M5WriteA1X]>,
  168. SchedVar<NoSchedPred, [M5WriteAAX]>]>;
  169. def M5WriteAXW : SchedWriteVariant<[SchedVar<ExynosArithPred, [M5WriteA1W]>,
  170. SchedVar<ExynosLogicExPred, [M5WriteA1W]>,
  171. SchedVar<NoSchedPred, [M5WriteAAW]>]>;
  172. def M5WriteAXX : SchedWriteVariant<[SchedVar<ExynosArithPred, [M5WriteA1X]>,
  173. SchedVar<ExynosLogicExPred, [M5WriteA1X]>,
  174. SchedVar<NoSchedPred, [M5WriteAAX]>]>;
  175. def M5WriteAYW : SchedWriteVariant<[SchedVar<ExynosRotateRightImmPred, [M5WriteA1W]>,
  176. SchedVar<NoSchedPred, [M5WriteAFW]>]>;
  177. def M5WriteAYX : SchedWriteVariant<[SchedVar<ExynosRotateRightImmPred, [M5WriteA1X]>,
  178. SchedVar<NoSchedPred, [M5WriteAFX]>]>;
  179. def M5WriteB1 : SchedWriteRes<[M5UnitB]> { let Latency = 1; }
  180. def M5WriteBX : SchedWriteVariant<[SchedVar<ExynosBranchLinkLRPred, [M5WriteAC]>,
  181. SchedVar<NoSchedPred, [M5WriteAB]>]>;
  182. def M5WriteC1 : SchedWriteRes<[M5UnitC]> { let Latency = 1; }
  183. def M5WriteC2 : SchedWriteRes<[M5UnitC]> { let Latency = 2; }
  184. def M5WriteCA : SchedWriteRes<[M5UnitC]> { let Latency = 3;
  185. let ResourceCycles = [2]; }
  186. def M5WriteD10 : SchedWriteRes<[M5UnitD]> { let Latency = 10;
  187. let ResourceCycles = [10]; }
  188. def M5WriteD16 : SchedWriteRes<[M5UnitD]> { let Latency = 16;
  189. let ResourceCycles = [16]; }
  190. def M5WriteF2 : SchedWriteRes<[M5UnitF]> { let Latency = 2; }
  191. def M5WriteL4 : SchedWriteRes<[M5UnitL]> { let Latency = 4; }
  192. def M5WriteL5 : SchedWriteRes<[M5UnitL]> { let Latency = 5; }
  193. def M5WriteL6 : SchedWriteRes<[M5UnitL]> { let Latency = 6; }
  194. def M5WriteLA : SchedWriteRes<[M5UnitL,
  195. M5UnitL]> { let Latency = 6;
  196. let NumMicroOps = 1; }
  197. def M5WriteLB : SchedWriteRes<[M5UnitAX,
  198. M5UnitL]> { let Latency = 6;
  199. let NumMicroOps = 2; }
  200. def M5WriteLC : SchedWriteRes<[M5UnitAX,
  201. M5UnitL,
  202. M5UnitL]> { let Latency = 6;
  203. let NumMicroOps = 2; }
  204. def M5WriteLD : SchedWriteRes<[M5UnitAX,
  205. M5UnitL]> { let Latency = 4;
  206. let NumMicroOps = 2; }
  207. def M5WriteLE : SchedWriteRes<[M5UnitAX,
  208. M5UnitL]> { let Latency = 7;
  209. let NumMicroOps = 2; }
  210. def M5WriteLFW : SchedWriteRes<[M5UnitAW,
  211. M5UnitAW,
  212. M5UnitAW,
  213. M5UnitAW,
  214. M5UnitL]> { let Latency = 15;
  215. let NumMicroOps = 6;
  216. let ResourceCycles = [1, 1, 1, 1, 15]; }
  217. def M5WriteLFX : SchedWriteRes<[M5UnitAX,
  218. M5UnitAX,
  219. M5UnitAX,
  220. M5UnitAX,
  221. M5UnitL]> { let Latency = 15;
  222. let NumMicroOps = 6;
  223. let ResourceCycles = [1, 1, 1, 1, 15]; }
  224. def M5WriteLGW : SchedWriteRes<[M5UnitAW,
  225. M5UnitL]> { let Latency = 13;
  226. let NumMicroOps = 1;
  227. let ResourceCycles = [1, 13]; }
  228. def M5WriteLGX : SchedWriteRes<[M5UnitAX,
  229. M5UnitL]> { let Latency = 13;
  230. let NumMicroOps = 1;
  231. let ResourceCycles = [1, 13]; }
  232. def M5WriteLH : SchedWriteRes<[]> { let Latency = 6;
  233. let NumMicroOps = 0; }
  234. def M5WriteLX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M5WriteL5]>,
  235. SchedVar<NoSchedPred, [M5WriteL4]>]>;
  236. def M5WriteLY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M5WriteLE]>,
  237. SchedVar<NoSchedPred, [M5WriteL6]>]>;
  238. def M5WriteS1 : SchedWriteRes<[M5UnitS]> { let Latency = 1; }
  239. def M5WriteSA : SchedWriteRes<[M5UnitS0]> { let Latency = 4; }
  240. def M5WriteSB : SchedWriteRes<[M5UnitAX,
  241. M5UnitS]> { let Latency = 2;
  242. let NumMicroOps = 1; }
  243. def M5WriteSX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M5WriteSB]>,
  244. SchedVar<NoSchedPred, [M5WriteS1]>]>;
  245. def M5ReadAdrBase : SchedReadVariant<[SchedVar<
  246. MCSchedPredicate<
  247. CheckAny<
  248. [ScaledIdxFn,
  249. ExynosScaledIdxFn]>>, [ReadDefault]>,
  250. SchedVar<NoSchedPred, [ReadDefault]>]>;
  251. def M5WriteNEONB : SchedWriteRes<[M5UnitNALU,
  252. M5UnitS0]> { let Latency = 5;
  253. let NumMicroOps = 2; }
  254. def M5WriteNEONH : SchedWriteRes<[M5UnitNALU,
  255. M5UnitS0]> { let Latency = 2;
  256. let NumMicroOps = 2; }
  257. def M5WriteNEONI : SchedWriteRes<[M5UnitS0,
  258. M5UnitNSHF]> { let Latency = 6;
  259. let NumMicroOps = 2; }
  260. def M5WriteNEONK : SchedWriteRes<[M5UnitNSHF,
  261. M5UnitFCVT0,
  262. M5UnitS0]> { let Latency = 5;
  263. let NumMicroOps = 2; }
  264. def M5WriteNEONN : SchedWriteRes<[M5UnitNMSC,
  265. M5UnitNMSC]> { let Latency = 5;
  266. let NumMicroOps = 2;
  267. let ResourceCycles = [7, 7]; }
  268. def M5WriteNEONO : SchedWriteRes<[M5UnitNMSC,
  269. M5UnitNMSC,
  270. M5UnitNMSC]> { let Latency = 8;
  271. let NumMicroOps = 3;
  272. let ResourceCycles = [10, 10, 10]; }
  273. def M5WriteNEONP : SchedWriteRes<[M5UnitNSHF,
  274. M5UnitS0,
  275. M5UnitFCVT]> { let Latency = 7;
  276. let NumMicroOps = 2; }
  277. def M5WriteNEONQ : SchedWriteRes<[M5UnitNMSC,
  278. M5UnitC]> { let Latency = 3;
  279. let NumMicroOps = 1; }
  280. def M5WriteNEONU : SchedWriteRes<[M5UnitFSQR,
  281. M5UnitFSQR]> { let Latency = 7;
  282. let ResourceCycles = [4, 4]; }
  283. def M5WriteNEONV : SchedWriteRes<[M5UnitFDIV,
  284. M5UnitFDIV]> { let Latency = 7;
  285. let ResourceCycles = [6, 6]; }
  286. def M5WriteNEONW : SchedWriteRes<[M5UnitFDIV,
  287. M5UnitFDIV]> { let Latency = 12;
  288. let ResourceCycles = [9, 9]; }
  289. def M5WriteNEONX : SchedWriteRes<[M5UnitFSQR,
  290. M5UnitFSQR]> { let Latency = 8;
  291. let ResourceCycles = [5, 5]; }
  292. def M5WriteNEONY : SchedWriteRes<[M5UnitFSQR,
  293. M5UnitFSQR]> { let Latency = 12;
  294. let ResourceCycles = [9, 9]; }
  295. def M5WriteNEONZ : SchedWriteVariant<[SchedVar<ExynosQFormPred, [M5WriteNEONO]>,
  296. SchedVar<NoSchedPred, [M5WriteNEONN]>]>;
  297. def M5WriteFADD2 : SchedWriteRes<[M5UnitFADD]> { let Latency = 2; }
  298. def M5WriteFCVT2 : SchedWriteRes<[M5UnitFCVT]> { let Latency = 2; }
  299. def M5WriteFCVT2A : SchedWriteRes<[M5UnitFCVT0]> { let Latency = 2; }
  300. def M5WriteFCVT3 : SchedWriteRes<[M5UnitFCVT]> { let Latency = 3; }
  301. def M5WriteFCVT3A : SchedWriteRes<[M5UnitFCVT0]> { let Latency = 3; }
  302. def M5WriteFCVTA : SchedWriteRes<[M5UnitFCVT0,
  303. M5UnitS0]> { let Latency = 3;
  304. let NumMicroOps = 1; }
  305. def M5WriteFCVTB : SchedWriteRes<[M5UnitFCVT,
  306. M5UnitS0]> { let Latency = 4;
  307. let NumMicroOps = 1; }
  308. def M5WriteFCVTC : SchedWriteRes<[M5UnitFCVT,
  309. M5UnitS0]> { let Latency = 6;
  310. let NumMicroOps = 1; }
  311. def M5WriteFDIV5 : SchedWriteRes<[M5UnitFDIV]> { let Latency = 5;
  312. let ResourceCycles = [2]; }
  313. def M5WriteFDIV7 : SchedWriteRes<[M5UnitFDIV]> { let Latency = 7;
  314. let ResourceCycles = [4]; }
  315. def M5WriteFDIV12 : SchedWriteRes<[M5UnitFDIV]> { let Latency = 12;
  316. let ResourceCycles = [9]; }
  317. def M5WriteFMAC3 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 3; }
  318. def M5WriteFMAC4 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 4; }
  319. def M5WriteFMAC5 : SchedWriteRes<[M5UnitFMAC]> { let Latency = 5; }
  320. def M5WriteFSQR5 : SchedWriteRes<[M5UnitFSQR]> { let Latency = 5;
  321. let ResourceCycles = [2]; }
  322. def M5WriteFSQR7 : SchedWriteRes<[M5UnitFSQR]> { let Latency = 7;
  323. let ResourceCycles = [4]; }
  324. def M5WriteFSQR8 : SchedWriteRes<[M5UnitFSQR]> { let Latency = 8;
  325. let ResourceCycles = [5]; }
  326. def M5WriteFSQR12 : SchedWriteRes<[M5UnitFSQR]> { let Latency = 12;
  327. let ResourceCycles = [9]; }
  328. def M5WriteNALU1 : SchedWriteRes<[M5UnitNALU]> { let Latency = 1; }
  329. def M5WriteNALU2 : SchedWriteRes<[M5UnitNALU]> { let Latency = 2; }
  330. def M5WriteNDOT2 : SchedWriteRes<[M5UnitNDOT]> { let Latency = 2; }
  331. def M5WriteNCRY2 : SchedWriteRes<[M5UnitNCRY]> { let Latency = 2; }
  332. def M5WriteNCRY1A : SchedWriteRes<[M5UnitNCRY0]> { let Latency = 1; }
  333. def M5WriteNCRY2A : SchedWriteRes<[M5UnitNCRY0]> { let Latency = 2; }
  334. def M5WriteNCRY3A : SchedWriteRes<[M5UnitNCRY0]> { let Latency = 3; }
  335. def M5WriteNCRY5A : SchedWriteRes<[M5UnitNCRY]> { let Latency = 5; }
  336. def M5WriteNHAD1 : SchedWriteRes<[M5UnitNHAD]> { let Latency = 1; }
  337. def M5WriteNHAD3 : SchedWriteRes<[M5UnitNHAD]> { let Latency = 3; }
  338. def M5WriteNMSC1 : SchedWriteRes<[M5UnitNMSC]> { let Latency = 1; }
  339. def M5WriteNMSC2 : SchedWriteRes<[M5UnitNMSC]> { let Latency = 2; }
  340. def M5WriteNMUL3 : SchedWriteRes<[M5UnitNMUL]> { let Latency = 3; }
  341. def M5WriteNSHF1 : SchedWriteRes<[M5UnitNSHF]> { let Latency = 1; }
  342. def M5WriteNSHF2 : SchedWriteRes<[M5UnitNSHF]> { let Latency = 2; }
  343. def M5WriteNSHFA : SchedWriteRes<[M5UnitNSHF]> { let Latency = 2; }
  344. def M5WriteNSHFB : SchedWriteRes<[M5UnitNSHF]> { let Latency = 4;
  345. let NumMicroOps = 2; }
  346. def M5WriteNSHFC : SchedWriteRes<[M5UnitNSHF]> { let Latency = 6;
  347. let NumMicroOps = 3; }
  348. def M5WriteNSHFD : SchedWriteRes<[M5UnitNSHF]> { let Latency = 8;
  349. let NumMicroOps = 4; }
  350. def M5WriteNSHT2 : SchedWriteRes<[M5UnitNSHT]> { let Latency = 2; }
  351. def M5WriteNSHT4A : SchedWriteRes<[M5UnitNSHT1]> { let Latency = 4; }
  352. def M5WriteVLDA : SchedWriteRes<[M5UnitL,
  353. M5UnitL]> { let Latency = 6;
  354. let NumMicroOps = 2; }
  355. def M5WriteVLDB : SchedWriteRes<[M5UnitL,
  356. M5UnitL,
  357. M5UnitL]> { let Latency = 7;
  358. let NumMicroOps = 3; }
  359. def M5WriteVLDC : SchedWriteRes<[M5UnitL,
  360. M5UnitL,
  361. M5UnitL,
  362. M5UnitL]> { let Latency = 7;
  363. let NumMicroOps = 4; }
  364. def M5WriteVLDD : SchedWriteRes<[M5UnitL,
  365. M5UnitNSHF]> { let Latency = 7;
  366. let NumMicroOps = 2;
  367. let ResourceCycles = [2, 1]; }
  368. def M5WriteVLDF : SchedWriteRes<[M5UnitL,
  369. M5UnitL]> { let Latency = 11;
  370. let NumMicroOps = 2;
  371. let ResourceCycles = [6, 5]; }
  372. def M5WriteVLDG : SchedWriteRes<[M5UnitL,
  373. M5UnitNSHF,
  374. M5UnitNSHF]> { let Latency = 7;
  375. let NumMicroOps = 3;
  376. let ResourceCycles = [2, 1, 1]; }
  377. def M5WriteVLDI : SchedWriteRes<[M5UnitL,
  378. M5UnitL,
  379. M5UnitL]> { let Latency = 13;
  380. let NumMicroOps = 3; }
  381. def M5WriteVLDJ : SchedWriteRes<[M5UnitL,
  382. M5UnitNSHF,
  383. M5UnitNSHF,
  384. M5UnitNSHF]> { let Latency = 8;
  385. let NumMicroOps = 4; }
  386. def M5WriteVLDK : SchedWriteRes<[M5UnitL,
  387. M5UnitNSHF,
  388. M5UnitNSHF,
  389. M5UnitNSHF,
  390. M5UnitNSHF]> { let Latency = 8;
  391. let NumMicroOps = 5; }
  392. def M5WriteVLDL : SchedWriteRes<[M5UnitL,
  393. M5UnitNSHF,
  394. M5UnitNSHF,
  395. M5UnitL,
  396. M5UnitNSHF]> { let Latency = 8;
  397. let NumMicroOps = 5; }
  398. def M5WriteVLDM : SchedWriteRes<[M5UnitL,
  399. M5UnitNSHF,
  400. M5UnitNSHF,
  401. M5UnitL,
  402. M5UnitNSHF,
  403. M5UnitNSHF]> { let Latency = 8;
  404. let NumMicroOps = 6; }
  405. def M5WriteVLDN : SchedWriteRes<[M5UnitL,
  406. M5UnitL,
  407. M5UnitL,
  408. M5UnitL]> { let Latency = 15;
  409. let NumMicroOps = 4;
  410. let ResourceCycles = [2, 2, 2, 2]; }
  411. def M5WriteVST1 : SchedWriteRes<[M5UnitS,
  412. M5UnitFST]> { let Latency = 1;
  413. let NumMicroOps = 1; }
  414. def M5WriteVSTA : SchedWriteRes<[M5UnitS,
  415. M5UnitFST,
  416. M5UnitS,
  417. M5UnitFST]> { let Latency = 2;
  418. let NumMicroOps = 2; }
  419. def M5WriteVSTB : SchedWriteRes<[M5UnitS,
  420. M5UnitFST,
  421. M5UnitS,
  422. M5UnitFST,
  423. M5UnitS,
  424. M5UnitFST]> { let Latency = 3;
  425. let NumMicroOps = 3; }
  426. def M5WriteVSTC : SchedWriteRes<[M5UnitS,
  427. M5UnitFST,
  428. M5UnitS,
  429. M5UnitFST,
  430. M5UnitS,
  431. M5UnitFST,
  432. M5UnitS,
  433. M5UnitFST]> { let Latency = 4;
  434. let NumMicroOps = 4; }
  435. def M5WriteVSTD : SchedWriteRes<[M5UnitS,
  436. M5UnitFST]> { let Latency = 2; }
  437. def M5WriteVSTE : SchedWriteRes<[M5UnitS,
  438. M5UnitFST,
  439. M5UnitS,
  440. M5UnitFST]> { let Latency = 2;
  441. let NumMicroOps = 1; }
  442. def M5WriteVSTF : SchedWriteRes<[M5UnitNSHF,
  443. M5UnitNSHF,
  444. M5UnitS,
  445. M5UnitFST]> { let Latency = 4;
  446. let NumMicroOps = 3; }
  447. def M5WriteVSTG : SchedWriteRes<[M5UnitNSHF,
  448. M5UnitNSHF,
  449. M5UnitNSHF,
  450. M5UnitS,
  451. M5UnitFST,
  452. M5UnitS,
  453. M5UnitFST]> { let Latency = 4;
  454. let NumMicroOps = 5; }
  455. def M5WriteVSTH : SchedWriteRes<[M5UnitS0,
  456. M5UnitFST]> { let Latency = 1;
  457. let NumMicroOps = 1; }
  458. def M5WriteVSTI : SchedWriteRes<[M5UnitNSHF,
  459. M5UnitNSHF,
  460. M5UnitNSHF,
  461. M5UnitNSHF,
  462. M5UnitS,
  463. M5UnitFST,
  464. M5UnitS,
  465. M5UnitFST,
  466. M5UnitS,
  467. M5UnitFST,
  468. M5UnitS,
  469. M5UnitFST]> { let Latency = 8;
  470. let NumMicroOps = 5;
  471. let ResourceCycles = [1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1]; }
  472. def M5WriteVSTJ : SchedWriteRes<[M5UnitA,
  473. M5UnitS0,
  474. M5UnitFST]> { let Latency = 1;
  475. let NumMicroOps = 1; }
  476. def M5WriteVSTK : SchedWriteRes<[M5UnitAX,
  477. M5UnitS,
  478. M5UnitFST]> { let Latency = 3;
  479. let NumMicroOps = 2; }
  480. def M5WriteVSTL : SchedWriteRes<[M5UnitNSHF,
  481. M5UnitNSHF,
  482. M5UnitS,
  483. M5UnitFST,
  484. M5UnitS,
  485. M5UnitFST]> { let Latency = 4;
  486. let NumMicroOps = 4;
  487. let ResourceCycles = [1, 1, 2, 1, 2, 1]; }
  488. def M5WriteVSTY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M5WriteVSTK]>,
  489. SchedVar<NoSchedPred, [WriteVST]>]>;
  490. // Special cases.
  491. def M5WriteCOPY : SchedWriteVariant<[SchedVar<ExynosFPPred, [M5WriteNALU2]>,
  492. SchedVar<NoSchedPred, [M5WriteZ0]>]>;
  493. def M5WriteMOVI : SchedWriteVariant<[SchedVar<IsZeroFPIdiomPred, [M5WriteZ0]>,
  494. SchedVar<NoSchedPred, [M5WriteNALU1]>]>;
  495. // Fast forwarding.
  496. def M5ReadFM1 : SchedReadAdvance<+1, [M5WriteF2]>;
  497. def M5ReadAESM2 : SchedReadAdvance<+2, [M5WriteNCRY2]>;
  498. def M5ReadFMACM1 : SchedReadAdvance<+1, [M5WriteFMAC4,
  499. M5WriteFMAC5]>;
  500. def M5ReadNMULM1 : SchedReadAdvance<+1, [M5WriteNMUL3]>;
  501. //===----------------------------------------------------------------------===//
  502. // Coarse scheduling model.
  503. // Branch instructions.
  504. def : SchedAlias<WriteBr, M5WriteZ0>;
  505. def : SchedAlias<WriteBrReg, M5WriteC1>;
  506. // Arithmetic and logical integer instructions.
  507. def : SchedAlias<WriteI, M5WriteA1W>;
  508. def : SchedAlias<WriteIEReg, M5WriteA1W>; // FIXME: M5WriteAX crashes TableGen.
  509. def : SchedAlias<WriteISReg, M5WriteA1W>; // FIXME: M5WriteAX crashes TableGen.
  510. def : SchedAlias<WriteIS, M5WriteA1W>;
  511. // Move instructions.
  512. def : SchedAlias<WriteImm, M5WriteA1W>;
  513. // Divide and multiply instructions.
  514. def : SchedAlias<WriteID32, M5WriteD10>;
  515. def : SchedAlias<WriteID64, M5WriteD16>;
  516. def : SchedAlias<WriteIM32, M5WriteC2>;
  517. def : SchedAlias<WriteIM64, M5WriteCA>;
  518. // Miscellaneous instructions.
  519. def : SchedAlias<WriteExtr, M5WriteAYW>;
  520. // Addressing modes.
  521. def : SchedAlias<WriteAdr, M5WriteZ1>;
  522. def : SchedAlias<ReadAdrBase, M5ReadAdrBase>;
  523. // Load instructions.
  524. def : SchedAlias<WriteLD, M5WriteL4>;
  525. def : SchedAlias<WriteLDHi, M5WriteZ4>;
  526. def : SchedAlias<WriteLDIdx, M5WriteLX>;
  527. // Store instructions.
  528. def : SchedAlias<WriteST, M5WriteS1>;
  529. def : SchedAlias<WriteSTP, M5WriteS1>;
  530. def : SchedAlias<WriteSTX, M5WriteS1>;
  531. def : SchedAlias<WriteSTIdx, M5WriteSX>;
  532. // Atomic load and store instructions.
  533. def : SchedAlias<WriteAtomic, M5WriteLGW>;
  534. // FP data instructions.
  535. def : SchedAlias<WriteF, M5WriteFADD2>;
  536. def : SchedAlias<WriteFCmp, M5WriteNMSC2>;
  537. def : SchedAlias<WriteFDiv, M5WriteFDIV12>;
  538. def : SchedAlias<WriteFMul, M5WriteFMAC3>;
  539. // FP miscellaneous instructions.
  540. def : SchedAlias<WriteFCvt, M5WriteFCVT2>;
  541. def : SchedAlias<WriteFImm, M5WriteNALU1>;
  542. def : SchedAlias<WriteFCopy, M5WriteNALU2>;
  543. // FP load instructions.
  544. def : SchedAlias<WriteVLD, M5WriteL6>;
  545. // FP store instructions.
  546. def : SchedAlias<WriteVST, M5WriteVST1>;
  547. // ASIMD FP instructions.
  548. def : SchedAlias<WriteVd, M5WriteNALU1>;
  549. def : SchedAlias<WriteVq, M5WriteNALU1>;
  550. // Other miscellaneous instructions.
  551. def : WriteRes<WriteBarrier, []> { let Latency = 1; }
  552. def : WriteRes<WriteHint, []> { let Latency = 1; }
  553. def : WriteRes<WriteSys, []> { let Latency = 1; }
  554. //===----------------------------------------------------------------------===//
  555. // Generic fast forwarding.
  556. // TODO: Add FP register forwarding rules.
  557. def : ReadAdvance<ReadI, 0>;
  558. def : ReadAdvance<ReadISReg, 0>;
  559. def : ReadAdvance<ReadIEReg, 0>;
  560. def : ReadAdvance<ReadIM, 0>;
  561. // TODO: The forwarding for 32 bits actually saves 2 cycles.
  562. def : ReadAdvance<ReadIMA, 3, [WriteIM32, WriteIM64]>;
  563. def : ReadAdvance<ReadID, 0>;
  564. def : ReadAdvance<ReadExtrHi, 0>;
  565. def : ReadAdvance<ReadAdrBase, 0>;
  566. def : ReadAdvance<ReadVLD, 0>;
  567. def : ReadAdvance<ReadST, 0>;
  568. //===----------------------------------------------------------------------===//
  569. // Finer scheduling model.
  570. // Branch instructions
  571. def : InstRW<[M5WriteB1], (instrs Bcc)>;
  572. def : InstRW<[M5WriteAFX], (instrs BL)>;
  573. def : InstRW<[M5WriteBX], (instrs BLR)>;
  574. def : InstRW<[M5WriteC1], (instregex "^CBN?Z[WX]")>;
  575. def : InstRW<[M5WriteAD], (instregex "^TBN?ZW")>;
  576. def : InstRW<[M5WriteAB], (instregex "^TBN?ZX")>;
  577. // Arithmetic and logical integer instructions.
  578. def : InstRW<[M5WriteA1W], (instregex "^(ADC|SBC)S?Wr$")>;
  579. def : InstRW<[M5WriteA1X], (instregex "^(ADC|SBC)S?Xr$")>;
  580. def : InstRW<[M5WriteAXW], (instregex "^(ADD|AND|BIC|EON|EOR|ORN|SUB)Wrs$")>;
  581. def : InstRW<[M5WriteAXX], (instregex "^(ADD|AND|BIC|EON|EOR|ORN|SUB)Xrs$")>;
  582. def : InstRW<[M5WriteAUW], (instrs ORRWrs)>;
  583. def : InstRW<[M5WriteAUX], (instrs ORRXrs)>;
  584. def : InstRW<[M5WriteAXW], (instregex "^(ADD|AND|BIC|SUB)SWrs$")>;
  585. def : InstRW<[M5WriteAXX], (instregex "^(ADD|AND|BIC|SUB)SXrs$")>;
  586. def : InstRW<[M5WriteAXW], (instregex "^(ADD|SUB)S?Wrx(64)?$")>;
  587. def : InstRW<[M5WriteAXX], (instregex "^(ADD|SUB)S?Xrx(64)?$")>;
  588. def : InstRW<[M5WriteAVW], (instrs ADDWri, ORRWri)>;
  589. def : InstRW<[M5WriteAVX], (instrs ADDXri, ORRXri)>;
  590. def : InstRW<[M5WriteA1W], (instregex "^CCM[NP]W[ir]$")>;
  591. def : InstRW<[M5WriteA1X], (instregex "^CCM[NP]X[ir]$")>;
  592. def : InstRW<[M5WriteA1W], (instrs CSELWr, CSINCWr, CSINVWr, CSNEGWr)>;
  593. def : InstRW<[M5WriteA1X], (instrs CSELXr, CSINCXr, CSINVXr, CSNEGXr)>;
  594. // Move instructions.
  595. def : InstRW<[M5WriteCOPY], (instrs COPY)>;
  596. def : InstRW<[M5WriteZ0], (instrs ADR, ADRP)>;
  597. def : InstRW<[M5WriteZ0], (instregex "^MOV[NZ][WX]i$")>;
  598. // Shift instructions.
  599. def : InstRW<[M5WriteA1W], (instrs ASRVWr, LSLVWr, LSRVWr, RORVWr)>;
  600. def : InstRW<[M5WriteA1X], (instrs ASRVXr, LSLVXr, LSRVXr, RORVXr)>;
  601. // Miscellaneous instructions.
  602. def : InstRW<[M5WriteAYW], (instrs EXTRWrri)>;
  603. def : InstRW<[M5WriteAYX], (instrs EXTRXrri)>;
  604. def : InstRW<[M5WriteA1W], (instrs BFMWri, SBFMWri, UBFMWri)>;
  605. def : InstRW<[M5WriteA1X], (instrs BFMXri, SBFMXri, UBFMXri)>;
  606. def : InstRW<[M5WriteA1W], (instrs CLSWr, CLZWr)>;
  607. def : InstRW<[M5WriteA1X], (instrs CLSXr, CLZXr)>;
  608. def : InstRW<[M5WriteA1W], (instrs RBITWr, REVWr, REV16Wr)>;
  609. def : InstRW<[M5WriteA1X], (instrs RBITXr, REVXr, REV16Xr, REV32Xr)>;
  610. // Load instructions.
  611. def : InstRW<[M5WriteLD,
  612. WriteLDHi,
  613. WriteAdr], (instregex "^LDP(SW|W|X)(post|pre)")>;
  614. def : InstRW<[M5WriteL5,
  615. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roW")>;
  616. def : InstRW<[WriteLDIdx,
  617. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roX")>;
  618. def : InstRW<[M5WriteL5,
  619. ReadAdrBase], (instrs PRFMroW)>;
  620. def : InstRW<[WriteLDIdx,
  621. ReadAdrBase], (instrs PRFMroX)>;
  622. // Store instructions.
  623. def : InstRW<[M5WriteSB,
  624. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roW")>;
  625. def : InstRW<[WriteST,
  626. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roX")>;
  627. // Atomic load and store instructions.
  628. def : InstRW<[M5WriteLGW], (instregex "^CAS(A|AL|L)?[BHW]$")>;
  629. def : InstRW<[M5WriteLGX], (instregex "^CAS(A|AL|L)?X$")>;
  630. def : InstRW<[M5WriteLFW], (instregex "^CASP(A|AL|L)?W$")>;
  631. def : InstRW<[M5WriteLFX], (instregex "^CASP(A|AL|L)?X$")>;
  632. def : InstRW<[M5WriteLGW], (instregex "^LD(ADD|CLR|EOR|SET|[SU]MAX|[SU]MIN)(A|AL|L)?[BHW]$")>;
  633. def : InstRW<[M5WriteLGX], (instregex "^LD(ADD|CLR|EOR|SET|[SU]MAX|[SU]MIN)(A|AL|L)?X$")>;
  634. def : InstRW<[M5WriteLGW], (instregex "^SWP(A|AL|L)?[BHW]$")>;
  635. def : InstRW<[M5WriteLGX], (instregex "^SWP(A|AL|L)?X$")>;
  636. // FP data instructions.
  637. def : InstRW<[M5WriteNSHF1], (instrs FABSHr, FABSSr,FABSDr)>;
  638. def : InstRW<[M5WriteFADD2], (instregex "^F(ADD|SUB)[HSD]rr")>;
  639. def : InstRW<[M5WriteFADD2], (instregex "^FADDPv.i(16|32|64)")>;
  640. def : InstRW<[M5WriteNEONQ], (instregex "^FCCMPE?[HSD]rr")>;
  641. def : InstRW<[M5WriteNMSC2], (instregex "^FCMPE?[HSD]r[ir]")>;
  642. def : InstRW<[M5WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)(16|32|64|v1)")>;
  643. def : InstRW<[M5WriteFDIV5], (instrs FDIVHrr)>;
  644. def : InstRW<[M5WriteFDIV7], (instrs FDIVSrr)>;
  645. def : InstRW<[M5WriteFDIV12], (instrs FDIVDrr)>;
  646. def : InstRW<[M5WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?[HSD]rr")>;
  647. def : InstRW<[M5WriteFMAC3], (instregex "^FN?MUL[HSD]rr")>;
  648. def : InstRW<[M5WriteFMAC3], (instrs FMULX16, FMULX32, FMULX64)>;
  649. def : InstRW<[M5WriteFMAC4,
  650. M5ReadFMACM1], (instregex "^FN?M(ADD|SUB)[HSD]rrr")>;
  651. def : InstRW<[M5WriteNALU2], (instrs FNEGHr, FNEGSr, FNEGDr)>;
  652. def : InstRW<[M5WriteFCVT3A], (instregex "^FRINT.+r")>;
  653. def : InstRW<[M5WriteNEONH], (instregex "^FCSEL[HSD]rrr")>;
  654. def : InstRW<[M5WriteFSQR5], (instrs FSQRTHr)>;
  655. def : InstRW<[M5WriteFSQR8], (instrs FSQRTSr)>;
  656. def : InstRW<[M5WriteFSQR12], (instrs FSQRTDr)>;
  657. // FP miscellaneous instructions.
  658. def : InstRW<[M5WriteFCVT2], (instregex "^FCVT[HSD][HSD]r")>;
  659. def : InstRW<[M5WriteFCVTC], (instregex "^[SU]CVTF[SU][XW][HSD]ri")>;
  660. def : InstRW<[M5WriteFCVTB], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>;
  661. def : InstRW<[M5WriteNALU1], (instregex "^FMOV[HSD]i")>;
  662. def : InstRW<[M5WriteNALU2], (instregex "^FMOV[HSD]r")>;
  663. def : InstRW<[M5WriteSA], (instregex "^FMOV[WX][HSD]r")>;
  664. def : InstRW<[M5WriteFCVTA], (instregex "^FMOV[HSD][WX]r")>;
  665. def : InstRW<[M5WriteNEONI], (instregex "^FMOVXDHighr")>;
  666. def : InstRW<[M5WriteNEONK], (instregex "^FMOVDXHighr")>;
  667. def : InstRW<[M5WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev1(f16|i32|i64)")>;
  668. def : InstRW<[M5WriteNMSC1], (instregex "^FRECPXv1")>;
  669. def : InstRW<[M5WriteFMAC4], (instregex "^F(RECP|RSQRT)S(16|32|64)")>;
  670. // FP load instructions.
  671. def : InstRW<[WriteVLD], (instregex "^LDR[SDQ]l")>;
  672. def : InstRW<[WriteVLD], (instregex "^LDUR[BHSDQ]i")>;
  673. def : InstRW<[WriteVLD,
  674. WriteAdr], (instregex "^LDR[BHSDQ](post|pre)")>;
  675. def : InstRW<[WriteVLD], (instregex "^LDR[BHSDQ]ui")>;
  676. def : InstRW<[M5WriteLE,
  677. ReadAdrBase], (instregex "^LDR[BHSDQ]roW")>;
  678. def : InstRW<[WriteVLD,
  679. ReadAdrBase], (instregex "^LDR[BHSD]roX")>;
  680. def : InstRW<[M5WriteLY,
  681. ReadAdrBase], (instrs LDRQroX)>;
  682. def : InstRW<[WriteVLD,
  683. M5WriteLH], (instregex "^LDN?P[SD]i")>;
  684. def : InstRW<[M5WriteLA,
  685. M5WriteLH], (instregex "^LDN?PQi")>;
  686. def : InstRW<[M5WriteLB,
  687. M5WriteLH,
  688. WriteAdr], (instregex "^LDP[SD](post|pre)")>;
  689. def : InstRW<[M5WriteLC,
  690. M5WriteLH,
  691. WriteAdr], (instregex "^LDPQ(post|pre)")>;
  692. // FP store instructions.
  693. def : InstRW<[WriteVST], (instregex "^STUR[BHSDQ]i")>;
  694. def : InstRW<[WriteVST,
  695. WriteAdr], (instregex "^STR[BHSDQ](post|pre)")>;
  696. def : InstRW<[WriteVST], (instregex "^STR[BHSDQ]ui")>;
  697. def : InstRW<[WriteVST,
  698. ReadAdrBase], (instregex "^STR[BHSD]ro[WX]")>;
  699. def : InstRW<[M5WriteVSTK,
  700. ReadAdrBase], (instregex "^STRQroW")>;
  701. def : InstRW<[M5WriteVSTY,
  702. ReadAdrBase], (instregex "^STRQroX")>;
  703. def : InstRW<[WriteVST], (instregex "^STN?P[SD]i")>;
  704. def : InstRW<[M5WriteVSTH], (instregex "^STN?PQi")>;
  705. def : InstRW<[WriteVST,
  706. WriteAdr], (instregex "^STP[SD](post|pre)")>;
  707. def : InstRW<[M5WriteVSTJ,
  708. WriteAdr], (instregex "^STPQ(post|pre)")>;
  709. // ASIMD instructions.
  710. def : InstRW<[M5WriteNHAD1], (instregex "^[SU]ABDL?v")>;
  711. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]ABAL?v")>;
  712. def : InstRW<[M5WriteNMSC1], (instregex "^ABSv")>;
  713. def : InstRW<[M5WriteNALU2], (instregex "^(ADD|NEG|SUB)v")>;
  714. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]?ADDL?Pv")>;
  715. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]H(ADD|SUB)v")>;
  716. def : InstRW<[M5WriteNHAD3], (instregex "^[SU](ADD|SUB)[LW]v")>;
  717. def : InstRW<[M5WriteNHAD3], (instregex "^R?(ADD|SUB)HN2?v")>;
  718. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]Q(ADD|SUB)v")>;
  719. def : InstRW<[M5WriteNHAD3], (instregex "^(SU|US)QADDv")>;
  720. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]RHADDv")>;
  721. def : InstRW<[M5WriteNMSC1], (instregex "^SQ(ABS|NEG)v")>;
  722. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]?ADDL?Vv")>;
  723. def : InstRW<[M5WriteNMSC1], (instregex "^CM(EQ|GE|GT|HI|HS|LE|LT)v")>;
  724. def : InstRW<[M5WriteNALU2], (instregex "^CMTSTv")>;
  725. def : InstRW<[M5WriteNALU2], (instregex "^(AND|BIC|EOR|NOT|ORN|ORR)v")>;
  726. def : InstRW<[M5WriteNMSC1], (instregex "^[SU](MIN|MAX)v")>;
  727. def : InstRW<[M5WriteNMSC2], (instregex "^[SU](MIN|MAX)Pv")>;
  728. def : InstRW<[M5WriteNHAD3], (instregex "^[SU](MIN|MAX)Vv")>;
  729. def : InstRW<[M5WriteNMUL3], (instregex "^(SQR?D)?MULH?v")>;
  730. def : InstRW<[M5WriteNMUL3,
  731. M5ReadNMULM1], (instregex "^ML[AS]v")>;
  732. def : InstRW<[M5WriteNMUL3,
  733. M5ReadNMULM1], (instregex "^SQRDML[AS]H")>;
  734. def : InstRW<[M5WriteNMUL3], (instregex "^(S|U|SQD)ML[AS]L(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  735. def : InstRW<[M5WriteNMUL3,
  736. M5ReadNMULM1], (instregex "^(S|U|SQD)ML[AS]L(v4i32|v8i16|v16i8)")>;
  737. def : InstRW<[M5WriteNMUL3,
  738. M5ReadNMULM1], (instregex "^(S|U|SQD)MULL(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  739. def : InstRW<[M5WriteNMUL3,
  740. M5ReadNMULM1], (instregex "^(S|U|SQD)MULL(v4i32|v8i16|v16i8)")>;
  741. def : InstRW<[M5WriteNDOT2], (instregex "^[SU]DOT(lane)?v")>;
  742. def : InstRW<[M5WriteNHAD3], (instregex "^[SU]ADALPv")>;
  743. def : InstRW<[M5WriteNSHT4A], (instregex "^[SU]R?SRA[dv]")>;
  744. def : InstRW<[M5WriteNSHT2], (instregex "^SHL[dv]")>;
  745. def : InstRW<[M5WriteNSHT2], (instregex "^S[LR]I[dv]")>;
  746. def : InstRW<[M5WriteNSHT2], (instregex "^[SU]SH[LR][dv]")>;
  747. def : InstRW<[M5WriteNSHT2], (instregex "^[SU]?SHLLv")>;
  748. def : InstRW<[M5WriteNSHT4A], (instregex "^[SU]?Q?R?SHRU?N[bhsv]")>;
  749. def : InstRW<[M5WriteNSHT4A], (instregex "^[SU]RSH[LR][dv]")>;
  750. def : InstRW<[M5WriteNSHT4A], (instregex "^[SU]QR?SHLU?[bhsdv]")>;
  751. // ASIMD FP instructions.
  752. def : InstRW<[M5WriteNSHF2], (instregex "^FABSv.f(16|32|64)")>;
  753. def : InstRW<[M5WriteFADD2], (instregex "^F(ABD|ADD|SUB)v.f(16|32|64)")>;
  754. def : InstRW<[M5WriteFADD2], (instregex "^FADDPv.f(16|32|64)")>;
  755. def : InstRW<[M5WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v[^1]")>;
  756. def : InstRW<[M5WriteFCVT2], (instregex "^FCVT(L|N|XN)v")>;
  757. def : InstRW<[M5WriteFCVT2A], (instregex "^FCVT[AMNPZ][SU]v")>;
  758. def : InstRW<[M5WriteFCVT2], (instregex "^[SU]CVTFv.[fi](16|32|64)")>;
  759. def : InstRW<[M5WriteFDIV7], (instrs FDIVv4f16)>;
  760. def : InstRW<[M5WriteNEONV], (instrs FDIVv8f16)>;
  761. def : InstRW<[M5WriteFDIV7], (instrs FDIVv2f32)>;
  762. def : InstRW<[M5WriteNEONV], (instrs FDIVv4f32)>;
  763. def : InstRW<[M5WriteNEONW], (instrs FDIVv2f64)>;
  764. def : InstRW<[M5WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?v")>;
  765. def : InstRW<[M5WriteNMSC2], (instregex "^F(MAX|MIN)(NM)?Pv")>;
  766. def : InstRW<[M5WriteNEONZ], (instregex "^F(MAX|MIN)(NM)?Vv")>;
  767. def : InstRW<[M5WriteFMAC3], (instregex "^FMULX?v.[fi](16|32|64)")>;
  768. def : InstRW<[M5WriteFMAC4,
  769. M5ReadFMACM1], (instregex "^FML[AS]v.[fi](16|32|64)")>;
  770. def : InstRW<[M5WriteNALU2], (instregex "^FNEGv.f(16|32|64)")>;
  771. def : InstRW<[M5WriteFCVT3A], (instregex "^FRINT[AIMNPXZ]v")>;
  772. def : InstRW<[M5WriteFSQR7], (instrs FSQRTv4f16)>;
  773. def : InstRW<[M5WriteNEONU], (instrs FSQRTv8f16)>;
  774. def : InstRW<[M5WriteFSQR8], (instrs FSQRTv2f32)>;
  775. def : InstRW<[M5WriteNEONX], (instrs FSQRTv4f32)>;
  776. def : InstRW<[M5WriteNEONY], (instrs FSQRTv2f64)>;
  777. // ASIMD miscellaneous instructions.
  778. def : InstRW<[M5WriteNALU2], (instregex "^RBITv")>;
  779. def : InstRW<[M5WriteNALU2], (instregex "^(BIF|BIT|BSL|BSP)v")>;
  780. def : InstRW<[M5WriteNALU2], (instregex "^CL[STZ]v")>;
  781. def : InstRW<[M5WriteNEONB], (instregex "^DUPv.+gpr")>;
  782. def : InstRW<[M5WriteNSHF2], (instregex "^DUP(i8|i16|i32|i64)$")>;
  783. def : InstRW<[M5WriteNSHF2], (instregex "^DUPv.+lane")>;
  784. def : InstRW<[M5WriteNSHF2], (instregex "^EXTv")>;
  785. def : InstRW<[M5WriteNSHT4A], (instregex "^XTNv")>;
  786. def : InstRW<[M5WriteNSHT4A], (instregex "^[SU]?QXTU?Nv")>;
  787. def : InstRW<[M5WriteNEONB], (instregex "^INSv.+gpr")>;
  788. def : InstRW<[M5WriteNSHF2], (instregex "^INSv.+lane")>;
  789. def : InstRW<[M5WriteMOVI], (instregex "^(MOV|MVN)I")>;
  790. def : InstRW<[M5WriteNALU1], (instregex "^FMOVv.f(16|32|64)")>;
  791. def : InstRW<[M5WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev[248]f(16|32|64)")>;
  792. def : InstRW<[M5WriteFCVT3], (instregex "^U(RECP|RSQRT)Ev[24]i32")>;
  793. def : InstRW<[M5WriteFMAC4], (instregex "^F(RECP|RSQRT)Sv.f(16|32|64)")>;
  794. def : InstRW<[M5WriteNSHF2], (instregex "^REV(16|32|64)v")>;
  795. def : InstRW<[M5WriteNSHFA], (instregex "^TB[LX]v(8|16)i8One")>;
  796. def : InstRW<[M5WriteNSHFB], (instregex "^TB[LX]v(8|16)i8Two")>;
  797. def : InstRW<[M5WriteNSHFC], (instregex "^TB[LX]v(8|16)i8Three")>;
  798. def : InstRW<[M5WriteNSHFD], (instregex "^TB[LX]v(8|16)i8Four")>;
  799. def : InstRW<[M5WriteNEONP], (instregex "^[SU]MOVv")>;
  800. def : InstRW<[M5WriteNSHF2], (instregex "^(TRN|UZP|ZIP)[12]v")>;
  801. // ASIMD load instructions.
  802. def : InstRW<[WriteVLD], (instregex "LD1Onev(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  803. def : InstRW<[WriteVLD,
  804. M5WriteA1X,
  805. WriteAdr], (instregex "LD1Onev(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  806. def : InstRW<[M5WriteVLDA], (instregex "LD1Twov(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  807. def : InstRW<[M5WriteVLDA,
  808. M5WriteA1X,
  809. WriteAdr], (instregex "LD1Twov(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  810. def : InstRW<[M5WriteVLDB], (instregex "LD1Threev(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  811. def : InstRW<[M5WriteVLDB,
  812. M5WriteA1X,
  813. WriteAdr], (instregex "LD1Threev(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  814. def : InstRW<[M5WriteVLDC], (instregex "LD1Fourv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  815. def : InstRW<[M5WriteVLDC,
  816. M5WriteA1X,
  817. WriteAdr], (instregex "LD1Fourv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  818. def : InstRW<[M5WriteVLDD], (instregex "LD1i(8|16|32|64)$")>;
  819. def : InstRW<[M5WriteVLDD,
  820. M5WriteA1X,
  821. WriteAdr], (instregex "LD1i(8|16|32|64)_POST$")>;
  822. def : InstRW<[WriteVLD], (instregex "LD1Rv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  823. def : InstRW<[WriteVLD,
  824. M5WriteA1X,
  825. WriteAdr], (instregex "LD1Rv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  826. def : InstRW<[M5WriteVLDF], (instregex "LD2Twov(8b|16b|4h|8h|2s|4s|2d)$")>;
  827. def : InstRW<[M5WriteVLDF,
  828. M5WriteA1X,
  829. WriteAdr], (instregex "LD2Twov(8b|16b|4h|8h|2s|4s|2d)_POST$")>;
  830. def : InstRW<[M5WriteVLDG], (instregex "LD2i(8|16|32|64)$")>;
  831. def : InstRW<[M5WriteVLDG,
  832. M5WriteA1X,
  833. WriteAdr], (instregex "LD2i(8|16|32|64)_POST$")>;
  834. def : InstRW<[M5WriteVLDA], (instregex "LD2Rv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  835. def : InstRW<[M5WriteVLDA,
  836. M5WriteA1X,
  837. WriteAdr], (instregex "LD2Rv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  838. def : InstRW<[M5WriteVLDI], (instregex "LD3Threev(8b|16b|4h|8h|2s|4s|2d)$")>;
  839. def : InstRW<[M5WriteVLDI,
  840. M5WriteA1X,
  841. WriteAdr], (instregex "LD3Threev(8b|16b|4h|8h|2s|4s|2d)_POST$")>;
  842. def : InstRW<[M5WriteVLDJ], (instregex "LD3i(8|16|32)$")>;
  843. def : InstRW<[M5WriteVLDJ,
  844. M5WriteA1X,
  845. WriteAdr], (instregex "LD3i(8|16|32)_POST$")>;
  846. def : InstRW<[M5WriteVLDL], (instregex "LD3i64$")>;
  847. def : InstRW<[M5WriteVLDL,
  848. M5WriteA1X,
  849. WriteAdr], (instregex "LD3i64_POST$")>;
  850. def : InstRW<[M5WriteVLDB], (instregex "LD3Rv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  851. def : InstRW<[M5WriteVLDB,
  852. M5WriteA1X], (instregex "LD3Rv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  853. def : InstRW<[M5WriteVLDN], (instregex "LD4Fourv(8b|16b|4h|8h|2s|4s|2d)$")>;
  854. def : InstRW<[M5WriteVLDN,
  855. M5WriteA1X,
  856. WriteAdr], (instregex "LD4Fourv(8b|16b|4h|8h|2s|4s|2d)_POST$")>;
  857. def : InstRW<[M5WriteVLDK], (instregex "LD4i(8|16|32)$")>;
  858. def : InstRW<[M5WriteVLDK,
  859. M5WriteA1X,
  860. WriteAdr], (instregex "LD4i(8|16|32)_POST$")>;
  861. def : InstRW<[M5WriteVLDM], (instregex "LD4i64$")>;
  862. def : InstRW<[M5WriteVLDM,
  863. M5WriteA1X,
  864. WriteAdr], (instregex "LD4i64_POST$")>;
  865. def : InstRW<[M5WriteVLDC], (instregex "LD4Rv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  866. def : InstRW<[M5WriteVLDC,
  867. M5WriteA1X,
  868. WriteAdr], (instregex "LD4Rv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  869. // ASIMD store instructions.
  870. def : InstRW<[WriteVST], (instregex "ST1Onev(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  871. def : InstRW<[WriteVST,
  872. M5WriteA1X,
  873. WriteAdr], (instregex "ST1Onev(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  874. def : InstRW<[M5WriteVSTA], (instregex "ST1Twov(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  875. def : InstRW<[M5WriteVSTA,
  876. M5WriteA1X,
  877. WriteAdr], (instregex "ST1Twov(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  878. def : InstRW<[M5WriteVSTB], (instregex "ST1Threev(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  879. def : InstRW<[M5WriteVSTB,
  880. M5WriteA1X,
  881. WriteAdr], (instregex "ST1Threev(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  882. def : InstRW<[M5WriteVSTC], (instregex "ST1Fourv(8b|16b|4h|8h|2s|4s|1d|2d)$")>;
  883. def : InstRW<[M5WriteVSTC,
  884. M5WriteA1X,
  885. WriteAdr], (instregex "ST1Fourv(8b|16b|4h|8h|2s|4s|1d|2d)_POST$")>;
  886. def : InstRW<[WriteVST], (instregex "ST1i(8|16|32|64)$")>;
  887. def : InstRW<[WriteVST,
  888. M5WriteA1X,
  889. WriteAdr], (instregex "ST1i(8|16|32|64)_POST$")>;
  890. def : InstRW<[M5WriteVSTD], (instregex "ST2Twov(8b|4h|2s)$")>;
  891. def : InstRW<[M5WriteVSTD,
  892. M5WriteA1X,
  893. WriteAdr], (instregex "ST2Twov(8b|4h|2s)_POST$")>;
  894. def : InstRW<[M5WriteVSTE], (instregex "ST2Twov(16b|8h|4s|2d)$")>;
  895. def : InstRW<[M5WriteVSTE,
  896. M5WriteA1X,
  897. WriteAdr], (instregex "ST2Twov(16b|8h|4s|2d)_POST$")>;
  898. def : InstRW<[M5WriteVSTD], (instregex "ST2i(8|16|32|64)$")>;
  899. def : InstRW<[M5WriteVSTD,
  900. M5WriteA1X,
  901. WriteAdr], (instregex "ST2i(8|16|32|64)_POST$")>;
  902. def : InstRW<[M5WriteVSTF], (instregex "ST3Threev(8b|4h|2s)$")>;
  903. def : InstRW<[M5WriteVSTF,
  904. M5WriteA1X,
  905. WriteAdr], (instregex "ST3Threev(8b|4h|2s)_POST$")>;
  906. def : InstRW<[M5WriteVSTG], (instregex "ST3Threev(16b|8h|4s|2d)$")>;
  907. def : InstRW<[M5WriteVSTG,
  908. M5WriteA1X,
  909. WriteAdr], (instregex "ST3Threev(16b|8h|4s|2d)_POST$")>;
  910. def : InstRW<[M5WriteVSTA], (instregex "ST3i(8|16|32|64)$")>;
  911. def : InstRW<[M5WriteVSTA,
  912. M5WriteA1X,
  913. WriteAdr], (instregex "ST3i(8|16|32|64)_POST$")>;
  914. def : InstRW<[M5WriteVSTL], (instregex "ST4Fourv(8b|4h|2s)$")>;
  915. def : InstRW<[M5WriteVSTL,
  916. M5WriteA1X,
  917. WriteAdr], (instregex "ST4Fourv(8b|4h|2s)_POST$")>;
  918. def : InstRW<[M5WriteVSTI], (instregex "ST4Fourv(16b|8h|4s|2d)$")>;
  919. def : InstRW<[M5WriteVSTI,
  920. M5WriteA1X,
  921. WriteAdr], (instregex "ST4Fourv(16b|8h|4s|2d)_POST$")>;
  922. def : InstRW<[M5WriteVSTA], (instregex "ST4i(8|16|32|64)$")>;
  923. def : InstRW<[M5WriteVSTA,
  924. M5WriteA1X,
  925. WriteAdr], (instregex "ST4i(8|16|32|64)_POST$")>;
  926. // Cryptography instructions.
  927. def : InstRW<[M5WriteNCRY2], (instregex "^AES[DE]")>;
  928. def : InstRW<[M5WriteNCRY2,
  929. M5ReadAESM2], (instregex "^AESI?MC")>;
  930. def : InstRW<[M5WriteNCRY2A], (instregex "^PMULv")>;
  931. def : InstRW<[M5WriteNCRY1A], (instregex "^PMULLv(1|8)i")>;
  932. def : InstRW<[M5WriteNCRY3A], (instregex "^PMULLv(2|16)i")>;
  933. def : InstRW<[M5WriteNCRY2A], (instregex "^SHA1(H|SU[01])")>;
  934. def : InstRW<[M5WriteNCRY5A], (instregex "^SHA1[CMP]")>;
  935. def : InstRW<[M5WriteNCRY2A], (instrs SHA256SU0rr)>;
  936. def : InstRW<[M5WriteNCRY5A], (instrs SHA256SU1rrr)>;
  937. def : InstRW<[M5WriteNCRY5A], (instregex "^SHA256H2?")>;
  938. // CRC instructions.
  939. def : InstRW<[M5WriteF2,
  940. M5ReadFM1], (instregex "^CRC32C?[BHWX]")>;
  941. } // SchedModel = ExynosM5Model