AArch64SchedA55.td 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. //==- AArch64SchedCortexA55.td - ARM Cortex-A55 Scheduling Definitions -*- tablegen -*-=//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the machine model for the ARM Cortex-A55 processors. Note
  10. // that this schedule is currently used as the default for -mcpu=generic. As a
  11. // result, some of the modelling decision made do not precisely model the
  12. // Cortex-A55, instead aiming to be a good compromise between different cpus.
  13. //
  14. //===----------------------------------------------------------------------===//
  15. // ===---------------------------------------------------------------------===//
  16. // The following definitions describe the per-operand machine model.
  17. // This works with MachineScheduler. See MCSchedModel.h for details.
  18. // Cortex-A55 machine model for scheduling and other instruction cost heuristics.
  19. def CortexA55Model : SchedMachineModel {
  20. let MicroOpBufferSize = 0; // The Cortex-A55 is an in-order processor
  21. let IssueWidth = 2; // It dual-issues under most circumstances
  22. let LoadLatency = 4; // Cycles for loads to access the cache. The
  23. // optimisation guide shows that most loads have
  24. // a latency of 3, but some have a latency of 4
  25. // or 5. Setting it 4 looked to be good trade-off.
  26. let MispredictPenalty = 8; // A branch direction mispredict.
  27. let PostRAScheduler = 1; // Enable PostRA scheduler pass.
  28. let CompleteModel = 0; // Covers instructions applicable to Cortex-A55.
  29. list<Predicate> UnsupportedFeatures = [HasSVE, HasMTE];
  30. // FIXME: Remove when all errors have been fixed.
  31. let FullInstRWOverlapCheck = 0;
  32. }
  33. //===----------------------------------------------------------------------===//
  34. // Define each kind of processor resource and number available.
  35. // Modeling each pipeline as a ProcResource using the BufferSize = 0 since the
  36. // Cortex-A55 is in-order.
  37. def CortexA55UnitALU : ProcResource<2> { let BufferSize = 0; } // Int ALU
  38. def CortexA55UnitMAC : ProcResource<1> { let BufferSize = 0; } // Int MAC, 64-bi wide
  39. def CortexA55UnitDiv : ProcResource<1> { let BufferSize = 0; } // Int Division, not pipelined
  40. def CortexA55UnitLd : ProcResource<1> { let BufferSize = 0; } // Load pipe
  41. def CortexA55UnitSt : ProcResource<1> { let BufferSize = 0; } // Store pipe
  42. def CortexA55UnitB : ProcResource<1> { let BufferSize = 0; } // Branch
  43. // The FP DIV/SQRT instructions execute totally differently from the FP ALU
  44. // instructions, which can mostly be dual-issued; that's why for now we model
  45. // them with 2 resources.
  46. def CortexA55UnitFPALU : ProcResource<2> { let BufferSize = 0; } // FP ALU
  47. def CortexA55UnitFPMAC : ProcResource<2> { let BufferSize = 0; } // FP MAC
  48. def CortexA55UnitFPDIV : ProcResource<1> { let BufferSize = 0; } // FP Div/SQRT, 64/128
  49. //===----------------------------------------------------------------------===//
  50. // Subtarget-specific SchedWrite types
  51. let SchedModel = CortexA55Model in {
  52. // These latencies are modeled without taking into account forwarding paths
  53. // (the software optimisation guide lists latencies taking into account
  54. // typical forwarding paths).
  55. def : WriteRes<WriteImm, [CortexA55UnitALU]> { let Latency = 3; } // MOVN, MOVZ
  56. def : WriteRes<WriteI, [CortexA55UnitALU]> { let Latency = 3; } // ALU
  57. def : WriteRes<WriteISReg, [CortexA55UnitALU]> { let Latency = 3; } // ALU of Shifted-Reg
  58. def : WriteRes<WriteIEReg, [CortexA55UnitALU]> { let Latency = 3; } // ALU of Extended-Reg
  59. def : WriteRes<WriteExtr, [CortexA55UnitALU]> { let Latency = 3; } // EXTR from a reg pair
  60. def : WriteRes<WriteIS, [CortexA55UnitALU]> { let Latency = 3; } // Shift/Scale
  61. // MAC
  62. def : WriteRes<WriteIM32, [CortexA55UnitMAC]> { let Latency = 4; } // 32-bit Multiply
  63. def : WriteRes<WriteIM64, [CortexA55UnitMAC]> { let Latency = 4; } // 64-bit Multiply
  64. // Div
  65. def : WriteRes<WriteID32, [CortexA55UnitDiv]> {
  66. let Latency = 8; let ResourceCycles = [8];
  67. }
  68. def : WriteRes<WriteID64, [CortexA55UnitDiv]> {
  69. let Latency = 8; let ResourceCycles = [8];
  70. }
  71. // Load
  72. def : WriteRes<WriteLD, [CortexA55UnitLd]> { let Latency = 3; }
  73. def : WriteRes<WriteLDIdx, [CortexA55UnitLd]> { let Latency = 4; }
  74. def : WriteRes<WriteLDHi, [CortexA55UnitLd]> { let Latency = 5; }
  75. // Vector Load - Vector loads take 1-5 cycles to issue. For the WriteVecLd
  76. // below, choosing the median of 3 which makes the latency 6.
  77. // An extra cycle is needed to get the swizzling right.
  78. def : WriteRes<WriteVLD, [CortexA55UnitLd]> { let Latency = 6;
  79. let ResourceCycles = [3]; }
  80. def CortexA55WriteVLD1 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 4; }
  81. def CortexA55WriteVLD1SI : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 4; let SingleIssue = 1; }
  82. def CortexA55WriteVLD2 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 5;
  83. let ResourceCycles = [2]; }
  84. def CortexA55WriteVLD3 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 6;
  85. let ResourceCycles = [3]; }
  86. def CortexA55WriteVLD4 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 7;
  87. let ResourceCycles = [4]; }
  88. def CortexA55WriteVLD5 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 8;
  89. let ResourceCycles = [5]; }
  90. def CortexA55WriteVLD6 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 9;
  91. let ResourceCycles = [6]; }
  92. def CortexA55WriteVLD7 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 10;
  93. let ResourceCycles = [7]; }
  94. def CortexA55WriteVLD8 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 11;
  95. let ResourceCycles = [8]; }
  96. def CortexA55WriteLDP1 : SchedWriteRes<[]> { let Latency = 4; }
  97. def CortexA55WriteLDP2 : SchedWriteRes<[CortexA55UnitLd]> { let Latency = 5; }
  98. def CortexA55WriteLDP4 : SchedWriteRes<[CortexA55UnitLd, CortexA55UnitLd, CortexA55UnitLd, CortexA55UnitLd, CortexA55UnitLd]> { let Latency = 6; }
  99. // Pre/Post Indexing - Performed as part of address generation
  100. def : WriteRes<WriteAdr, []> { let Latency = 0; }
  101. // Store
  102. let RetireOOO = 1 in {
  103. def : WriteRes<WriteST, [CortexA55UnitSt]> { let Latency = 1; }
  104. def : WriteRes<WriteSTP, [CortexA55UnitSt]> { let Latency = 1; }
  105. def : WriteRes<WriteSTIdx, [CortexA55UnitSt]> { let Latency = 1; }
  106. }
  107. def : WriteRes<WriteSTX, [CortexA55UnitSt]> { let Latency = 4; }
  108. // Vector Store - Similar to vector loads, can take 1-3 cycles to issue.
  109. def : WriteRes<WriteVST, [CortexA55UnitSt]> { let Latency = 5;
  110. let ResourceCycles = [2];}
  111. def CortexA55WriteVST1 : SchedWriteRes<[CortexA55UnitSt]> { let Latency = 4; }
  112. def CortexA55WriteVST2 : SchedWriteRes<[CortexA55UnitSt]> { let Latency = 5;
  113. let ResourceCycles = [2]; }
  114. def CortexA55WriteVST3 : SchedWriteRes<[CortexA55UnitSt]> { let Latency = 6;
  115. let ResourceCycles = [3]; }
  116. def CortexA55WriteVST4 : SchedWriteRes<[CortexA55UnitSt]> { let Latency = 5;
  117. let ResourceCycles = [4]; }
  118. def : WriteRes<WriteAtomic, []> { let Unsupported = 1; }
  119. // Branch
  120. def : WriteRes<WriteBr, [CortexA55UnitB]>;
  121. def : WriteRes<WriteBrReg, [CortexA55UnitB]>;
  122. def : WriteRes<WriteSys, [CortexA55UnitB]>;
  123. def : WriteRes<WriteBarrier, [CortexA55UnitB]>;
  124. def : WriteRes<WriteHint, [CortexA55UnitB]>;
  125. // FP ALU
  126. // As WriteF result is produced in F5 and it can be mostly forwarded
  127. // to consumer at F1, the effectively latency is set as 4.
  128. def : WriteRes<WriteF, [CortexA55UnitFPALU]> { let Latency = 4; }
  129. def : WriteRes<WriteFCmp, [CortexA55UnitFPALU]> { let Latency = 3; }
  130. def : WriteRes<WriteFCvt, [CortexA55UnitFPALU]> { let Latency = 4; }
  131. def : WriteRes<WriteFCopy, [CortexA55UnitFPALU]> { let Latency = 3; }
  132. def : WriteRes<WriteFImm, [CortexA55UnitFPALU]> { let Latency = 3; }
  133. // NEON
  134. class CortexA55WriteVd<int n, ProcResourceKind res> : SchedWriteRes<[res]> {
  135. let Latency = n;
  136. }
  137. class CortexA55WriteVq<int n, ProcResourceKind res> : SchedWriteRes<[res, res]> {
  138. let Latency = n;
  139. let BeginGroup = 1;
  140. }
  141. def CortexA55WriteDotScVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  142. def CortexA55WriteDotVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  143. def CortexA55WriteDotVd_4 : CortexA55WriteVd<4, CortexA55UnitFPALU>;
  144. def CortexA55WriteMlaLVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  145. def CortexA55WriteMlaIxVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  146. def CortexA55WriteMlaVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  147. def CortexA55WriteMlaVd_4 : CortexA55WriteVd<4, CortexA55UnitFPALU>;
  148. def CortexA55WriteAluVq_4 : CortexA55WriteVq<4, CortexA55UnitFPALU>;
  149. def CortexA55WriteAluVd_3 : CortexA55WriteVd<3, CortexA55UnitFPALU>;
  150. def CortexA55WriteAluVq_3 : CortexA55WriteVq<3, CortexA55UnitFPALU>;
  151. def CortexA55WriteAluVd_2 : CortexA55WriteVd<2, CortexA55UnitFPALU>;
  152. def CortexA55WriteAluVq_2 : CortexA55WriteVq<2, CortexA55UnitFPALU>;
  153. def CortexA55WriteAluVd_1 : CortexA55WriteVd<1, CortexA55UnitFPALU>;
  154. def CortexA55WriteAluVq_1 : CortexA55WriteVq<1, CortexA55UnitFPALU>;
  155. def : SchedAlias<WriteVd, CortexA55WriteVd<4, CortexA55UnitFPALU>>;
  156. def : SchedAlias<WriteVq, CortexA55WriteVq<4, CortexA55UnitFPALU>>;
  157. // FP ALU specific new schedwrite definitions
  158. def CortexA55WriteFPALU_F2 : SchedWriteRes<[CortexA55UnitFPALU]> { let Latency = 2;}
  159. def CortexA55WriteFPALU_F3 : SchedWriteRes<[CortexA55UnitFPALU]> { let Latency = 3;}
  160. def CortexA55WriteFPALU_F4 : SchedWriteRes<[CortexA55UnitFPALU]> { let Latency = 4;}
  161. def CortexA55WriteFPALU_F5 : SchedWriteRes<[CortexA55UnitFPALU]> { let Latency = 5;}
  162. // FP Mul, Div, Sqrt. Div/Sqrt are not pipelined
  163. def : WriteRes<WriteFMul, [CortexA55UnitFPMAC]> { let Latency = 4; }
  164. let RetireOOO = 1 in {
  165. def : WriteRes<WriteFDiv, [CortexA55UnitFPDIV]> { let Latency = 22;
  166. let ResourceCycles = [29]; }
  167. def CortexA55WriteFMAC : SchedWriteRes<[CortexA55UnitFPMAC]> { let Latency = 4; }
  168. def CortexA55WriteFDivHP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 8;
  169. let ResourceCycles = [5]; }
  170. def CortexA55WriteFDivSP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 13;
  171. let ResourceCycles = [10]; }
  172. def CortexA55WriteFDivDP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 22;
  173. let ResourceCycles = [19]; }
  174. def CortexA55WriteFSqrtHP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 8;
  175. let ResourceCycles = [5]; }
  176. def CortexA55WriteFSqrtSP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 12;
  177. let ResourceCycles = [9]; }
  178. def CortexA55WriteFSqrtDP : SchedWriteRes<[CortexA55UnitFPDIV]> { let Latency = 22;
  179. let ResourceCycles = [19]; }
  180. }
  181. //===----------------------------------------------------------------------===//
  182. // Subtarget-specific SchedRead types.
  183. def : ReadAdvance<ReadVLD, 0>;
  184. def : ReadAdvance<ReadExtrHi, 1>;
  185. def : ReadAdvance<ReadAdrBase, 1>;
  186. def : ReadAdvance<ReadST, 1>;
  187. // ALU - ALU input operands are generally needed in EX1. An operand produced in
  188. // in say EX2 can be forwarded for consumption to ALU in EX1, thereby
  189. // allowing back-to-back ALU operations such as add. If an operand requires
  190. // a shift, it will, however, be required in ISS stage.
  191. def : ReadAdvance<ReadI, 2, [WriteImm,WriteI,
  192. WriteISReg, WriteIEReg,WriteIS,
  193. WriteID32,WriteID64,
  194. WriteIM32,WriteIM64]>;
  195. // Shifted operand
  196. def CortexA55ReadShifted : SchedReadAdvance<1, [WriteImm,WriteI,
  197. WriteISReg, WriteIEReg,WriteIS,
  198. WriteID32,WriteID64,
  199. WriteIM32,WriteIM64]>;
  200. def CortexA55ReadNotShifted : SchedReadAdvance<2, [WriteImm,WriteI,
  201. WriteISReg, WriteIEReg,WriteIS,
  202. WriteID32,WriteID64,
  203. WriteIM32,WriteIM64]>;
  204. def CortexA55ReadISReg : SchedReadVariant<[
  205. SchedVar<RegShiftedPred, [CortexA55ReadShifted]>,
  206. SchedVar<NoSchedPred, [CortexA55ReadNotShifted]>]>;
  207. def : SchedAlias<ReadISReg, CortexA55ReadISReg>;
  208. def CortexA55ReadIEReg : SchedReadVariant<[
  209. SchedVar<RegExtendedPred, [CortexA55ReadShifted]>,
  210. SchedVar<NoSchedPred, [CortexA55ReadNotShifted]>]>;
  211. def : SchedAlias<ReadIEReg, CortexA55ReadIEReg>;
  212. // MUL
  213. def : ReadAdvance<ReadIM, 1, [WriteImm,WriteI,
  214. WriteISReg, WriteIEReg,WriteIS,
  215. WriteID32,WriteID64,
  216. WriteIM32,WriteIM64]>;
  217. def : ReadAdvance<ReadIMA, 2, [WriteImm,WriteI,
  218. WriteISReg, WriteIEReg,WriteIS,
  219. WriteID32,WriteID64,
  220. WriteIM32,WriteIM64]>;
  221. // Div
  222. def : ReadAdvance<ReadID, 1, [WriteImm,WriteI,
  223. WriteISReg, WriteIEReg,WriteIS,
  224. WriteID32,WriteID64,
  225. WriteIM32,WriteIM64]>;
  226. //===----------------------------------------------------------------------===//
  227. // Subtarget-specific InstRWs.
  228. //---
  229. // Miscellaneous
  230. //---
  231. def : InstRW<[CortexA55WriteVLD1SI,CortexA55WriteLDP1], (instregex "LDPS?Wi")>;
  232. def : InstRW<[CortexA55WriteVLD1,CortexA55WriteLDP1], (instregex "LDPSi")>;
  233. def : InstRW<[CortexA55WriteVLD1,CortexA55WriteLDP2], (instregex "LDP(X|D)i")>;
  234. def : InstRW<[CortexA55WriteVLD1,CortexA55WriteLDP4], (instregex "LDPQi")>;
  235. def : InstRW<[WriteAdr, CortexA55WriteVLD1SI,CortexA55WriteLDP1], (instregex "LDPS?W(pre|post)")>;
  236. def : InstRW<[WriteAdr, CortexA55WriteVLD1,CortexA55WriteLDP1], (instregex "LDPS(pre|post)")>;
  237. def : InstRW<[WriteAdr, CortexA55WriteVLD1,CortexA55WriteLDP2], (instregex "LDP(X|D)(pre|post)")>;
  238. def : InstRW<[WriteAdr, CortexA55WriteVLD1,CortexA55WriteLDP4], (instregex "LDPQ(pre|post)")>;
  239. def : InstRW<[WriteI], (instrs COPY)>;
  240. //---
  241. // Vector Loads - 64-bit per cycle
  242. //---
  243. // 1-element structures
  244. def : InstRW<[CortexA55WriteVLD1], (instregex "LD1i(8|16|32|64)$")>; // single element
  245. def : InstRW<[CortexA55WriteVLD1], (instregex "LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>; // replicate
  246. def : InstRW<[CortexA55WriteVLD1], (instregex "LD1Onev(8b|4h|2s|1d)$")>;
  247. def : InstRW<[CortexA55WriteVLD2], (instregex "LD1Onev(16b|8h|4s|2d)$")>;
  248. def : InstRW<[CortexA55WriteVLD2], (instregex "LD1Twov(8b|4h|2s|1d)$")>; // multiple structures
  249. def : InstRW<[CortexA55WriteVLD4], (instregex "LD1Twov(16b|8h|4s|2d)$")>;
  250. def : InstRW<[CortexA55WriteVLD3], (instregex "LD1Threev(8b|4h|2s|1d)$")>;
  251. def : InstRW<[CortexA55WriteVLD6], (instregex "LD1Threev(16b|8h|4s|2d)$")>;
  252. def : InstRW<[CortexA55WriteVLD4], (instregex "LD1Fourv(8b|4h|2s|1d)$")>;
  253. def : InstRW<[CortexA55WriteVLD8], (instregex "LD1Fourv(16b|8h|4s|2d)$")>;
  254. def : InstRW<[CortexA55WriteVLD1, WriteAdr], (instregex "LD1i(8|16|32|64)_POST$")>;
  255. def : InstRW<[CortexA55WriteVLD1, WriteAdr], (instregex "LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  256. def : InstRW<[CortexA55WriteVLD1, WriteAdr], (instregex "LD1Onev(8b|4h|2s|1d)_POST$")>;
  257. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD1Onev(16b|8h|4s|2d)_POST$")>;
  258. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD1Twov(8b|4h|2s|1d)_POST$")>;
  259. def : InstRW<[CortexA55WriteVLD4, WriteAdr], (instregex "LD1Twov(16b|8h|4s|2d)_POST$")>;
  260. def : InstRW<[CortexA55WriteVLD3, WriteAdr], (instregex "LD1Threev(8b|4h|2s|1d)_POST$")>;
  261. def : InstRW<[CortexA55WriteVLD6, WriteAdr], (instregex "LD1Threev(16b|8h|4s|2d)_POST$")>;
  262. def : InstRW<[CortexA55WriteVLD4, WriteAdr], (instregex "LD1Fourv(8b|4h|2s|1d)_POST$")>;
  263. def : InstRW<[CortexA55WriteVLD8, WriteAdr], (instregex "LD1Fourv(16b|8h|4s|2d)_POST$")>;
  264. // 2-element structures
  265. def : InstRW<[CortexA55WriteVLD2], (instregex "LD2i(8|16|32|64)$")>;
  266. def : InstRW<[CortexA55WriteVLD2], (instregex "LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  267. def : InstRW<[CortexA55WriteVLD2], (instregex "LD2Twov(8b|4h|2s)$")>;
  268. def : InstRW<[CortexA55WriteVLD4], (instregex "LD2Twov(16b|8h|4s|2d)$")>;
  269. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD2i(8|16|32|64)(_POST)?$")>;
  270. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)(_POST)?$")>;
  271. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD2Twov(8b|4h|2s)(_POST)?$")>;
  272. def : InstRW<[CortexA55WriteVLD4, WriteAdr], (instregex "LD2Twov(16b|8h|4s|2d)(_POST)?$")>;
  273. // 3-element structures
  274. def : InstRW<[CortexA55WriteVLD2], (instregex "LD3i(8|16|32|64)$")>;
  275. def : InstRW<[CortexA55WriteVLD2], (instregex "LD3Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  276. def : InstRW<[CortexA55WriteVLD3], (instregex "LD3Threev(8b|4h|2s|1d)$")>;
  277. def : InstRW<[CortexA55WriteVLD6], (instregex "LD3Threev(16b|8h|4s|2d)$")>;
  278. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD3i(8|16|32|64)_POST$")>;
  279. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD3Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  280. def : InstRW<[CortexA55WriteVLD3, WriteAdr], (instregex "LD3Threev(8b|4h|2s|1d)_POST$")>;
  281. def : InstRW<[CortexA55WriteVLD6, WriteAdr], (instregex "LD3Threev(16b|8h|4s|2d)_POST$")>;
  282. // 4-element structures
  283. def : InstRW<[CortexA55WriteVLD2], (instregex "LD4i(8|16|32|64)$")>; // load single 4-el structure to one lane of 4 regs.
  284. def : InstRW<[CortexA55WriteVLD2], (instregex "LD4Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>; // load single 4-el structure, replicate to all lanes of 4 regs.
  285. def : InstRW<[CortexA55WriteVLD4], (instregex "LD4Fourv(8b|4h|2s|1d)$")>; // load multiple 4-el structures to 4 regs.
  286. def : InstRW<[CortexA55WriteVLD8], (instregex "LD4Fourv(16b|8h|4s|2d)$")>;
  287. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD4i(8|16|32|64)_POST$")>;
  288. def : InstRW<[CortexA55WriteVLD2, WriteAdr], (instregex "LD4Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  289. def : InstRW<[CortexA55WriteVLD4, WriteAdr], (instregex "LD4Fourv(8b|4h|2s|1d)_POST$")>;
  290. def : InstRW<[CortexA55WriteVLD8, WriteAdr], (instregex "LD4Fourv(16b|8h|4s|2d)_POST$")>;
  291. //---
  292. // Vector Stores
  293. //---
  294. def : InstRW<[CortexA55WriteVST1], (instregex "ST1i(8|16|32|64)$")>;
  295. def : InstRW<[CortexA55WriteVST1], (instregex "ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  296. def : InstRW<[CortexA55WriteVST1], (instregex "ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  297. def : InstRW<[CortexA55WriteVST2], (instregex "ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  298. def : InstRW<[CortexA55WriteVST4], (instregex "ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  299. def : InstRW<[CortexA55WriteVST1, WriteAdr], (instregex "ST1i(8|16|32|64)_POST$")>;
  300. def : InstRW<[CortexA55WriteVST1, WriteAdr], (instregex "ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  301. def : InstRW<[CortexA55WriteVST1, WriteAdr], (instregex "ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  302. def : InstRW<[CortexA55WriteVST2, WriteAdr], (instregex "ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  303. def : InstRW<[CortexA55WriteVST4, WriteAdr], (instregex "ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  304. def : InstRW<[CortexA55WriteVST2], (instregex "ST2i(8|16|32|64)$")>;
  305. def : InstRW<[CortexA55WriteVST2], (instregex "ST2Twov(8b|4h|2s)$")>;
  306. def : InstRW<[CortexA55WriteVST4], (instregex "ST2Twov(16b|8h|4s|2d)$")>;
  307. def : InstRW<[CortexA55WriteVST2, WriteAdr], (instregex "ST2i(8|16|32|64)_POST$")>;
  308. def : InstRW<[CortexA55WriteVST2, WriteAdr], (instregex "ST2Twov(8b|4h|2s)_POST$")>;
  309. def : InstRW<[CortexA55WriteVST4, WriteAdr], (instregex "ST2Twov(16b|8h|4s|2d)_POST$")>;
  310. def : InstRW<[CortexA55WriteVST2], (instregex "ST3i(8|16|32|64)$")>;
  311. def : InstRW<[CortexA55WriteVST4], (instregex "ST3Threev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  312. def : InstRW<[CortexA55WriteVST2, WriteAdr], (instregex "ST3i(8|16|32|64)_POST$")>;
  313. def : InstRW<[CortexA55WriteVST4, WriteAdr], (instregex "ST3Threev(8b|4h|2s|1d|2d|16b|8h|4s|4d)_POST$")>;
  314. def : InstRW<[CortexA55WriteVST2], (instregex "ST4i(8|16|32|64)$")>;
  315. def : InstRW<[CortexA55WriteVST4], (instregex "ST4Fourv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
  316. def : InstRW<[CortexA55WriteVST2, WriteAdr], (instregex "ST4i(8|16|32|64)_POST$")>;
  317. def : InstRW<[CortexA55WriteVST4, WriteAdr], (instregex "ST4Fourv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;
  318. //---
  319. // Floating Point Conversions, MAC, DIV, SQRT
  320. //---
  321. def : InstRW<[CortexA55WriteFPALU_F2], (instregex "^DUP(v2i64|v4i32|v8i16|v16i8)")>;
  322. def : InstRW<[CortexA55WriteFPALU_F2], (instregex "^XTN")>;
  323. def : InstRW<[CortexA55WriteFPALU_F3], (instregex "^FCVT[ALMNPZ][SU](S|U)?(W|X)")>;
  324. def : InstRW<[CortexA55WriteFPALU_F4], (instregex "^FCVT(X)?[ALMNPXZ](S|U|N)?v")>;
  325. def : InstRW<[CortexA55WriteFPALU_F4], (instregex "^(S|U)CVTF(S|U)(W|X)(H|S|D)")>;
  326. def : InstRW<[CortexA55WriteFPALU_F4], (instregex "^(S|U)CVTF(h|s|d)")>;
  327. def : InstRW<[CortexA55WriteFPALU_F4], (instregex "^(S|U)CVTFv")>;
  328. def : InstRW<[CortexA55WriteFMAC], (instregex "^FN?M(ADD|SUB).*")>;
  329. def : InstRW<[CortexA55WriteFMAC], (instregex "^FML(A|S).*")>;
  330. def : InstRW<[CortexA55WriteFDivHP], (instrs FDIVHrr)>;
  331. def : InstRW<[CortexA55WriteFDivSP], (instrs FDIVSrr)>;
  332. def : InstRW<[CortexA55WriteFDivDP], (instrs FDIVDrr)>;
  333. def : InstRW<[CortexA55WriteFDivHP], (instregex "^FDIVv.*16$")>;
  334. def : InstRW<[CortexA55WriteFDivSP], (instregex "^FDIVv.*32$")>;
  335. def : InstRW<[CortexA55WriteFDivDP], (instregex "^FDIVv.*64$")>;
  336. def : InstRW<[CortexA55WriteFSqrtHP], (instregex "^.*SQRT.*16$")>;
  337. def : InstRW<[CortexA55WriteFSqrtSP], (instregex "^.*SQRT.*32$")>;
  338. def : InstRW<[CortexA55WriteFSqrtDP], (instregex "^.*SQRT.*64$")>;
  339. // 4.15. Advanced SIMD integer instructions
  340. // ASIMD absolute diff
  341. def : InstRW<[CortexA55WriteAluVd_3], (instregex "[SU]ABDv(2i32|4i16|8i8)")>;
  342. def : InstRW<[CortexA55WriteAluVq_3], (instregex "[SU]ABDv(16i8|4i32|8i16)")>;
  343. // ASIMD absolute diff accum
  344. def : InstRW<[CortexA55WriteAluVq_4], (instregex "[SU]ABAL?v")>;
  345. // ASIMD absolute diff long
  346. def : InstRW<[CortexA55WriteAluVq_3], (instregex "[SU]ABDLv")>;
  347. // ASIMD arith #1
  348. def : InstRW<[CortexA55WriteAluVd_2], (instregex "(ADD|SUB|NEG)v(1i64|2i32|4i16|8i8)",
  349. "[SU]R?HADDv(2i32|4i16|8i8)", "[SU]HSUBv(2i32|4i16|8i8)")>;
  350. def : InstRW<[CortexA55WriteAluVq_2], (instregex "(ADD|SUB|NEG)v(2i64|4i32|8i16|16i8)",
  351. "[SU]R?HADDv(8i16|4i32|16i8)", "[SU]HSUBv(8i16|4i32|16i8)")>;
  352. // ASIMD arith #2
  353. def : InstRW<[CortexA55WriteAluVd_3], (instregex "ABSv(1i64|2i32|4i16|8i8)$",
  354. "[SU]ADDLPv(2i32_v1i64|4i16_v2i32|8i8_v4i16)$",
  355. "([SU]QADD|[SU]QSUB|SQNEG|SUQADD|USQADD)v(1i16|1i32|1i64|1i8|2i32|4i16|8i8)$",
  356. "ADDPv(2i32|4i16|8i8)$")>;
  357. def : InstRW<[CortexA55WriteAluVq_3], (instregex "ABSv(2i64|4i32|8i16|16i8)$",
  358. "[SU]ADDLPv(16i8_v8i16|4i32_v2i64|8i16_v4i32)$",
  359. "([SU]QADD|[SU]QSUB|SQNEG|SUQADD|USQADD)v(16i8|2i64|4i32|8i16)$",
  360. "ADDPv(16i8|2i64|4i32|8i16)$")>;
  361. // ASIMD arith #3
  362. def : InstRW<[CortexA55WriteAluVq_3], (instregex "SADDLv", "UADDLv", "SADDWv",
  363. "UADDWv", "SSUBLv", "USUBLv", "SSUBWv", "USUBWv", "ADDHNv", "SUBHNv")>;
  364. // ASIMD arith #5
  365. def : InstRW<[CortexA55WriteAluVq_4], (instregex "RADDHNv", "RSUBHNv")>;
  366. // ASIMD arith, reduce
  367. def : InstRW<[CortexA55WriteAluVq_3], (instregex "ADDVv", "SADDLVv", "UADDLVv")>;
  368. // ASIMD compare #1
  369. def : InstRW<[CortexA55WriteAluVd_2], (instregex "CM(EQ|GE|GT|HI|HS|LE|LT)v(1i64|2i32|4i16|8i8)")>;
  370. def : InstRW<[CortexA55WriteAluVq_2], (instregex "CM(EQ|GE|GT|HI|HS|LE|LT)v(2i64|4i32|8i16|16i8)")>;
  371. // ASIMD compare #2
  372. def : InstRW<[CortexA55WriteAluVd_3], (instregex "CMTSTv(1i64|2i32|4i16|8i8)")>;
  373. def : InstRW<[CortexA55WriteAluVq_3], (instregex "CMTSTv(2i64|4i32|8i16|16i8)")>;
  374. // ASIMD logical $1
  375. def : InstRW<[CortexA55WriteAluVd_1], (instregex "(AND|EOR|NOT|ORN)v8i8",
  376. "(ORR|BIC)v(2i32|4i16|8i8)$", "MVNIv(2i|2s|4i16)")>;
  377. def : InstRW<[CortexA55WriteAluVq_1], (instregex "(AND|EOR|NOT|ORN)v16i8",
  378. "(ORR|BIC)v(16i8|4i32|8i16)$", "MVNIv(4i32|4s|8i16)")>;
  379. // ASIMD max/min, basic
  380. def : InstRW<[CortexA55WriteAluVd_2], (instregex "[SU](MIN|MAX)P?v(2i32|4i16|8i8)")>;
  381. def : InstRW<[CortexA55WriteAluVq_2], (instregex "[SU](MIN|MAX)P?v(16i8|4i132|8i16)")>;
  382. // SIMD max/min, reduce
  383. def : InstRW<[CortexA55WriteAluVq_4], (instregex "[SU](MAX|MIN)Vv")>;
  384. // ASIMD multiply, by element
  385. def : InstRW<[CortexA55WriteAluVq_4], (instregex "MULv(2i32|4i16|4i32|8i16)_indexed$",
  386. "SQR?DMULHv(1i16|1i32|2i32|4i16|4i32|8i16)_indexed$")>;
  387. // ASIMD multiply
  388. def : InstRW<[CortexA55WriteAluVd_3], (instrs PMULv8i8)>;
  389. def : InstRW<[CortexA55WriteAluVq_3], (instrs PMULv16i8)>;
  390. // ASIMD multiply accumulate
  391. def : InstRW<[CortexA55WriteMlaVd_4], (instregex "ML[AS]v(2i32|4i16|8i8)$")>;
  392. def : InstRW<[CortexA55WriteMlaVq_4], (instregex "ML[AS]v(16i8|4i32|8i16)$")>;
  393. def : InstRW<[CortexA55WriteMlaIxVq_4], (instregex "ML[AS]v(2i32|4i16|4i32|8i16)_indexed$")>;
  394. // ASIMD multiply accumulate half
  395. def : InstRW<[CortexA55WriteAluVq_4], (instregex "SQRDML[AS]H[vi]")>;
  396. // ASIMD multiply accumulate long
  397. def : InstRW<[CortexA55WriteMlaLVq_4], (instregex "[SU]ML[AS]Lv")>;
  398. // ASIMD multiply accumulate long #2
  399. def : InstRW<[CortexA55WriteAluVq_4], (instregex "SQDML[AS]L[iv]")>;
  400. // ASIMD dot product
  401. def : InstRW<[CortexA55WriteDotVd_4], (instregex "[SU]DOTv8i8")>;
  402. def : InstRW<[CortexA55WriteDotVq_4], (instregex "[SU]DOTv16i8")>;
  403. // ASIMD dot product, by scalar
  404. def : InstRW<[CortexA55WriteDotScVq_4], (instregex "[SU]DOTlanev")>;
  405. // ASIMD multiply long
  406. def : InstRW<[CortexA55WriteAluVq_4], (instregex "[SU]MULLv", "SQDMULL[iv]")>;
  407. // ASIMD polynomial (8x8) multiply long
  408. def : InstRW<[CortexA55WriteAluVq_3], (instrs PMULLv8i8, PMULLv16i8)>;
  409. // ASIMD pairwise add and accumulate
  410. def : InstRW<[CortexA55WriteAluVq_4], (instregex "[SU]ADALPv")>;
  411. // ASIMD shift accumulate
  412. def : InstRW<[CortexA55WriteAluVd_3], (instregex "[SU]SRA(d|v2i32|v4i16|v8i8)")>;
  413. def : InstRW<[CortexA55WriteAluVq_3], (instregex "[SU]SRAv(16i8|2i64|4i32|8i16)")>;
  414. // ASIMD shift accumulate #2
  415. def : InstRW<[CortexA55WriteAluVq_4], (instregex "[SU]RSRA[vd]")>;
  416. // ASIMD shift by immed
  417. def : InstRW<[CortexA55WriteAluVd_2], (instregex "SHLd$", "SHLv",
  418. "SLId$", "SRId$", "[SU]SHR[vd]", "SHRNv")>;
  419. // ASIMD shift by immed
  420. // SXTL and UXTL are aliases for SHLL
  421. def : InstRW<[CortexA55WriteAluVq_2], (instregex "[US]?SHLLv")>;
  422. // ASIMD shift by immed #2
  423. def : InstRW<[CortexA55WriteAluVd_3], (instregex "[SU]RSHR(d|v2i32|v4i16|v8i8)",
  424. "RSHRNv(2i32|4i16|8i8)")>;
  425. def : InstRW<[CortexA55WriteAluVq_3], (instregex "[SU]RSHRv(16i8|2i64|4i32|8i16)",
  426. "RSHRNv(16i8|4i32|8i16)")>;
  427. // ASIMD shift by register
  428. def : InstRW<[CortexA55WriteAluVd_2], (instregex "[SU]SHLv(1i64|2i32|4i16|8i8)")>;
  429. def : InstRW<[CortexA55WriteAluVq_2], (instregex "[SU]SHLv(2i64|4i32|8i16|16i8)")>;
  430. // ASIMD shift by register #2
  431. def : InstRW<[CortexA55WriteAluVd_3], (instregex "[SU]RSHLv(1i64|2i32|4i16|8i8)")>;
  432. def : InstRW<[CortexA55WriteAluVq_3], (instregex "[SU]RSHLv(2i64|4i32|8i16|16i8)")>;
  433. }