AArch64SchedExynosM5.td 51 KB

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