AArch64SchedExynosM4.td 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. //=- AArch64SchedExynosM4.td - Samsung Exynos M4 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 M4 to support
  10. // instruction scheduling and other instruction cost heuristics.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // The Exynos-M4 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 ExynosM4Model : SchedMachineModel {
  18. let IssueWidth = 6; // Up to 6 uops per cycle.
  19. let MicroOpBufferSize = 228; // ROB size.
  20. let LoopMicroOpBufferSize = 48; // Based on the instruction queue size.
  21. let LoadLatency = 4; // Optimistic load cases.
  22. let MispredictPenalty = 16; // 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. }
  28. //===----------------------------------------------------------------------===//
  29. // Define each kind of processor resource and number available on the Exynos-M4.
  30. let SchedModel = ExynosM4Model in {
  31. def M4UnitA : ProcResource<2>; // Simple integer
  32. def M4UnitC : ProcResource<2>; // Simple and complex integer
  33. let Super = M4UnitC, BufferSize = 1 in
  34. def M4UnitD : ProcResource<1>; // Integer division (inside C0, serialized)
  35. let Super = M4UnitC in
  36. def M4UnitE : ProcResource<1>; // CRC (inside C0)
  37. def M4UnitB : ProcResource<2>; // Branch
  38. def M4UnitL0 : ProcResource<1>; // Load
  39. def M4UnitS0 : ProcResource<1>; // Store
  40. def M4PipeLS : ProcResource<1>; // Load/Store
  41. let Super = M4PipeLS in {
  42. def M4UnitL1 : ProcResource<1>;
  43. def M4UnitS1 : ProcResource<1>;
  44. }
  45. def M4PipeF0 : ProcResource<1>; // FP #0
  46. let Super = M4PipeF0 in {
  47. def M4UnitFMAC0 : ProcResource<1>; // FP multiplication
  48. def M4UnitFADD0 : ProcResource<1>; // Simple FP
  49. def M4UnitFCVT0 : ProcResource<1>; // FP conversion
  50. def M4UnitNALU0 : ProcResource<1>; // Simple vector
  51. def M4UnitNHAD : ProcResource<1>; // Horizontal vector
  52. def M4UnitNMSC : ProcResource<1>; // FP and vector miscellanea
  53. def M4UnitNMUL0 : ProcResource<1>; // Vector multiplication
  54. def M4UnitNSHT0 : ProcResource<1>; // Vector shifting
  55. def M4UnitNSHF0 : ProcResource<1>; // Vector shuffling
  56. def M4UnitNCRY0 : ProcResource<1>; // Cryptographic
  57. }
  58. def M4PipeF1 : ProcResource<1>; // FP #1
  59. let Super = M4PipeF1 in {
  60. def M4UnitFMAC1 : ProcResource<1>; // FP multiplication
  61. def M4UnitFADD1 : ProcResource<1>; // Simple FP
  62. def M4UnitFDIV0 : ProcResource<2>; // FP division (serialized)
  63. def M4UnitFSQR0 : ProcResource<2>; // FP square root (serialized)
  64. def M4UnitFST0 : ProcResource<1>; // FP store
  65. def M4UnitNALU1 : ProcResource<1>; // Simple vector
  66. def M4UnitNSHT1 : ProcResource<1>; // Vector shifting
  67. def M4UnitNSHF1 : ProcResource<1>; // Vector shuffling
  68. }
  69. def M4PipeF2 : ProcResource<1>; // FP #2
  70. let Super = M4PipeF2 in {
  71. def M4UnitFMAC2 : ProcResource<1>; // FP multiplication
  72. def M4UnitFADD2 : ProcResource<1>; // Simple FP
  73. def M4UnitFCVT1 : ProcResource<1>; // FP conversion
  74. def M4UnitFDIV1 : ProcResource<2>; // FP division (serialized)
  75. def M4UnitFSQR1 : ProcResource<2>; // FP square root (serialized)
  76. def M4UnitFST1 : ProcResource<1>; // FP store
  77. def M4UnitNALU2 : ProcResource<1>; // Simple vector
  78. def M4UnitNMUL1 : ProcResource<1>; // Vector multiplication
  79. def M4UnitNSHT2 : ProcResource<1>; // Vector shifting
  80. def M4UnitNCRY1 : ProcResource<1>; // Cryptographic
  81. }
  82. def M4UnitALU : ProcResGroup<[M4UnitA,
  83. M4UnitC]>;
  84. def M4UnitL : ProcResGroup<[M4UnitL0,
  85. M4UnitL1]>;
  86. def M4UnitS : ProcResGroup<[M4UnitS0,
  87. M4UnitS1]>;
  88. def M4UnitFMAC : ProcResGroup<[M4UnitFMAC0,
  89. M4UnitFMAC1,
  90. M4UnitFMAC2]>;
  91. def M4UnitFMACH : ProcResGroup<[M4UnitFMAC0,
  92. M4UnitFMAC1]>;
  93. def M4UnitFADD : ProcResGroup<[M4UnitFADD0,
  94. M4UnitFADD1,
  95. M4UnitFADD2]>;
  96. def M4UnitFADDH : ProcResGroup<[M4UnitFADD0,
  97. M4UnitFADD1]>;
  98. def M4UnitFCVT : ProcResGroup<[M4UnitFCVT0,
  99. M4UnitFCVT1]>;
  100. def M4UnitFCVTH : ProcResGroup<[M4UnitFCVT0]>;
  101. def M4UnitFDIV : ProcResGroup<[M4UnitFDIV0,
  102. M4UnitFDIV1]>;
  103. def M4UnitFDIVH : ProcResGroup<[M4UnitFDIV0]>;
  104. def M4UnitFSQR : ProcResGroup<[M4UnitFSQR0,
  105. M4UnitFSQR1]>;
  106. def M4UnitFSQRH : ProcResGroup<[M4UnitFSQR0]>;
  107. def M4UnitFST : ProcResGroup<[M4UnitFST0,
  108. M4UnitFST1]>;
  109. def M4UnitNALU : ProcResGroup<[M4UnitNALU0,
  110. M4UnitNALU1,
  111. M4UnitNALU2]>;
  112. def M4UnitNALUH : ProcResGroup<[M4UnitNALU0,
  113. M4UnitNALU1]>;
  114. def M4UnitNMUL : ProcResGroup<[M4UnitNMUL0,
  115. M4UnitNMUL1]>;
  116. def M4UnitNSHT : ProcResGroup<[M4UnitNSHT0,
  117. M4UnitNSHT1,
  118. M4UnitNSHT2]>;
  119. def M4UnitNSHF : ProcResGroup<[M4UnitNSHF0,
  120. M4UnitNSHF1]>;
  121. def M4UnitNSHFH : ProcResGroup<[M4UnitNSHF0]>;
  122. def M4UnitNCRY : ProcResGroup<[M4UnitNCRY0,
  123. M4UnitNCRY1]>;
  124. //===----------------------------------------------------------------------===//
  125. // Resources details.
  126. def M4WriteZ0 : SchedWriteRes<[]> { let Latency = 0; }
  127. def M4WriteZ1 : SchedWriteRes<[]> { let Latency = 1;
  128. let NumMicroOps = 0; }
  129. def M4WriteZ4 : SchedWriteRes<[]> { let Latency = 4;
  130. let NumMicroOps = 0; }
  131. def M4WriteA1 : SchedWriteRes<[M4UnitALU]> { let Latency = 1; }
  132. def M4WriteA2 : SchedWriteRes<[M4UnitALU]> { let Latency = 2; }
  133. def M4WriteAA : SchedWriteRes<[M4UnitALU]> { let Latency = 2;
  134. let ResourceCycles = [2]; }
  135. def M4WriteAB : SchedWriteRes<[M4UnitALU,
  136. M4UnitC]> { let Latency = 2;
  137. let NumMicroOps = 2; }
  138. def M4WriteAC : SchedWriteRes<[M4UnitALU,
  139. M4UnitALU,
  140. M4UnitC]> { let Latency = 3;
  141. let NumMicroOps = 3; }
  142. def M4WriteAD : SchedWriteRes<[M4UnitALU,
  143. M4UnitC]> { let Latency = 2;
  144. let NumMicroOps = 2; }
  145. def M4WriteAF : SchedWriteRes<[M4UnitALU]> { let Latency = 2;
  146. let NumMicroOps = 2; }
  147. def M4WriteAU : SchedWriteVariant<[SchedVar<IsCopyIdiomPred, [M4WriteZ0]>,
  148. SchedVar<ExynosArithPred, [M4WriteA1]>,
  149. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  150. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  151. def M4WriteAV : SchedWriteVariant<[SchedVar<ExynosResetPred, [M4WriteZ0]>,
  152. SchedVar<ExynosArithPred, [M4WriteA1]>,
  153. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  154. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  155. def M4WriteAX : SchedWriteVariant<[SchedVar<ExynosArithPred, [M4WriteA1]>,
  156. SchedVar<ExynosLogicExPred, [M4WriteA1]>,
  157. SchedVar<NoSchedPred, [M4WriteAA]>]>;
  158. def M4WriteAY : SchedWriteVariant<[SchedVar<ExynosRotateRightImmPred, [M4WriteA1]>,
  159. SchedVar<NoSchedPred, [M4WriteAF]>]>;
  160. def M4WriteB1 : SchedWriteRes<[M4UnitB]> { let Latency = 1; }
  161. def M4WriteBX : SchedWriteVariant<[SchedVar<ExynosBranchLinkLRPred, [M4WriteAC]>,
  162. SchedVar<NoSchedPred, [M4WriteAB]>]>;
  163. def M4WriteC1 : SchedWriteRes<[M4UnitC]> { let Latency = 1; }
  164. def M4WriteC3 : SchedWriteRes<[M4UnitC]> { let Latency = 3; }
  165. def M4WriteCA : SchedWriteRes<[M4UnitC]> { let Latency = 4;
  166. let ResourceCycles = [2]; }
  167. def M4WriteD12 : SchedWriteRes<[M4UnitD]> { let Latency = 12;
  168. let ResourceCycles = [12]; }
  169. def M4WriteD21 : SchedWriteRes<[M4UnitD]> { let Latency = 21;
  170. let ResourceCycles = [21]; }
  171. def M4WriteE2 : SchedWriteRes<[M4UnitE]> { let Latency = 2; }
  172. def M4WriteL4 : SchedWriteRes<[M4UnitL]> { let Latency = 4; }
  173. def M4WriteL5 : SchedWriteRes<[M4UnitL]> { let Latency = 5; }
  174. def M4WriteLA : SchedWriteRes<[M4UnitL,
  175. M4UnitL]> { let Latency = 5;
  176. let NumMicroOps = 1; }
  177. def M4WriteLB : SchedWriteRes<[M4UnitA,
  178. M4UnitL]> { let Latency = 5;
  179. let NumMicroOps = 2; }
  180. def M4WriteLC : SchedWriteRes<[M4UnitA,
  181. M4UnitL,
  182. M4UnitL]> { let Latency = 5;
  183. let NumMicroOps = 2; }
  184. def M4WriteLD : SchedWriteRes<[M4UnitA,
  185. M4UnitL]> { let Latency = 4;
  186. let NumMicroOps = 2; }
  187. def M4WriteLE : SchedWriteRes<[M4UnitA,
  188. M4UnitL]> { let Latency = 6;
  189. let NumMicroOps = 2; }
  190. def M4WriteLH : SchedWriteRes<[]> { let Latency = 5;
  191. let NumMicroOps = 0; }
  192. def M4WriteLX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteL5]>,
  193. SchedVar<NoSchedPred, [M4WriteL4]>]>;
  194. def M4WriteLY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteLE]>,
  195. SchedVar<NoSchedPred, [M4WriteL5]>]>;
  196. def M4WriteS1 : SchedWriteRes<[M4UnitS]> { let Latency = 1; }
  197. def M4WriteSA : SchedWriteRes<[M4UnitS0]> { let Latency = 3; }
  198. def M4WriteSB : SchedWriteRes<[M4UnitA,
  199. M4UnitS]> { let Latency = 2;
  200. let NumMicroOps = 1; }
  201. def M4WriteSX : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteSB]>,
  202. SchedVar<NoSchedPred, [M4WriteS1]>]>;
  203. def M4ReadAdrBase : SchedReadVariant<[SchedVar<
  204. MCSchedPredicate<
  205. CheckAny<
  206. [ScaledIdxFn,
  207. ExynosScaledIdxFn]>>, [ReadDefault]>,
  208. SchedVar<NoSchedPred, [ReadDefault]>]>;
  209. def M4WriteNEONA : SchedWriteRes<[M4UnitNSHF,
  210. M4UnitFADD]> { let Latency = 3;
  211. let NumMicroOps = 2; }
  212. def M4WriteNEONB : SchedWriteRes<[M4UnitNALU,
  213. M4UnitS0]> { let Latency = 5;
  214. let NumMicroOps = 2; }
  215. def M4WriteNEOND : SchedWriteRes<[M4UnitNSHF,
  216. M4UnitFST]> { let Latency = 6;
  217. let NumMicroOps = 2; }
  218. def M4WriteNEONH : SchedWriteRes<[M4UnitNALU,
  219. M4UnitS0]> { let Latency = 5;
  220. let NumMicroOps = 2; }
  221. def M4WriteNEONI : SchedWriteRes<[M4UnitNSHF,
  222. M4UnitS0]> { let Latency = 2;
  223. let NumMicroOps = 2; }
  224. def M4WriteNEONJ : SchedWriteRes<[M4UnitNMSC,
  225. M4UnitS0]> { let Latency = 4; }
  226. def M4WriteNEONK : SchedWriteRes<[M4UnitNSHF,
  227. M4UnitNMSC,
  228. M4UnitS0]> { let Latency = 5;
  229. let NumMicroOps = 2; }
  230. def M4WriteNEONL : SchedWriteRes<[M4UnitNMUL]> { let Latency = 3; }
  231. def M4WriteNEONN : SchedWriteRes<[M4UnitNMSC,
  232. M4UnitNMSC]> { let Latency = 5;
  233. let NumMicroOps = 2; }
  234. def M4WriteNEONO : SchedWriteRes<[M4UnitNMSC,
  235. M4UnitNMSC,
  236. M4UnitNMSC]> { let Latency = 8;
  237. let NumMicroOps = 3; }
  238. def M4WriteNEONP : SchedWriteRes<[M4UnitNSHF,
  239. M4UnitNMSC]> { let Latency = 4;
  240. let NumMicroOps = 2; }
  241. def M4WriteNEONQ : SchedWriteRes<[M4UnitNMSC,
  242. M4UnitC]> { let Latency = 3;
  243. let NumMicroOps = 1; }
  244. def M4WriteNEONR : SchedWriteRes<[M4UnitFCVT0,
  245. M4UnitS0]> { let Latency = 4;
  246. let NumMicroOps = 1; }
  247. def M4WriteNEONV : SchedWriteRes<[M4UnitFDIV,
  248. M4UnitFDIV]> { let Latency = 7;
  249. let ResourceCycles = [6, 6]; }
  250. def M4WriteNEONVH : SchedWriteRes<[M4UnitFDIVH,
  251. M4UnitFDIVH]> { let Latency = 7;
  252. let ResourceCycles = [6, 6]; }
  253. def M4WriteNEONW : SchedWriteRes<[M4UnitFDIV,
  254. M4UnitFDIV]> { let Latency = 12;
  255. let ResourceCycles = [9, 9]; }
  256. def M4WriteNEONX : SchedWriteRes<[M4UnitFSQR,
  257. M4UnitFSQR]> { let Latency = 8;
  258. let ResourceCycles = [7, 7]; }
  259. def M4WriteNEONXH : SchedWriteRes<[M4UnitFSQRH,
  260. M4UnitFSQRH]> { let Latency = 7;
  261. let ResourceCycles = [6, 6]; }
  262. def M4WriteNEONY : SchedWriteRes<[M4UnitFSQR,
  263. M4UnitFSQR]> { let Latency = 12;
  264. let ResourceCycles = [9, 9]; }
  265. def M4WriteNEONZ : SchedWriteVariant<[SchedVar<ExynosQFormPred, [M4WriteNEONO]>,
  266. SchedVar<NoSchedPred, [M4WriteNEONN]>]>;
  267. def M4WriteFADD2 : SchedWriteRes<[M4UnitFADD]> { let Latency = 2; }
  268. def M4WriteFADD2H : SchedWriteRes<[M4UnitFADDH]> { let Latency = 2; }
  269. def M4WriteFCVT2 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 2; }
  270. def M4WriteFCVT2A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 2; }
  271. def M4WriteFCVT2H : SchedWriteRes<[M4UnitFCVTH]> { let Latency = 2; }
  272. def M4WriteFCVT3 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 3; }
  273. def M4WriteFCVT3A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 3; }
  274. def M4WriteFCVT3H : SchedWriteRes<[M4UnitFCVTH]> { let Latency = 3; }
  275. def M4WriteFCVT4 : SchedWriteRes<[M4UnitFCVT]> { let Latency = 4; }
  276. def M4WriteFCVT4A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 4; }
  277. def M4WriteFCVT6A : SchedWriteRes<[M4UnitFCVT0]> { let Latency = 6; }
  278. def M4WriteFDIV7 : SchedWriteRes<[M4UnitFDIV]> { let Latency = 7;
  279. let ResourceCycles = [6]; }
  280. def M4WriteFDIV7H : SchedWriteRes<[M4UnitFDIVH]> { let Latency = 7;
  281. let ResourceCycles = [6]; }
  282. def M4WriteFDIV12 : SchedWriteRes<[M4UnitFDIV]> { let Latency = 12;
  283. let ResourceCycles = [9]; }
  284. def M4WriteFMAC2H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 2; }
  285. def M4WriteFMAC3H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 3; }
  286. def M4WriteFMAC3 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 3; }
  287. def M4WriteFMAC4 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 4; }
  288. def M4WriteFMAC4H : SchedWriteRes<[M4UnitFMACH]> { let Latency = 4; }
  289. def M4WriteFMAC5 : SchedWriteRes<[M4UnitFMAC]> { let Latency = 5; }
  290. def M4WriteFSQR7H : SchedWriteRes<[M4UnitFSQRH]> { let Latency = 7;
  291. let ResourceCycles = [6]; }
  292. def M4WriteFSQR8 : SchedWriteRes<[M4UnitFSQR]> { let Latency = 8;
  293. let ResourceCycles = [7]; }
  294. def M4WriteFSQR12 : SchedWriteRes<[M4UnitFSQR]> { let Latency = 12;
  295. let ResourceCycles = [9]; }
  296. def M4WriteNALU1 : SchedWriteRes<[M4UnitNALU]> { let Latency = 1; }
  297. def M4WriteNALU1H : SchedWriteRes<[M4UnitNALUH]> { let Latency = 1; }
  298. def M4WriteNCRY1 : SchedWriteRes<[M4UnitNCRY]> { let Latency = 1; }
  299. def M4WriteNCRY1A : SchedWriteRes<[M4UnitNCRY0]> { let Latency = 1; }
  300. def M4WriteNCRY3A : SchedWriteRes<[M4UnitNCRY0]> { let Latency = 3; }
  301. def M4WriteNCRY5A : SchedWriteRes<[M4UnitNCRY]> { let Latency = 5; }
  302. def M4WriteNHAD1 : SchedWriteRes<[M4UnitNHAD]> { let Latency = 1; }
  303. def M4WriteNHAD3 : SchedWriteRes<[M4UnitNHAD]> { let Latency = 3; }
  304. def M4WriteNMSC1 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 1; }
  305. def M4WriteNMSC2 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 2; }
  306. def M4WriteNMSC3 : SchedWriteRes<[M4UnitNMSC]> { let Latency = 3; }
  307. def M4WriteNMUL3 : SchedWriteRes<[M4UnitNMUL]> { let Latency = 3; }
  308. def M4WriteNSHF1 : SchedWriteRes<[M4UnitNSHF]> { let Latency = 1; }
  309. def M4WriteNSHF1H : SchedWriteRes<[M4UnitNSHFH]> { let Latency = 1; }
  310. def M4WriteNSHF3 : SchedWriteRes<[M4UnitNSHF]> { let Latency = 3; }
  311. def M4WriteNSHFA : SchedWriteRes<[M4UnitNSHF]> { let Latency = 1;
  312. let ResourceCycles = [2]; }
  313. def M4WriteNSHFB : SchedWriteRes<[M4UnitNSHF]> { let Latency = 2;
  314. let NumMicroOps = 2;
  315. let ResourceCycles = [2]; }
  316. def M4WriteNSHFC : SchedWriteRes<[M4UnitNSHF]> { let Latency = 3;
  317. let NumMicroOps = 3;
  318. let ResourceCycles = [4]; }
  319. def M4WriteNSHFD : SchedWriteRes<[M4UnitNSHF]> { let Latency = 4;
  320. let NumMicroOps = 4;
  321. let ResourceCycles = [4]; }
  322. def M4WriteNSHT1 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 1; }
  323. def M4WriteNSHT2 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 2; }
  324. def M4WriteNSHT3 : SchedWriteRes<[M4UnitNSHT]> { let Latency = 3; }
  325. def M4WriteNSHT4A : SchedWriteRes<[M4UnitNSHT1]> { let Latency = 4; }
  326. def M4WriteVLDA : SchedWriteRes<[M4UnitL,
  327. M4UnitL]> { let Latency = 5;
  328. let NumMicroOps = 2; }
  329. def M4WriteVLDB : SchedWriteRes<[M4UnitL,
  330. M4UnitL,
  331. M4UnitL]> { let Latency = 6;
  332. let NumMicroOps = 3; }
  333. def M4WriteVLDC : SchedWriteRes<[M4UnitL,
  334. M4UnitL,
  335. M4UnitL,
  336. M4UnitL]> { let Latency = 6;
  337. let NumMicroOps = 4; }
  338. def M4WriteVLDD : SchedWriteRes<[M4UnitL,
  339. M4UnitNSHF]> { let Latency = 6;
  340. let NumMicroOps = 2;
  341. let ResourceCycles = [2, 1]; }
  342. def M4WriteVLDF : SchedWriteRes<[M4UnitL,
  343. M4UnitL]> { let Latency = 10;
  344. let NumMicroOps = 2;
  345. let ResourceCycles = [3, 3]; }
  346. def M4WriteVLDG : SchedWriteRes<[M4UnitL,
  347. M4UnitNSHF,
  348. M4UnitNSHF]> { let Latency = 6;
  349. let NumMicroOps = 3;
  350. let ResourceCycles = [2, 1, 1]; }
  351. def M4WriteVLDI : SchedWriteRes<[M4UnitL,
  352. M4UnitL,
  353. M4UnitL]> { let Latency = 12;
  354. let NumMicroOps = 3;
  355. let ResourceCycles = [3, 3, 3]; }
  356. def M4WriteVLDJ : SchedWriteRes<[M4UnitL,
  357. M4UnitNSHF,
  358. M4UnitNSHF,
  359. M4UnitNSHF]> { let Latency = 7;
  360. let NumMicroOps = 4;
  361. let ResourceCycles = [3, 1, 1, 1]; }
  362. def M4WriteVLDK : SchedWriteRes<[M4UnitL,
  363. M4UnitNSHF,
  364. M4UnitNSHF,
  365. M4UnitNSHF,
  366. M4UnitNSHF]> { let Latency = 7;
  367. let NumMicroOps = 5;
  368. let ResourceCycles = [3, 1, 1, 1, 1]; }
  369. def M4WriteVLDL : SchedWriteRes<[M4UnitL,
  370. M4UnitNSHF,
  371. M4UnitNSHF,
  372. M4UnitL,
  373. M4UnitNSHF]> { let Latency = 7;
  374. let NumMicroOps = 5;
  375. let ResourceCycles = [3, 1, 1, 6, 1]; }
  376. def M4WriteVLDM : SchedWriteRes<[M4UnitL,
  377. M4UnitNSHF,
  378. M4UnitNSHF,
  379. M4UnitL,
  380. M4UnitNSHF,
  381. M4UnitNSHF]> { let Latency = 7;
  382. let NumMicroOps = 6;
  383. let ResourceCycles = [3, 1, 1, 3, 1, 1]; }
  384. def M4WriteVLDN : SchedWriteRes<[M4UnitL,
  385. M4UnitL,
  386. M4UnitL,
  387. M4UnitL]> { let Latency = 14;
  388. let NumMicroOps = 4;
  389. let ResourceCycles = [3, 3, 3, 3]; }
  390. def M4WriteVST1 : SchedWriteRes<[M4UnitS,
  391. M4UnitFST]> { let Latency = 1;
  392. let NumMicroOps = 1; }
  393. def M4WriteVSTA : WriteSequence<[WriteVST], 2>;
  394. def M4WriteVSTB : WriteSequence<[WriteVST], 3>;
  395. def M4WriteVSTC : WriteSequence<[WriteVST], 4>;
  396. def M4WriteVSTD : SchedWriteRes<[M4UnitS,
  397. M4UnitFST]> { let Latency = 2; }
  398. def M4WriteVSTE : SchedWriteRes<[M4UnitS,
  399. M4UnitFST,
  400. M4UnitS,
  401. M4UnitFST]> { let Latency = 2;
  402. let NumMicroOps = 2; }
  403. def M4WriteVSTF : SchedWriteRes<[M4UnitNSHF,
  404. M4UnitS,
  405. M4UnitFST,
  406. M4UnitS,
  407. M4UnitFST]> { let Latency = 4;
  408. let NumMicroOps = 4;
  409. let ResourceCycles = [1, 2, 1, 2, 1]; }
  410. def M4WriteVSTG : SchedWriteRes<[M4UnitNSHF,
  411. M4UnitNSHF,
  412. M4UnitNSHF,
  413. M4UnitS,
  414. M4UnitFST,
  415. M4UnitS,
  416. M4UnitFST,
  417. M4UnitS,
  418. M4UnitFST]> { let Latency = 5;
  419. let NumMicroOps = 6;
  420. let ResourceCycles = [1, 1, 1, 2, 1, 2, 1, 2, 1]; }
  421. def M4WriteVSTI : SchedWriteRes<[M4UnitNSHF,
  422. M4UnitNSHF,
  423. M4UnitNSHF,
  424. M4UnitNSHF,
  425. M4UnitS,
  426. M4UnitFST,
  427. M4UnitS,
  428. M4UnitFST,
  429. M4UnitS,
  430. M4UnitFST,
  431. M4UnitS,
  432. M4UnitFST]> { let Latency = 8;
  433. let NumMicroOps = 5;
  434. let ResourceCycles = [1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1]; }
  435. def M4WriteVSTJ : SchedWriteRes<[M4UnitA,
  436. M4UnitS,
  437. M4UnitFST,
  438. M4UnitS,
  439. M4UnitFST]> { let Latency = 1;
  440. let NumMicroOps = 2; }
  441. def M4WriteVSTK : SchedWriteRes<[M4UnitA,
  442. M4UnitS,
  443. M4UnitFST]> { let Latency = 3;
  444. let NumMicroOps = 2; }
  445. def M4WriteVSTL : SchedWriteRes<[M4UnitNSHF,
  446. M4UnitNSHF,
  447. M4UnitS,
  448. M4UnitFST,
  449. M4UnitS,
  450. M4UnitFST]> { let Latency = 4;
  451. let NumMicroOps = 4;
  452. let ResourceCycles = [1, 1, 2, 1, 2, 1]; }
  453. def M4WriteVSTY : SchedWriteVariant<[SchedVar<ExynosScaledIdxPred, [M4WriteVSTK]>,
  454. SchedVar<NoSchedPred, [WriteVST]>]>;
  455. // Special cases.
  456. def M4WriteCOPY : SchedWriteVariant<[SchedVar<ExynosFPPred, [M4WriteNALU1]>,
  457. SchedVar<NoSchedPred, [M4WriteZ0]>]>;
  458. def M4WriteMOVI : SchedWriteVariant<[SchedVar<IsZeroFPIdiomPred, [M4WriteZ0]>,
  459. SchedVar<NoSchedPred, [M4WriteNALU1]>]>;
  460. // Fast forwarding.
  461. def M4ReadAESM1 : SchedReadAdvance<+1, [M4WriteNCRY1]>;
  462. def M4ReadFMACM1 : SchedReadAdvance<+1, [M4WriteFMAC4,
  463. M4WriteFMAC4H,
  464. M4WriteFMAC5]>;
  465. def M4ReadNMULM1 : SchedReadAdvance<+1, [M4WriteNMUL3]>;
  466. def M4ReadNMULP2 : SchedReadAdvance<-2, [M4WriteNMUL3]>;
  467. //===----------------------------------------------------------------------===//
  468. // Coarse scheduling model.
  469. // Branch instructions.
  470. def : SchedAlias<WriteBr, M4WriteZ0>;
  471. def : SchedAlias<WriteBrReg, M4WriteC1>;
  472. // Arithmetic and logical integer instructions.
  473. def : SchedAlias<WriteI, M4WriteA1>;
  474. def : SchedAlias<WriteIEReg, M4WriteAA>; // FIXME: M4WriteAX crashes TableGen.
  475. def : SchedAlias<WriteISReg, M4WriteAA>; // FIXME: M4WriteAX crashes TableGen.
  476. def : SchedAlias<WriteIS, M4WriteA1>;
  477. // Move instructions.
  478. def : SchedAlias<WriteImm, M4WriteA1>;
  479. // Divide and multiply instructions.
  480. def : SchedAlias<WriteID32, M4WriteD12>;
  481. def : SchedAlias<WriteID64, M4WriteD21>;
  482. def : SchedAlias<WriteIM32, M4WriteC3>;
  483. def : SchedAlias<WriteIM64, M4WriteCA>;
  484. // Miscellaneous instructions.
  485. def : SchedAlias<WriteExtr, M4WriteAY>;
  486. // Addressing modes.
  487. def : SchedAlias<WriteAdr, M4WriteZ1>;
  488. def : SchedAlias<ReadAdrBase, M4ReadAdrBase>;
  489. // Load instructions.
  490. def : SchedAlias<WriteLD, M4WriteL4>;
  491. def : SchedAlias<WriteLDHi, M4WriteZ4>;
  492. def : SchedAlias<WriteLDIdx, M4WriteLX>;
  493. // Store instructions.
  494. def : SchedAlias<WriteST, M4WriteS1>;
  495. def : SchedAlias<WriteSTP, M4WriteS1>;
  496. def : SchedAlias<WriteSTX, M4WriteS1>;
  497. def : SchedAlias<WriteSTIdx, M4WriteSX>;
  498. // FP data instructions.
  499. def : SchedAlias<WriteF, M4WriteFADD2>;
  500. def : SchedAlias<WriteFCmp, M4WriteNMSC2>;
  501. def : SchedAlias<WriteFDiv, M4WriteFDIV12>;
  502. def : SchedAlias<WriteFMul, M4WriteFMAC3>;
  503. // FP miscellaneous instructions.
  504. def : SchedAlias<WriteFCvt, M4WriteFCVT2>;
  505. def : SchedAlias<WriteFImm, M4WriteNALU1>;
  506. def : SchedAlias<WriteFCopy, M4WriteNALU1>;
  507. // FP load instructions.
  508. def : SchedAlias<WriteVLD, M4WriteL5>;
  509. // FP store instructions.
  510. def : SchedAlias<WriteVST, M4WriteVST1>;
  511. // ASIMD FP instructions.
  512. def : SchedAlias<WriteVd, M4WriteNALU1>;
  513. def : SchedAlias<WriteVq, M4WriteNALU1>;
  514. // Other miscellaneous instructions.
  515. def : WriteRes<WriteAtomic, []> { let Unsupported = 1; }
  516. def : WriteRes<WriteBarrier, []> { let Latency = 1; }
  517. def : WriteRes<WriteHint, []> { let Latency = 1; }
  518. def : WriteRes<WriteSys, []> { let Latency = 1; }
  519. //===----------------------------------------------------------------------===//
  520. // Generic fast forwarding.
  521. // TODO: Add FP register forwarding rules.
  522. def : ReadAdvance<ReadI, 0>;
  523. def : ReadAdvance<ReadISReg, 0>;
  524. def : ReadAdvance<ReadIEReg, 0>;
  525. def : ReadAdvance<ReadIM, 0>;
  526. // TODO: The forwarding for 32 bits actually saves 2 cycles.
  527. def : ReadAdvance<ReadIMA, 3, [WriteIM32, WriteIM64]>;
  528. def : ReadAdvance<ReadID, 0>;
  529. def : ReadAdvance<ReadExtrHi, 0>;
  530. def : ReadAdvance<ReadAdrBase, 0>;
  531. def : ReadAdvance<ReadVLD, 0>;
  532. def : ReadAdvance<ReadST, 0>;
  533. //===----------------------------------------------------------------------===//
  534. // Finer scheduling model.
  535. // Branch instructions
  536. def : InstRW<[M4WriteB1], (instrs Bcc)>;
  537. def : InstRW<[M4WriteAF], (instrs BL)>;
  538. def : InstRW<[M4WriteBX], (instrs BLR)>;
  539. def : InstRW<[M4WriteC1], (instregex "^CBN?Z[WX]")>;
  540. def : InstRW<[M4WriteAD], (instregex "^TBN?Z[WX]")>;
  541. // Arithmetic and logical integer instructions.
  542. def : InstRW<[M4WriteAX], (instregex "^(ADD|AND|BIC|EON|EOR|ORN|SUB)[WX]rs$")>;
  543. def : InstRW<[M4WriteAU], (instrs ORRWrs, ORRXrs)>;
  544. def : InstRW<[M4WriteAX], (instregex "^(ADD|AND|BIC|SUB)S[WX]rs$")>;
  545. def : InstRW<[M4WriteAX], (instregex "^(ADD|SUB)S?[WX]rx(64)?$")>;
  546. def : InstRW<[M4WriteAV], (instrs ADDWri, ADDXri, ORRWri, ORRXri)>;
  547. // Move instructions.
  548. def : InstRW<[M4WriteCOPY], (instrs COPY)>;
  549. def : InstRW<[M4WriteZ0], (instrs ADR, ADRP)>;
  550. def : InstRW<[M4WriteZ0], (instregex "^MOV[NZ][WX]i")>;
  551. // Divide and multiply instructions.
  552. // Miscellaneous instructions.
  553. // Load instructions.
  554. def : InstRW<[M4WriteLD,
  555. WriteLDHi,
  556. WriteAdr], (instregex "^LDP(SW|W|X)(post|pre)")>;
  557. def : InstRW<[M4WriteL5,
  558. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roW")>;
  559. def : InstRW<[WriteLDIdx,
  560. ReadAdrBase], (instregex "^LDR(BB|SBW|SBX|HH|SHW|SHX|SW|W|X)roX")>;
  561. def : InstRW<[M4WriteL5,
  562. ReadAdrBase], (instrs PRFMroW)>;
  563. def : InstRW<[WriteLDIdx,
  564. ReadAdrBase], (instrs PRFMroX)>;
  565. // Store instructions.
  566. def : InstRW<[M4WriteSB,
  567. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roW")>;
  568. def : InstRW<[WriteST,
  569. ReadAdrBase], (instregex "^STR(BB|HH|W|X)roX")>;
  570. // FP data instructions.
  571. def : InstRW<[M4WriteNSHF1H], (instrs FABSHr)>;
  572. def : InstRW<[M4WriteNSHF1], (instregex "^FABS[SD]r")>;
  573. def : InstRW<[M4WriteFADD2H], (instregex "^F(ADD|SUB)Hrr")>;
  574. def : InstRW<[M4WriteFADD2], (instregex "^F(ADD|SUB)[SD]rr")>;
  575. def : InstRW<[M4WriteFADD2H], (instregex "^FADDPv.i16")>;
  576. def : InstRW<[M4WriteFADD2], (instregex "^FADDPv.i(32|64)")>;
  577. def : InstRW<[M4WriteNEONQ], (instregex "^FCCMPE?[HSD]rr")>;
  578. def : InstRW<[M4WriteNMSC2], (instregex "^FCMPE?[HSD]r[ir]")>;
  579. def : InstRW<[M4WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)(16|32|64|v1)")>;
  580. def : InstRW<[M4WriteFDIV7H], (instrs FDIVHrr)>;
  581. def : InstRW<[M4WriteFDIV7], (instrs FDIVSrr)>;
  582. def : InstRW<[M4WriteFDIV12], (instrs FDIVDrr)>;
  583. def : InstRW<[M4WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?[HSD]rr")>;
  584. def : InstRW<[M4WriteFMAC3H], (instregex "^FN?MULHrr")>;
  585. def : InstRW<[M4WriteFMAC3], (instregex "^FN?MUL[SD]rr")>;
  586. def : InstRW<[M4WriteFMAC3H], (instrs FMULX16)>;
  587. def : InstRW<[M4WriteFMAC3], (instregex "^FMULX(32|64)")>;
  588. def : InstRW<[M4WriteFMAC4H,
  589. M4ReadFMACM1], (instregex "^FN?M(ADD|SUB)Hrrr")>;
  590. def : InstRW<[M4WriteFMAC4,
  591. M4ReadFMACM1], (instregex "^FN?M(ADD|SUB)[SD]rrr")>;
  592. def : InstRW<[M4WriteNALU1H], (instrs FNEGHr)>;
  593. def : InstRW<[M4WriteNALU1], (instregex "^FNEG[SD]r")>;
  594. def : InstRW<[M4WriteFCVT3A], (instregex "^FRINT.+r")>;
  595. def : InstRW<[M4WriteNEONH], (instregex "^FCSEL[HSD]rrr")>;
  596. def : InstRW<[M4WriteFSQR7H], (instrs FSQRTHr)>;
  597. def : InstRW<[M4WriteFSQR8], (instrs FSQRTSr)>;
  598. def : InstRW<[M4WriteFSQR12], (instrs FSQRTDr)>;
  599. // FP miscellaneous instructions.
  600. def : InstRW<[M4WriteFCVT2H], (instregex "^FCVTH[SD]r")>;
  601. def : InstRW<[M4WriteFCVT2H], (instregex "^FCVT[SD]Hr")>;
  602. def : InstRW<[M4WriteFCVT2], (instregex "^FCVT[SD][SD]r")>;
  603. def : InstRW<[M4WriteFCVT6A], (instregex "^[SU]CVTF[SU][XW][HSD]ri")>;
  604. def : InstRW<[M4WriteNEONR], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>;
  605. def : InstRW<[M4WriteNALU1], (instregex "^FMOV[HSD][ir]")>;
  606. def : InstRW<[M4WriteSA], (instregex "^FMOV[WX][HSD]r")>;
  607. def : InstRW<[M4WriteNEONJ], (instregex "^FMOV[HSD][WX]r")>;
  608. def : InstRW<[M4WriteNEONI], (instregex "^FMOVXDHighr")>;
  609. def : InstRW<[M4WriteNEONK], (instregex "^FMOVDXHighr")>;
  610. def : InstRW<[M4WriteFCVT3H], (instregex "^F(RECP|RSQRT)Ev1f16")>;
  611. def : InstRW<[M4WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev1i(32|64)")>;
  612. def : InstRW<[M4WriteNMSC1], (instregex "^FRECPXv1")>;
  613. def : InstRW<[M4WriteFMAC4H], (instregex "^F(RECP|RSQRT)S16")>;
  614. def : InstRW<[M4WriteFMAC4], (instregex "^F(RECP|RSQRT)S(32|64)")>;
  615. // FP load instructions.
  616. def : InstRW<[WriteVLD], (instregex "^LDR[SDQ]l")>;
  617. def : InstRW<[WriteVLD], (instregex "^LDUR[BHSDQ]i")>;
  618. def : InstRW<[WriteVLD,
  619. WriteAdr], (instregex "^LDR[BHSDQ](post|pre)")>;
  620. def : InstRW<[WriteVLD], (instregex "^LDR[BHSDQ]ui")>;
  621. def : InstRW<[M4WriteLE,
  622. ReadAdrBase], (instregex "^LDR[BHSDQ]roW")>;
  623. def : InstRW<[WriteVLD,
  624. ReadAdrBase], (instregex "^LDR[BHSD]roX")>;
  625. def : InstRW<[M4WriteLY,
  626. ReadAdrBase], (instrs LDRQroX)>;
  627. def : InstRW<[WriteVLD,
  628. M4WriteLH], (instregex "^LDN?P[SD]i")>;
  629. def : InstRW<[M4WriteLA,
  630. M4WriteLH], (instregex "^LDN?PQi")>;
  631. def : InstRW<[M4WriteL5,
  632. M4WriteLH,
  633. WriteAdr], (instregex "^LDP[SD]post")>;
  634. def : InstRW<[M4WriteLB,
  635. M4WriteLH,
  636. WriteAdr], (instrs LDPQpost)>;
  637. def : InstRW<[M4WriteLB,
  638. M4WriteLH,
  639. WriteAdr], (instregex "^LDP[SD]pre")>;
  640. def : InstRW<[M4WriteLC,
  641. M4WriteLH,
  642. WriteAdr], (instrs LDPQpre)>;
  643. // FP store instructions.
  644. def : InstRW<[WriteVST], (instregex "^STUR[BHSDQ]i")>;
  645. def : InstRW<[WriteVST,
  646. WriteAdr], (instregex "^STR[BHSDQ](post|pre)")>;
  647. def : InstRW<[WriteVST], (instregex "^STR[BHSDQ]ui")>;
  648. def : InstRW<[M4WriteVSTK,
  649. ReadAdrBase], (instregex "^STR[BHSD]roW")>;
  650. def : InstRW<[M4WriteVSTK,
  651. ReadAdrBase], (instrs STRQroW)>;
  652. def : InstRW<[WriteVST,
  653. ReadAdrBase], (instregex "^STR[BHSD]roX")>;
  654. def : InstRW<[M4WriteVSTY,
  655. ReadAdrBase], (instrs STRQroX)>;
  656. def : InstRW<[WriteVST], (instregex "^STN?P[SD]i")>;
  657. def : InstRW<[M4WriteVSTJ], (instregex "^STN?PQi")>;
  658. def : InstRW<[WriteVST,
  659. WriteAdr], (instregex "^STP[SD](post|pre)")>;
  660. def : InstRW<[M4WriteVSTJ,
  661. WriteAdr], (instregex "^STPQ(post|pre)")>;
  662. // ASIMD instructions.
  663. def : InstRW<[M4WriteNHAD1], (instregex "^[SU]ABDL?v")>;
  664. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]ABAL?v")>;
  665. def : InstRW<[M4WriteNMSC1], (instregex "^ABSv")>;
  666. def : InstRW<[M4WriteNALU1], (instregex "^(ADD|NEG|SUB)v")>;
  667. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]?ADDL?Pv")>;
  668. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]H(ADD|SUB)v")>;
  669. def : InstRW<[M4WriteNHAD3], (instregex "^[SU](ADD|SUB)[LW]v")>;
  670. def : InstRW<[M4WriteNHAD3], (instregex "^R?(ADD|SUB)HN2?v")>;
  671. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]Q(ADD|SUB)v")>;
  672. def : InstRW<[M4WriteNHAD3], (instregex "^(SU|US)QADDv")>;
  673. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]RHADDv")>;
  674. def : InstRW<[M4WriteNMSC1], (instregex "^SQ(ABS|NEG)v")>;
  675. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]?ADDL?Vv")>;
  676. def : InstRW<[M4WriteNMSC1], (instregex "^CM(EQ|GE|GT|HI|HS|LE|LT)v")>;
  677. def : InstRW<[M4WriteNALU1], (instregex "^CMTSTv")>;
  678. def : InstRW<[M4WriteNALU1], (instregex "^(AND|BIC|EOR|NOT|ORN|ORR)v")>;
  679. def : InstRW<[M4WriteNMSC1], (instregex "^[SU](MIN|MAX)v")>;
  680. def : InstRW<[M4WriteNMSC2], (instregex "^[SU](MIN|MAX)Pv")>;
  681. def : InstRW<[M4WriteNHAD3], (instregex "^[SU](MIN|MAX)Vv")>;
  682. def : InstRW<[M4WriteNMUL3,
  683. M4ReadNMULM1], (instregex "^ML[AS]v")>;
  684. def : InstRW<[M4WriteNMUL3,
  685. M4ReadNMULM1], (instregex "^(SQR?D)?MULH?v")>;
  686. def : InstRW<[M4WriteNMUL3,
  687. M4ReadNMULM1], (instregex "^SQRDML[AS]H")>;
  688. def : InstRW<[M4WriteNMUL3,
  689. M4ReadNMULM1], (instregex "^(S|U|SQD)ML[AS]L(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  690. def : InstRW<[M4WriteNMUL3,
  691. M4ReadNMULP2], (instregex "^(S|U|SQD)ML[AS]L(v4i32|v8i16|v16i8)")>;
  692. def : InstRW<[M4WriteNMUL3,
  693. M4ReadNMULM1], (instregex "^(S|U|SQD)MULL(v1(i32|i64)|v2i32|v4i16|v8i8)")>;
  694. def : InstRW<[M4WriteNMUL3,
  695. M4ReadNMULP2], (instregex "^(S|U|SQD)MULL(v4i32|v8i16|v16i8)")>;
  696. def : InstRW<[M4WriteNMUL3], (instregex "^[SU]DOT(lane)?v")>;
  697. def : InstRW<[M4WriteNHAD3], (instregex "^[SU]ADALPv")>;
  698. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]R?SRA[dv]")>;
  699. def : InstRW<[M4WriteNSHT1], (instregex "^SHL[dv]")>;
  700. def : InstRW<[M4WriteNSHT1], (instregex "^S[LR]I[dv]")>;
  701. def : InstRW<[M4WriteNSHT1], (instregex "^[SU]SH[LR][dv]")>;
  702. def : InstRW<[M4WriteNSHT2], (instregex "^[SU]?SHLLv")>;
  703. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]?Q?R?SHRU?N[bhsv]")>;
  704. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]RSH[LR][dv]")>;
  705. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]QR?SHLU?[bhsdv]")>;
  706. // ASIMD FP instructions.
  707. def : InstRW<[M4WriteNSHF1H], (instregex "^FABSv.f16")>;
  708. def : InstRW<[M4WriteNSHF1], (instregex "^FABSv.f(32|64)")>;
  709. def : InstRW<[M4WriteFADD2H], (instregex "^F(ABD|ADD|SUB)v.f16")>;
  710. def : InstRW<[M4WriteFADD2], (instregex "^F(ABD|ADD|SUB)v.f(32|64)")>;
  711. def : InstRW<[M4WriteFADD2H], (instregex "^FADDPv.f16")>;
  712. def : InstRW<[M4WriteFADD2], (instregex "^FADDPv.f(32|64)")>;
  713. def : InstRW<[M4WriteNMSC1], (instregex "^F(AC|CM)(EQ|GE|GT|LE|LT)v[^1]")>;
  714. def : InstRW<[M4WriteFCVT2], (instregex "^FCVT(L|N|XN)v")>;
  715. def : InstRW<[M4WriteFCVT2A], (instregex "^FCVT[AMNPZ][SU]v")>;
  716. def : InstRW<[M4WriteFCVT2H], (instregex "^[SU]CVTFv.[fi]16")>;
  717. def : InstRW<[M4WriteFCVT2], (instregex "^[SU]CVTFv.[fi](32|64)")>;
  718. def : InstRW<[M4WriteFDIV7H], (instrs FDIVv4f16)>;
  719. def : InstRW<[M4WriteNEONVH], (instrs FDIVv8f16)>;
  720. def : InstRW<[M4WriteFDIV7], (instrs FDIVv2f32)>;
  721. def : InstRW<[M4WriteNEONV], (instrs FDIVv4f32)>;
  722. def : InstRW<[M4WriteNEONW], (instrs FDIVv2f64)>;
  723. def : InstRW<[M4WriteNMSC1], (instregex "^F(MAX|MIN)(NM)?v")>;
  724. def : InstRW<[M4WriteNMSC2], (instregex "^F(MAX|MIN)(NM)?Pv")>;
  725. def : InstRW<[M4WriteNEONZ], (instregex "^F(MAX|MIN)(NM)?Vv")>;
  726. def : InstRW<[M4WriteFMAC2H], (instregex "^FMULX?v.[fi]16")>;
  727. def : InstRW<[M4WriteFMAC3], (instregex "^FMULX?v.[fi](32|64)")>;
  728. def : InstRW<[M4WriteFMAC4H,
  729. M4ReadFMACM1], (instregex "^FML[AS]v.[fi]16")>;
  730. def : InstRW<[M4WriteFMAC4,
  731. M4ReadFMACM1], (instregex "^FML[AS]v.[fi](32|64)")>;
  732. def : InstRW<[M4WriteNALU1H], (instregex "^FNEGv.f16")>;
  733. def : InstRW<[M4WriteNALU1], (instregex "^FNEGv.f(32|64)")>;
  734. def : InstRW<[M4WriteFCVT3A], (instregex "^FRINT[AIMNPXZ]v")>;
  735. def : InstRW<[M4WriteFSQR7H], (instrs FSQRTv4f16)>;
  736. def : InstRW<[M4WriteNEONXH], (instrs FSQRTv8f16)>;
  737. def : InstRW<[M4WriteFSQR8], (instrs FSQRTv2f32)>;
  738. def : InstRW<[M4WriteNEONX], (instrs FSQRTv4f32)>;
  739. def : InstRW<[M4WriteNEONY], (instrs FSQRTv2f64)>;
  740. // ASIMD miscellaneous instructions.
  741. def : InstRW<[M4WriteNALU1], (instregex "^RBITv")>;
  742. def : InstRW<[M4WriteNALU1], (instregex "^(BIF|BIT|BSL|BSP)v")>;
  743. def : InstRW<[M4WriteNALU1], (instregex "^CL[STZ]v")>;
  744. def : InstRW<[M4WriteNEONB], (instregex "^DUPv.+gpr")>;
  745. def : InstRW<[M4WriteNSHF1], (instregex "^DUP(i8|i16|i32|i64)$")>;
  746. def : InstRW<[M4WriteNSHF1], (instregex "^DUPv.+lane")>;
  747. def : InstRW<[M4WriteNSHF1], (instregex "^EXTv")>;
  748. def : InstRW<[M4WriteNSHT4A], (instregex "^XTNv")>;
  749. def : InstRW<[M4WriteNSHT4A], (instregex "^[SU]?QXTU?Nv")>;
  750. def : InstRW<[M4WriteNEONB], (instregex "^INSv.+gpr")>;
  751. def : InstRW<[M4WriteNSHF1], (instregex "^INSv.+lane")>;
  752. def : InstRW<[M4WriteMOVI], (instregex "^(MOV|MVN)I")>;
  753. def : InstRW<[M4WriteNALU1H], (instregex "^FMOVv.f16")>;
  754. def : InstRW<[M4WriteNALU1], (instregex "^FMOVv.f(32|64)")>;
  755. def : InstRW<[M4WriteFCVT3H], (instregex "^F(RECP|RSQRT)Ev[248]f16")>;
  756. def : InstRW<[M4WriteFCVT3], (instregex "^F(RECP|RSQRT)Ev[248]f(32|64)")>;
  757. def : InstRW<[M4WriteFCVT3], (instregex "^U(RECP|RSQRT)Ev[24]i32")>;
  758. def : InstRW<[M4WriteFMAC4H], (instregex "^F(RECP|RSQRT)Sv.f16")>;
  759. def : InstRW<[M4WriteFMAC4], (instregex "^F(RECP|RSQRT)Sv.f(32|64)")>;
  760. def : InstRW<[M4WriteNSHF1], (instregex "^REV(16|32|64)v")>;
  761. def : InstRW<[M4WriteNSHFA], (instregex "^TB[LX]v(8|16)i8One")>;
  762. def : InstRW<[M4WriteNSHFB], (instregex "^TB[LX]v(8|16)i8Two")>;
  763. def : InstRW<[M4WriteNSHFC], (instregex "^TB[LX]v(8|16)i8Three")>;
  764. def : InstRW<[M4WriteNSHFD], (instregex "^TB[LX]v(8|16)i8Four")>;
  765. def : InstRW<[M4WriteNEONP], (instregex "^[SU]MOVv")>;
  766. def : InstRW<[M4WriteNSHF1], (instregex "^(TRN|UZP|ZIP)[12]v")>;
  767. // ASIMD load instructions.
  768. def : InstRW<[WriteVLD], (instregex "LD1Onev(8b|4h|2s|1d)$")>;
  769. def : InstRW<[WriteVLD,
  770. M4WriteA1], (instregex "LD1Onev(8b|4h|2s|1d)_POST$")>;
  771. def : InstRW<[WriteVLD], (instregex "LD1Onev(16b|8h|4s|2d)$")>;
  772. def : InstRW<[WriteVLD,
  773. M4WriteA1], (instregex "LD1Onev(16b|8h|4s|2d)_POST$")>;
  774. def : InstRW<[M4WriteVLDA], (instregex "LD1Twov(8b|4h|2s|1d)$")>;
  775. def : InstRW<[M4WriteVLDA,
  776. M4WriteA1], (instregex "LD1Twov(8b|4h|2s|1d)_POST$")>;
  777. def : InstRW<[M4WriteVLDA], (instregex "LD1Twov(16b|8h|4s|2d)$")>;
  778. def : InstRW<[M4WriteVLDA,
  779. M4WriteA1], (instregex "LD1Twov(16b|8h|4s|2d)_POST$")>;
  780. def : InstRW<[M4WriteVLDB], (instregex "LD1Threev(8b|4h|2s|1d)$")>;
  781. def : InstRW<[M4WriteVLDB,
  782. M4WriteA1], (instregex "LD1Threev(8b|4h|2s|1d)_POST$")>;
  783. def : InstRW<[M4WriteVLDB], (instregex "LD1Threev(16b|8h|4s|2d)$")>;
  784. def : InstRW<[M4WriteVLDB,
  785. M4WriteA1], (instregex "LD1Threev(16b|8h|4s|2d)_POST$")>;
  786. def : InstRW<[M4WriteVLDC], (instregex "LD1Fourv(8b|4h|2s|1d)$")>;
  787. def : InstRW<[M4WriteVLDC,
  788. M4WriteA1], (instregex "LD1Fourv(8b|4h|2s|1d)_POST$")>;
  789. def : InstRW<[M4WriteVLDC], (instregex "LD1Fourv(16b|8h|4s|2d)$")>;
  790. def : InstRW<[M4WriteVLDC,
  791. M4WriteA1], (instregex "LD1Fourv(16b|8h|4s|2d)_POST$")>;
  792. def : InstRW<[M4WriteVLDD], (instregex "LD1i(8|16|32|64)$")>;
  793. def : InstRW<[M4WriteVLDD,
  794. M4WriteA1], (instregex "LD1i(8|16|32|64)_POST$")>;
  795. def : InstRW<[WriteVLD], (instregex "LD1Rv(8b|4h|2s|1d)$")>;
  796. def : InstRW<[WriteVLD,
  797. M4WriteA1], (instregex "LD1Rv(8b|4h|2s|1d)_POST$")>;
  798. def : InstRW<[WriteVLD], (instregex "LD1Rv(16b|8h|4s|2d)$")>;
  799. def : InstRW<[WriteVLD,
  800. M4WriteA1], (instregex "LD1Rv(16b|8h|4s|2d)_POST$")>;
  801. def : InstRW<[M4WriteVLDF], (instregex "LD2Twov(8b|4h|2s)$")>;
  802. def : InstRW<[M4WriteVLDF,
  803. M4WriteA1], (instregex "LD2Twov(8b|4h|2s)_POST$")>;
  804. def : InstRW<[M4WriteVLDF], (instregex "LD2Twov(16b|8h|4s|2d)$")>;
  805. def : InstRW<[M4WriteVLDF,
  806. M4WriteA1], (instregex "LD2Twov(16b|8h|4s|2d)_POST$")>;
  807. def : InstRW<[M4WriteVLDG], (instregex "LD2i(8|16|32|64)$")>;
  808. def : InstRW<[M4WriteVLDG,
  809. M4WriteA1], (instregex "LD2i(8|16|32|64)_POST$")>;
  810. def : InstRW<[M4WriteVLDA], (instregex "LD2Rv(8b|4h|2s|1d)$")>;
  811. def : InstRW<[M4WriteVLDA,
  812. M4WriteA1], (instregex "LD2Rv(8b|4h|2s|1d)_POST$")>;
  813. def : InstRW<[M4WriteVLDA], (instregex "LD2Rv(16b|8h|4s|2d)$")>;
  814. def : InstRW<[M4WriteVLDA,
  815. M4WriteA1], (instregex "LD2Rv(16b|8h|4s|2d)_POST$")>;
  816. def : InstRW<[M4WriteVLDI], (instregex "LD3Threev(8b|4h|2s)$")>;
  817. def : InstRW<[M4WriteVLDI,
  818. M4WriteA1], (instregex "LD3Threev(8b|4h|2s)_POST$")>;
  819. def : InstRW<[M4WriteVLDI], (instregex "LD3Threev(16b|8h|4s|2d)$")>;
  820. def : InstRW<[M4WriteVLDI,
  821. M4WriteA1], (instregex "LD3Threev(16b|8h|4s|2d)_POST$")>;
  822. def : InstRW<[M4WriteVLDJ], (instregex "LD3i(8|16|32)$")>;
  823. def : InstRW<[M4WriteVLDJ,
  824. M4WriteA1], (instregex "LD3i(8|16|32)_POST$")>;
  825. def : InstRW<[M4WriteVLDL], (instregex "LD3i64$")>;
  826. def : InstRW<[M4WriteVLDL,
  827. M4WriteA1], (instregex "LD3i64_POST$")>;
  828. def : InstRW<[M4WriteVLDB], (instregex "LD3Rv(8b|4h|2s|1d)$")>;
  829. def : InstRW<[M4WriteVLDB,
  830. M4WriteA1], (instregex "LD3Rv(8b|4h|2s|1d)_POST$")>;
  831. def : InstRW<[M4WriteVLDB], (instregex "LD3Rv(16b|8h|4s|2d)$")>;
  832. def : InstRW<[M4WriteVLDB,
  833. M4WriteA1], (instregex "LD3Rv(16b|8h|4s|2d)_POST$")>;
  834. def : InstRW<[M4WriteVLDN], (instregex "LD4Fourv(8b|4h|2s)$")>;
  835. def : InstRW<[M4WriteVLDN,
  836. M4WriteA1], (instregex "LD4Fourv(8b|4h|2s)_POST$")>;
  837. def : InstRW<[M4WriteVLDN], (instregex "LD4Fourv(16b|8h|4s|2d)$")>;
  838. def : InstRW<[M4WriteVLDN,
  839. M4WriteA1], (instregex "LD4Fourv(16b|8h|4s|2d)_POST$")>;
  840. def : InstRW<[M4WriteVLDK], (instregex "LD4i(8|16|32)$")>;
  841. def : InstRW<[M4WriteVLDK,
  842. M4WriteA1], (instregex "LD4i(8|16|32)_POST$")>;
  843. def : InstRW<[M4WriteVLDM], (instregex "LD4i64$")>;
  844. def : InstRW<[M4WriteVLDM,
  845. M4WriteA1], (instregex "LD4i64_POST$")>;
  846. def : InstRW<[M4WriteVLDC], (instregex "LD4Rv(8b|4h|2s|1d)$")>;
  847. def : InstRW<[M4WriteVLDC,
  848. M4WriteA1], (instregex "LD4Rv(8b|4h|2s|1d)_POST$")>;
  849. def : InstRW<[M4WriteVLDC], (instregex "LD4Rv(16b|8h|4s|2d)$")>;
  850. def : InstRW<[M4WriteVLDC,
  851. M4WriteA1], (instregex "LD4Rv(16b|8h|4s|2d)_POST$")>;
  852. // ASIMD store instructions.
  853. def : InstRW<[WriteVST], (instregex "ST1Onev(8b|4h|2s|1d)$")>;
  854. def : InstRW<[WriteVST,
  855. M4WriteA1], (instregex "ST1Onev(8b|4h|2s|1d)_POST$")>;
  856. def : InstRW<[WriteVST], (instregex "ST1Onev(16b|8h|4s|2d)$")>;
  857. def : InstRW<[WriteVST,
  858. M4WriteA1], (instregex "ST1Onev(16b|8h|4s|2d)_POST$")>;
  859. def : InstRW<[M4WriteVSTA], (instregex "ST1Twov(8b|4h|2s|1d)$")>;
  860. def : InstRW<[M4WriteVSTA,
  861. M4WriteA1], (instregex "ST1Twov(8b|4h|2s|1d)_POST$")>;
  862. def : InstRW<[M4WriteVSTA], (instregex "ST1Twov(16b|8h|4s|2d)$")>;
  863. def : InstRW<[M4WriteVSTA,
  864. M4WriteA1], (instregex "ST1Twov(16b|8h|4s|2d)_POST$")>;
  865. def : InstRW<[M4WriteVSTB], (instregex "ST1Threev(8b|4h|2s|1d)$")>;
  866. def : InstRW<[M4WriteVSTB,
  867. M4WriteA1], (instregex "ST1Threev(8b|4h|2s|1d)_POST$")>;
  868. def : InstRW<[M4WriteVSTB], (instregex "ST1Threev(16b|8h|4s|2d)$")>;
  869. def : InstRW<[M4WriteVSTB,
  870. M4WriteA1], (instregex "ST1Threev(16b|8h|4s|2d)_POST$")>;
  871. def : InstRW<[M4WriteVSTC], (instregex "ST1Fourv(8b|4h|2s|1d)$")>;
  872. def : InstRW<[M4WriteVSTC,
  873. M4WriteA1], (instregex "ST1Fourv(8b|4h|2s|1d)_POST$")>;
  874. def : InstRW<[M4WriteVSTC], (instregex "ST1Fourv(16b|8h|4s|2d)$")>;
  875. def : InstRW<[M4WriteVSTC,
  876. M4WriteA1], (instregex "ST1Fourv(16b|8h|4s|2d)_POST$")>;
  877. def : InstRW<[WriteVST], (instregex "ST1i(8|16|32|64)$")>;
  878. def : InstRW<[WriteVST,
  879. M4WriteA1], (instregex "ST1i(8|16|32|64)_POST$")>;
  880. def : InstRW<[M4WriteVSTD], (instregex "ST2Twov(8b|4h|2s)$")>;
  881. def : InstRW<[M4WriteVSTD,
  882. M4WriteA1], (instregex "ST2Twov(8b|4h|2s)_POST$")>;
  883. def : InstRW<[M4WriteVSTE], (instregex "ST2Twov(16b|8h|4s|2d)$")>;
  884. def : InstRW<[M4WriteVSTE,
  885. M4WriteA1], (instregex "ST2Twov(16b|8h|4s|2d)_POST$")>;
  886. def : InstRW<[M4WriteVSTD], (instregex "ST2i(8|16|32|64)$")>;
  887. def : InstRW<[M4WriteVSTD,
  888. M4WriteA1], (instregex "ST2i(8|16|32|64)_POST$")>;
  889. def : InstRW<[M4WriteVSTF], (instregex "ST3Threev(8b|4h|2s)$")>;
  890. def : InstRW<[M4WriteVSTF,
  891. M4WriteA1], (instregex "ST3Threev(8b|4h|2s)_POST$")>;
  892. def : InstRW<[M4WriteVSTG], (instregex "ST3Threev(16b|8h|4s|2d)$")>;
  893. def : InstRW<[M4WriteVSTG,
  894. M4WriteA1], (instregex "ST3Threev(16b|8h|4s|2d)_POST$")>;
  895. def : InstRW<[M4WriteVSTE], (instregex "ST3i(8|16|32|64)$")>;
  896. def : InstRW<[M4WriteVSTE,
  897. M4WriteA1], (instregex "ST3i(8|16|32|64)_POST$")>;
  898. def : InstRW<[M4WriteVSTL], (instregex "ST4Fourv(8b|4h|2s)$")>;
  899. def : InstRW<[M4WriteVSTL,
  900. M4WriteA1], (instregex "ST4Fourv(8b|4h|2s)_POST$")>;
  901. def : InstRW<[M4WriteVSTI], (instregex "ST4Fourv(16b|8h|4s|2d)$")>;
  902. def : InstRW<[M4WriteVSTI,
  903. M4WriteA1], (instregex "ST4Fourv(16b|8h|4s|2d)_POST$")>;
  904. def : InstRW<[M4WriteVSTE], (instregex "ST4i(8|16|32|64)$")>;
  905. def : InstRW<[M4WriteVSTE,
  906. M4WriteA1], (instregex "ST4i(8|16|32|64)_POST$")>;
  907. // Cryptography instructions.
  908. def : InstRW<[M4WriteNCRY1], (instregex "^AES[DE]")>;
  909. def : InstRW<[M4WriteNCRY1,
  910. M4ReadAESM1], (instregex "^AESI?MC")>;
  911. def : InstRW<[M4WriteNCRY1A], (instregex "^PMULv")>;
  912. def : InstRW<[M4WriteNCRY1A], (instregex "^PMULLv(1|8)i")>;
  913. def : InstRW<[M4WriteNCRY3A], (instregex "^PMULLv(2|16)i")>;
  914. def : InstRW<[M4WriteNCRY1A], (instregex "^SHA1([CHMP]|SU[01])")>;
  915. def : InstRW<[M4WriteNCRY1A], (instrs SHA256SU0rr)>;
  916. def : InstRW<[M4WriteNCRY5A], (instrs SHA256SU1rrr)>;
  917. def : InstRW<[M4WriteNCRY5A], (instrs SHA256H2rrr)>;
  918. // CRC instructions.
  919. def : InstRW<[M4WriteE2], (instregex "^CRC32C?[BHWX]rr$")>;
  920. } // SchedModel = ExynosM4Model