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