xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFiveP600.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1//==- RISCVSchedSiFiveP600.td - SiFiveP600 Scheduling 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//===----------------------------------------------------------------------===//
10
11/// c is true if mx has the worst case behavior compared to LMULs in MxList.
12/// On the SiFiveP600, the worst case LMUL is the Largest LMUL
13/// and the worst case sew is the smallest SEW for that LMUL.
14class SiFiveP600IsWorstCaseMX<string mx, list<string> MxList> {
15  string LLMUL = LargestLMUL<MxList>.r;
16  bit c = !eq(mx, LLMUL);
17}
18
19class SiFiveP600IsWorstCaseMXSEW<string mx, int sew, list<string> MxList, bit isF = 0> {
20  string LLMUL = LargestLMUL<MxList>.r;
21  int SSEW = SmallestSEW<mx, isF>.r;
22  bit c = !and(!eq(mx, LLMUL), !eq(sew, SSEW));
23}
24
25// 1 Micro-Op per cycle.
26class SiFiveP600GetLMulCycles<string mx> {
27  int c = !cond(
28    !eq(mx, "M1") : 1,
29    !eq(mx, "M2") : 2,
30    !eq(mx, "M4") : 4,
31    !eq(mx, "M8") : 8,
32    !eq(mx, "MF2") : 1,
33    !eq(mx, "MF4") : 1,
34    !eq(mx, "MF8") : 1
35  );
36}
37
38// Latency for segmented loads and stores are calculated as vl * nf.
39class SiFiveP600GetCyclesSegmented<string mx, int sew, int nf> {
40  defvar VLEN = 128;
41  defvar VLUpperBound = !cond(
42    !eq(mx, "M1") : !div(VLEN, sew),
43    !eq(mx, "M2") : !div(!mul(VLEN, 2), sew),
44    !eq(mx, "M4") : !div(!mul(VLEN, 4), sew),
45    !eq(mx, "M8") : !div(!mul(VLEN, 8), sew),
46    !eq(mx, "MF2") : !div(!div(VLEN, 2), sew),
47    !eq(mx, "MF4") : !div(!div(VLEN, 4), sew),
48    !eq(mx, "MF8") : !div(!div(VLEN, 8), sew),
49  );
50  int c = !mul(VLUpperBound, nf);
51}
52
53// SiFiveP600 machine model for scheduling and other instruction cost heuristics.
54def SiFiveP600Model : SchedMachineModel {
55  let IssueWidth = 4;         // 4 micro-ops are dispatched per cycle.
56  let MicroOpBufferSize = 160; // Max micro-ops that can be buffered.
57  let LoadLatency = 4;        // Cycles for loads to access the cache.
58  let MispredictPenalty = 9;  // Extra cycles for a mispredicted branch.
59  let UnsupportedFeatures = [HasStdExtZbkb, HasStdExtZbkc, HasStdExtZbkx,
60                             HasStdExtZknd, HasStdExtZkne, HasStdExtZknh,
61                             HasStdExtZksed, HasStdExtZksh, HasStdExtZkr,
62                             HasVendorXSfvqmaccqoq];
63  let CompleteModel = false;
64}
65
66let SchedModel = SiFiveP600Model in {
67
68def SiFiveP600IEXQ0       : ProcResource<1>;
69def SiFiveP600IEXQ1       : ProcResource<1>;
70def SiFiveP600IEXQ2       : ProcResource<1>;
71def SiFiveP600IEXQ3       : ProcResource<1>;
72def SiFiveP600FEXQ0       : ProcResource<1>;
73def SiFiveP600FEXQ1       : ProcResource<1>;
74
75// Two Load/Store ports that can issue either two loads, two stores, or one load
76// and one store (P550 has one load and one separate store pipe).
77def SiFiveP600LDST       : ProcResource<2>;
78
79// 4-wide pipeline with 4 ALU pipes.
80def SiFiveP600IntArith    : ProcResGroup<[SiFiveP600IEXQ0, SiFiveP600IEXQ1, SiFiveP600IEXQ2, SiFiveP600IEXQ3]>;
81defvar SiFiveP600SYS      = SiFiveP600IEXQ0;
82defvar SiFiveP600CMOV     = SiFiveP600IEXQ0;
83defvar SiFiveP600MulI2F   = SiFiveP600IEXQ1;
84def SiFiveP600Branch      : ProcResGroup<[SiFiveP600IEXQ2, SiFiveP600IEXQ3]>;
85def SiFiveP600Div         : ProcResource<1>;
86
87def SiFiveP600FloatArith  : ProcResGroup<[SiFiveP600FEXQ0, SiFiveP600FEXQ1]>;
88defvar SiFiveP600F2I      = SiFiveP600FEXQ0;
89def SiFiveP600FloatDiv    : ProcResource<1>;
90
91// Vector pipeline
92// VEXQ0 handle Mask, Simple Slide instructions,
93// VEXQ1 handle Complex Slide, Permutation, Reductions, Divide instructions.
94// Other vector instructions can be done in VEXQ0 and VEXQ1.
95def SiFiveP600VEXQ0        : ProcResource<1>;
96def SiFiveP600VEXQ1        : ProcResource<1>;
97def SiFiveP600VectorArith  : ProcResGroup<[SiFiveP600VEXQ0, SiFiveP600VEXQ1]>;
98def SiFiveP600VLD          : ProcResource<1>;
99def SiFiveP600VST          : ProcResource<1>;
100def SiFiveP600VDiv         : ProcResource<1>;
101def SiFiveP600VFloatDiv    : ProcResource<1>;
102
103// Integer arithmetic and logic
104def : WriteRes<WriteIALU, [SiFiveP600IntArith]>;
105def : WriteRes<WriteIALU32, [SiFiveP600IntArith]>;
106def : WriteRes<WriteShiftImm, [SiFiveP600IntArith]>;
107def : WriteRes<WriteShiftImm32, [SiFiveP600IntArith]>;
108def : WriteRes<WriteShiftReg, [SiFiveP600IntArith]>;
109def : WriteRes<WriteShiftReg32, [SiFiveP600IntArith]>;
110// Branching
111def : WriteRes<WriteJmp, [SiFiveP600Branch]>;
112def : WriteRes<WriteJal, [SiFiveP600Branch]>;
113def : WriteRes<WriteJalr, [SiFiveP600Branch]>;
114
115// CMOV
116def P600WriteCMOV : SchedWriteRes<[SiFiveP600Branch, SiFiveP600CMOV]> {
117  let Latency = 2;
118  let NumMicroOps = 2;
119}
120def : InstRW<[P600WriteCMOV], (instrs PseudoCCMOVGPRNoX0)>;
121
122let Latency = 3 in {
123// Integer multiplication
124def : WriteRes<WriteIMul, [SiFiveP600MulI2F]>;
125def : WriteRes<WriteIMul32, [SiFiveP600MulI2F]>;
126// cpop[w] look exactly like multiply.
127def : WriteRes<WriteCPOP, [SiFiveP600MulI2F]>;
128def : WriteRes<WriteCPOP32, [SiFiveP600MulI2F]>;
129}
130
131// Integer division
132def : WriteRes<WriteIDiv, [SiFiveP600MulI2F, SiFiveP600Div]> {
133  let Latency = 35;
134  let ReleaseAtCycles = [1, 34];
135}
136def : WriteRes<WriteIDiv32,  [SiFiveP600MulI2F, SiFiveP600Div]> {
137  let Latency = 20;
138  let ReleaseAtCycles = [1, 19];
139}
140
141// Integer remainder
142def : WriteRes<WriteIRem, [SiFiveP600MulI2F, SiFiveP600Div]> {
143  let Latency = 35;
144  let ReleaseAtCycles = [1, 34];
145}
146def : WriteRes<WriteIRem32, [SiFiveP600MulI2F, SiFiveP600Div]> {
147  let Latency = 20;
148  let ReleaseAtCycles = [1, 19];
149}
150
151// Bitmanip
152def : WriteRes<WriteRotateImm, [SiFiveP600IntArith]>;
153def : WriteRes<WriteRotateImm32, [SiFiveP600IntArith]>;
154def : WriteRes<WriteRotateReg, [SiFiveP600IntArith]>;
155def : WriteRes<WriteRotateReg32, [SiFiveP600IntArith]>;
156
157def : WriteRes<WriteCLZ, [SiFiveP600IntArith]>;
158def : WriteRes<WriteCLZ32, [SiFiveP600IntArith]>;
159def : WriteRes<WriteCTZ, [SiFiveP600IntArith]>;
160def : WriteRes<WriteCTZ32, [SiFiveP600IntArith]>;
161
162def : WriteRes<WriteORCB, [SiFiveP600IntArith]>;
163def : WriteRes<WriteIMinMax, [SiFiveP600IntArith]>;
164
165def : WriteRes<WriteREV8, [SiFiveP600IntArith]>;
166
167def : WriteRes<WriteSHXADD, [SiFiveP600IntArith]>;
168def : WriteRes<WriteSHXADD32, [SiFiveP600IntArith]>;
169
170def : WriteRes<WriteSingleBit, [SiFiveP600IntArith]>;
171def : WriteRes<WriteSingleBitImm, [SiFiveP600IntArith]>;
172def : WriteRes<WriteBEXT, [SiFiveP600IntArith]>;
173def : WriteRes<WriteBEXTI, [SiFiveP600IntArith]>;
174
175// Memory
176def : WriteRes<WriteSTB, [SiFiveP600LDST]>;
177def : WriteRes<WriteSTH, [SiFiveP600LDST]>;
178def : WriteRes<WriteSTW, [SiFiveP600LDST]>;
179def : WriteRes<WriteSTD, [SiFiveP600LDST]>;
180def : WriteRes<WriteFST16, [SiFiveP600LDST]>;
181def : WriteRes<WriteFST32, [SiFiveP600LDST]>;
182def : WriteRes<WriteFST64, [SiFiveP600LDST]>;
183
184let Latency = 4 in {
185def : WriteRes<WriteLDB, [SiFiveP600LDST]>;
186def : WriteRes<WriteLDH, [SiFiveP600LDST]>;
187}
188let Latency = 4 in {
189def : WriteRes<WriteLDW, [SiFiveP600LDST]>;
190def : WriteRes<WriteLDD, [SiFiveP600LDST]>;
191}
192
193let Latency = 5 in {
194def : WriteRes<WriteFLD16, [SiFiveP600LDST]>;
195def : WriteRes<WriteFLD32, [SiFiveP600LDST]>;
196def : WriteRes<WriteFLD64, [SiFiveP600LDST]>;
197}
198
199// Atomic memory
200let Latency = 3 in {
201def : WriteRes<WriteAtomicSTW, [SiFiveP600LDST]>;
202def : WriteRes<WriteAtomicSTD, [SiFiveP600LDST]>;
203def : WriteRes<WriteAtomicW, [SiFiveP600LDST]>;
204def : WriteRes<WriteAtomicD, [SiFiveP600LDST]>;
205def : WriteRes<WriteAtomicLDW, [SiFiveP600LDST]>;
206def : WriteRes<WriteAtomicLDD, [SiFiveP600LDST]>;
207}
208
209// Floating point
210let Latency = 2 in {
211def : WriteRes<WriteFAdd16, [SiFiveP600FloatArith]>;
212def : WriteRes<WriteFAdd32, [SiFiveP600FloatArith]>;
213def : WriteRes<WriteFAdd64, [SiFiveP600FloatArith]>;
214}
215let Latency = 3 in {
216def : WriteRes<WriteFMul16, [SiFiveP600FloatArith]>;
217def : WriteRes<WriteFMul32, [SiFiveP600FloatArith]>;
218def : WriteRes<WriteFMul64, [SiFiveP600FloatArith]>;
219}
220let Latency = 4 in {
221def : WriteRes<WriteFMA16, [SiFiveP600FloatArith]>;
222def : WriteRes<WriteFMA32, [SiFiveP600FloatArith]>;
223def : WriteRes<WriteFMA64, [SiFiveP600FloatArith]>;
224}
225
226let Latency = 2 in {
227def : WriteRes<WriteFSGNJ16, [SiFiveP600FloatArith]>;
228def : WriteRes<WriteFSGNJ32, [SiFiveP600FloatArith]>;
229def : WriteRes<WriteFSGNJ64, [SiFiveP600FloatArith]>;
230
231def : WriteRes<WriteFMinMax16, [SiFiveP600FloatArith]>;
232def : WriteRes<WriteFMinMax32, [SiFiveP600FloatArith]>;
233def : WriteRes<WriteFMinMax64, [SiFiveP600FloatArith]>;
234}
235
236// Half precision.
237def : WriteRes<WriteFDiv16, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
238  let Latency = 4;
239  let ReleaseAtCycles = [1, 4];
240}
241def : WriteRes<WriteFSqrt16, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
242  let Latency = 18;
243  let ReleaseAtCycles = [1, 17];
244}
245
246// Single precision.
247def : WriteRes<WriteFDiv32, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
248  let Latency = 6;
249  let ReleaseAtCycles = [1, 6];
250}
251def : WriteRes<WriteFSqrt32, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
252  let Latency = 18;
253  let ReleaseAtCycles = [1, 17];
254}
255
256// Double precision
257def : WriteRes<WriteFDiv64, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
258  let Latency = 11;
259  let ReleaseAtCycles = [1, 11];
260}
261def : WriteRes<WriteFSqrt64, [SiFiveP600FEXQ1, SiFiveP600FloatDiv]> {
262  let Latency = 33;
263  let ReleaseAtCycles = [1, 32];
264}
265
266// Conversions
267let Latency = 2 in {
268def : WriteRes<WriteFCvtI32ToF16, [SiFiveP600MulI2F]>;
269def : WriteRes<WriteFCvtI32ToF32, [SiFiveP600MulI2F]>;
270def : WriteRes<WriteFCvtI32ToF64, [SiFiveP600MulI2F]>;
271def : WriteRes<WriteFCvtI64ToF16, [SiFiveP600MulI2F]>;
272def : WriteRes<WriteFCvtI64ToF32, [SiFiveP600MulI2F]>;
273def : WriteRes<WriteFCvtI64ToF64, [SiFiveP600MulI2F]>;
274def : WriteRes<WriteFCvtF16ToI32, [SiFiveP600F2I]>;
275def : WriteRes<WriteFCvtF16ToI64, [SiFiveP600F2I]>;
276def : WriteRes<WriteFCvtF16ToF32, [SiFiveP600FloatArith]>;
277def : WriteRes<WriteFCvtF16ToF64, [SiFiveP600FloatArith]>;
278def : WriteRes<WriteFCvtF32ToI32, [SiFiveP600F2I]>;
279def : WriteRes<WriteFCvtF32ToI64, [SiFiveP600F2I]>;
280def : WriteRes<WriteFCvtF32ToF16, [SiFiveP600FloatArith]>;
281def : WriteRes<WriteFCvtF32ToF64, [SiFiveP600FloatArith]>;
282def : WriteRes<WriteFCvtF64ToI32, [SiFiveP600F2I]>;
283def : WriteRes<WriteFCvtF64ToI64, [SiFiveP600F2I]>;
284def : WriteRes<WriteFCvtF64ToF16, [SiFiveP600FloatArith]>;
285def : WriteRes<WriteFCvtF64ToF32, [SiFiveP600FloatArith]>;
286
287def : WriteRes<WriteFClass16, [SiFiveP600F2I]>;
288def : WriteRes<WriteFClass32, [SiFiveP600F2I]>;
289def : WriteRes<WriteFClass64, [SiFiveP600F2I]>;
290def : WriteRes<WriteFCmp16, [SiFiveP600F2I]>;
291def : WriteRes<WriteFCmp32, [SiFiveP600F2I]>;
292def : WriteRes<WriteFCmp64, [SiFiveP600F2I]>;
293def : WriteRes<WriteFMovI16ToF16, [SiFiveP600MulI2F]>;
294def : WriteRes<WriteFMovF16ToI16, [SiFiveP600F2I]>;
295def : WriteRes<WriteFMovI32ToF32, [SiFiveP600MulI2F]>;
296def : WriteRes<WriteFMovF32ToI32, [SiFiveP600F2I]>;
297def : WriteRes<WriteFMovI64ToF64, [SiFiveP600MulI2F]>;
298def : WriteRes<WriteFMovF64ToI64, [SiFiveP600F2I]>;
299}
300
301// 6. Configuration-Setting Instructions
302def : WriteRes<WriteVSETVLI, [SiFiveP600SYS]>;
303def : WriteRes<WriteVSETIVLI, [SiFiveP600SYS]>;
304def : WriteRes<WriteVSETVL, [SiFiveP600SYS]>;
305
306// 7. Vector Loads and Stores
307// FIXME: This unit is still being improved, currently
308// it is based on stage numbers. Estimates are optimistic,
309// latency may be longer.
310foreach mx = SchedMxList in {
311  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
312  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
313  let Latency = 8, ReleaseAtCycles = [LMulLat] in {
314    defm "" : LMULWriteResMX<"WriteVLDE",    [SiFiveP600VLD], mx, IsWorstCase>;
315    defm "" : LMULWriteResMX<"WriteVLDM",    [SiFiveP600VLD], mx, IsWorstCase>;
316    defm "" : LMULWriteResMX<"WriteVLDFF",   [SiFiveP600VLD], mx, IsWorstCase>;
317  }
318  let Latency = 12, ReleaseAtCycles = [LMulLat] in {
319    defm "" : LMULWriteResMX<"WriteVLDS8",   [SiFiveP600VLD], mx, IsWorstCase>;
320    defm "" : LMULWriteResMX<"WriteVLDS16",  [SiFiveP600VLD], mx, IsWorstCase>;
321    defm "" : LMULWriteResMX<"WriteVLDS32",  [SiFiveP600VLD], mx, IsWorstCase>;
322    defm "" : LMULWriteResMX<"WriteVLDS64",  [SiFiveP600VLD], mx, IsWorstCase>;
323  }
324  let Latency = 12, ReleaseAtCycles = [LMulLat] in {
325    defm "" : LMULWriteResMX<"WriteVLDUX8",  [SiFiveP600VLD], mx, IsWorstCase>;
326    defm "" : LMULWriteResMX<"WriteVLDUX16", [SiFiveP600VLD], mx, IsWorstCase>;
327    defm "" : LMULWriteResMX<"WriteVLDUX32", [SiFiveP600VLD], mx, IsWorstCase>;
328    defm "" : LMULWriteResMX<"WriteVLDUX64", [SiFiveP600VLD], mx, IsWorstCase>;
329    defm "" : LMULWriteResMX<"WriteVLDOX8",  [SiFiveP600VLD], mx, IsWorstCase>;
330    defm "" : LMULWriteResMX<"WriteVLDOX16", [SiFiveP600VLD], mx, IsWorstCase>;
331    defm "" : LMULWriteResMX<"WriteVLDOX32", [SiFiveP600VLD], mx, IsWorstCase>;
332    defm "" : LMULWriteResMX<"WriteVLDOX64", [SiFiveP600VLD], mx, IsWorstCase>;
333  }
334}
335
336foreach mx = SchedMxList in {
337  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
338  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
339  let Latency = 8, ReleaseAtCycles = [LMulLat] in {
340    defm "" : LMULWriteResMX<"WriteVSTE",    [SiFiveP600VST], mx, IsWorstCase>;
341    defm "" : LMULWriteResMX<"WriteVSTM",    [SiFiveP600VST], mx, IsWorstCase>;
342  }
343  let Latency = 12, ReleaseAtCycles = [LMulLat] in {
344    defm "" : LMULWriteResMX<"WriteVSTS8",   [SiFiveP600VST], mx, IsWorstCase>;
345    defm "" : LMULWriteResMX<"WriteVSTS16",  [SiFiveP600VST], mx, IsWorstCase>;
346    defm "" : LMULWriteResMX<"WriteVSTS32",  [SiFiveP600VST], mx, IsWorstCase>;
347    defm "" : LMULWriteResMX<"WriteVSTS64",  [SiFiveP600VST], mx, IsWorstCase>;
348  }
349  let Latency = 12, ReleaseAtCycles = [LMulLat] in {
350    defm "" : LMULWriteResMX<"WriteVSTUX8",  [SiFiveP600VST], mx, IsWorstCase>;
351    defm "" : LMULWriteResMX<"WriteVSTUX16", [SiFiveP600VST], mx, IsWorstCase>;
352    defm "" : LMULWriteResMX<"WriteVSTUX32", [SiFiveP600VST], mx, IsWorstCase>;
353    defm "" : LMULWriteResMX<"WriteVSTUX64", [SiFiveP600VST], mx, IsWorstCase>;
354    defm "" : LMULWriteResMX<"WriteVSTOX8",  [SiFiveP600VST], mx, IsWorstCase>;
355    defm "" : LMULWriteResMX<"WriteVSTOX16", [SiFiveP600VST], mx, IsWorstCase>;
356    defm "" : LMULWriteResMX<"WriteVSTOX32", [SiFiveP600VST], mx, IsWorstCase>;
357    defm "" : LMULWriteResMX<"WriteVSTOX64", [SiFiveP600VST], mx, IsWorstCase>;
358  }
359}
360
361foreach mx = SchedMxList in {
362  foreach nf=2-8 in {
363    foreach eew = [8, 16, 32, 64] in {
364      defvar LMulLat = SiFiveP600GetCyclesSegmented<mx, eew, nf>.c;
365      defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
366      let Latency = !add(12, LMulLat), ReleaseAtCycles = [!add(12, LMulLat)] in {
367        defm "" : LMULWriteResMX<"WriteVLSEG" # nf # "e" # eew,   [SiFiveP600VLD], mx, IsWorstCase>;
368        defm "" : LMULWriteResMX<"WriteVLSEGFF" # nf # "e" # eew, [SiFiveP600VLD], mx, IsWorstCase>;
369        defm "" : LMULWriteResMX<"WriteVLSSEG" # nf # "e" # eew,  [SiFiveP600VLD], mx, IsWorstCase>;
370        defm "" : LMULWriteResMX<"WriteVLUXSEG" # nf # "e" # eew, [SiFiveP600VLD], mx, IsWorstCase>;
371        defm "" : LMULWriteResMX<"WriteVLOXSEG" # nf # "e" # eew, [SiFiveP600VLD], mx, IsWorstCase>;
372      }
373      let Latency = !add(1, LMulLat), ReleaseAtCycles = [!add(12, LMulLat)] in {
374        defm "" : LMULWriteResMX<"WriteVSSEG" # nf # "e" # eew,   [SiFiveP600VST], mx, IsWorstCase>;
375        defm "" : LMULWriteResMX<"WriteVSSSEG" # nf # "e" # eew,  [SiFiveP600VST], mx, IsWorstCase>;
376        defm "" : LMULWriteResMX<"WriteVSUXSEG" # nf # "e" # eew, [SiFiveP600VST], mx, IsWorstCase>;
377        defm "" : LMULWriteResMX<"WriteVSOXSEG" # nf # "e" # eew, [SiFiveP600VST], mx, IsWorstCase>;
378      }
379    }
380  }
381}
382
383// Whole register move/load/store
384foreach LMul = [1, 2, 4, 8] in {
385  let Latency = 8, ReleaseAtCycles = [LMul] in {
386    def : WriteRes<!cast<SchedWrite>("WriteVLD" # LMul # "R"), [SiFiveP600VLD]>;
387    def : WriteRes<!cast<SchedWrite>("WriteVST" # LMul # "R"), [SiFiveP600VST]>;
388  }
389  let Latency = LMul, ReleaseAtCycles = [LMul] in {
390    def : WriteRes<!cast<SchedWrite>("WriteVMov" # LMul # "V"), [SiFiveP600VectorArith]>;
391  }
392}
393
394// 11. Vector Integer Arithmetic Instructions
395foreach mx = SchedMxList in {
396  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
397  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
398  let Latency = 1, ReleaseAtCycles = [LMulLat] in {
399    defm "" : LMULWriteResMX<"WriteVIALUV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
400    defm "" : LMULWriteResMX<"WriteVIALUX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
401    defm "" : LMULWriteResMX<"WriteVIALUI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
402    defm "" : LMULWriteResMX<"WriteVExtV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
403    defm "" : LMULWriteResMX<"WriteVICALUV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
404    defm "" : LMULWriteResMX<"WriteVICALUX",  [SiFiveP600VectorArith], mx, IsWorstCase>;
405    defm "" : LMULWriteResMX<"WriteVICALUI",  [SiFiveP600VectorArith], mx, IsWorstCase>;
406    defm "" : LMULWriteResMX<"WriteVICmpV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
407    defm "" : LMULWriteResMX<"WriteVICmpX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
408    defm "" : LMULWriteResMX<"WriteVICmpI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
409    defm "" : LMULWriteResMX<"WriteVIMergeV", [SiFiveP600VectorArith], mx, IsWorstCase>;
410    defm "" : LMULWriteResMX<"WriteVIMergeX", [SiFiveP600VectorArith], mx, IsWorstCase>;
411    defm "" : LMULWriteResMX<"WriteVIMergeI", [SiFiveP600VectorArith], mx, IsWorstCase>;
412    defm "" : LMULWriteResMX<"WriteVIMovV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
413    defm "" : LMULWriteResMX<"WriteVIMovX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
414    defm "" : LMULWriteResMX<"WriteVIMovI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
415  }
416  let Latency = 6, ReleaseAtCycles = [LMulLat] in {
417    defm "" : LMULWriteResMX<"WriteVShiftV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
418    defm "" : LMULWriteResMX<"WriteVShiftX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
419    defm "" : LMULWriteResMX<"WriteVShiftI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
420    defm "" : LMULWriteResMX<"WriteVIMinMaxV", [SiFiveP600VectorArith], mx, IsWorstCase>;
421    defm "" : LMULWriteResMX<"WriteVIMinMaxX", [SiFiveP600VectorArith], mx, IsWorstCase>;
422    defm "" : LMULWriteResMX<"WriteVIMulV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
423    defm "" : LMULWriteResMX<"WriteVIMulX",    [SiFiveP600VectorArith], mx, IsWorstCase>;
424    defm "" : LMULWriteResMX<"WriteVIMulAddV", [SiFiveP600VectorArith], mx, IsWorstCase>;
425    defm "" : LMULWriteResMX<"WriteVIMulAddX", [SiFiveP600VectorArith], mx, IsWorstCase>;
426  }
427}
428// Widening
429foreach mx = SchedMxListW in {
430  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
431  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxListW>.c;
432  let Latency = 6, ReleaseAtCycles = [LMulLat] in {
433    defm "" : LMULWriteResMX<"WriteVIWALUV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
434    defm "" : LMULWriteResMX<"WriteVIWALUX",    [SiFiveP600VectorArith], mx, IsWorstCase>;
435    defm "" : LMULWriteResMX<"WriteVIWALUI",    [SiFiveP600VectorArith], mx, IsWorstCase>;
436    defm "" : LMULWriteResMX<"WriteVIWMulV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
437    defm "" : LMULWriteResMX<"WriteVIWMulX",    [SiFiveP600VectorArith], mx, IsWorstCase>;
438    defm "" : LMULWriteResMX<"WriteVIWMulAddV", [SiFiveP600VectorArith], mx, IsWorstCase>;
439    defm "" : LMULWriteResMX<"WriteVIWMulAddX", [SiFiveP600VectorArith], mx, IsWorstCase>;
440  }
441}
442
443// Worst case needs 64 cycles if SEW is equal to 64.
444foreach mx = SchedMxList in {
445  foreach sew = SchedSEWSet<mx>.val in {
446    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
447    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxList>.c;
448    let Latency = 64, ReleaseAtCycles = [LMulLat, !mul(63, LMulLat)] in {
449      defm "" : LMULSEWWriteResMXSEW<"WriteVIDivV", [SiFiveP600VEXQ1, SiFiveP600VDiv], mx, sew, IsWorstCase>;
450      defm "" : LMULSEWWriteResMXSEW<"WriteVIDivX", [SiFiveP600VEXQ1, SiFiveP600VDiv], mx, sew, IsWorstCase>;
451    }
452  }
453}
454
455// Narrowing Shift and Clips
456foreach mx = SchedMxListW in {
457  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
458  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxListW>.c;
459  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
460    defm "" : LMULWriteResMX<"WriteVNShiftV", [SiFiveP600VectorArith], mx, IsWorstCase>;
461    defm "" : LMULWriteResMX<"WriteVNShiftX", [SiFiveP600VectorArith], mx, IsWorstCase>;
462    defm "" : LMULWriteResMX<"WriteVNShiftI", [SiFiveP600VectorArith], mx, IsWorstCase>;
463    defm "" : LMULWriteResMX<"WriteVNClipV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
464    defm "" : LMULWriteResMX<"WriteVNClipX",  [SiFiveP600VectorArith], mx, IsWorstCase>;
465    defm "" : LMULWriteResMX<"WriteVNClipI",  [SiFiveP600VectorArith], mx, IsWorstCase>;
466  }
467}
468
469// 12. Vector Fixed-Point Arithmetic Instructions
470foreach mx = SchedMxList in {
471  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
472  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
473  let Latency = 6, ReleaseAtCycles = [LMulLat] in {
474    defm "" : LMULWriteResMX<"WriteVSALUV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
475    defm "" : LMULWriteResMX<"WriteVSALUX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
476    defm "" : LMULWriteResMX<"WriteVSALUI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
477    defm "" : LMULWriteResMX<"WriteVAALUV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
478    defm "" : LMULWriteResMX<"WriteVAALUX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
479    defm "" : LMULWriteResMX<"WriteVSMulV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
480    defm "" : LMULWriteResMX<"WriteVSMulX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
481    defm "" : LMULWriteResMX<"WriteVSShiftV", [SiFiveP600VectorArith], mx, IsWorstCase>;
482    defm "" : LMULWriteResMX<"WriteVSShiftX", [SiFiveP600VectorArith], mx, IsWorstCase>;
483    defm "" : LMULWriteResMX<"WriteVSShiftI", [SiFiveP600VectorArith], mx, IsWorstCase>;
484  }
485}
486
487// 13. Vector Floating-Point Instructions
488foreach mx = SchedMxListF in {
489  foreach sew = SchedSEWSet<mx, isF=1>.val in {
490    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
491    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListF, isF=1>.c;
492    let Latency = 6, ReleaseAtCycles = [LMulLat] in {
493      defm "" : LMULSEWWriteResMXSEW<"WriteVFALUV",  [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
494      defm "" : LMULSEWWriteResMXSEW<"WriteVFALUF",  [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
495      defm "" : LMULSEWWriteResMXSEW<"WriteVFMulV",  [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
496      defm "" : LMULSEWWriteResMXSEW<"WriteVFMulF",  [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
497      defm "" : LMULSEWWriteResMXSEW<"WriteVFMulAddV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
498      defm "" : LMULSEWWriteResMXSEW<"WriteVFMulAddF", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
499    }
500    let Latency = 2, ReleaseAtCycles = [LMulLat] in
501    defm "" : LMULSEWWriteResMXSEW<"WriteVFRecpV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
502    let Latency = 3, ReleaseAtCycles = [LMulLat] in
503    defm "" : LMULSEWWriteResMXSEW<"WriteVFCvtIToFV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
504  }
505}
506foreach mx = SchedMxListF in {
507  foreach sew = SchedSEWSet<mx, isF=1>.val in {
508    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
509    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxList, isF=1>.c;
510    let Latency = 1, ReleaseAtCycles = [LMulLat] in {
511      defm "" : LMULSEWWriteResMXSEW<"WriteVFMinMaxV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
512      defm "" : LMULSEWWriteResMXSEW<"WriteVFMinMaxF", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
513      defm "" : LMULSEWWriteResMXSEW<"WriteVFSgnjV",   [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
514      defm "" : LMULSEWWriteResMXSEW<"WriteVFSgnjF",   [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
515    }
516  }
517}
518foreach mx = SchedMxList in {
519  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
520  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
521  let Latency = 3, ReleaseAtCycles = [LMulLat] in
522  defm "" : LMULWriteResMX<"WriteVFCvtFToIV", [SiFiveP600VectorArith], mx, IsWorstCase>;
523  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
524    defm "" : LMULWriteResMX<"WriteVFCmpV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
525    defm "" : LMULWriteResMX<"WriteVFCmpF",  [SiFiveP600VectorArith], mx, IsWorstCase>;
526  }
527  let Latency = 1, ReleaseAtCycles = [LMulLat] in {
528    defm "" : LMULWriteResMX<"WriteVFClassV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
529    defm "" : LMULWriteResMX<"WriteVFMergeV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
530    defm "" : LMULWriteResMX<"WriteVFMovV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
531  }
532}
533
534// Widening
535foreach mx = SchedMxListW in {
536  foreach sew = SchedSEWSet<mx, isF=0, isWidening=1>.val in {
537    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
538    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListW>.c;
539    let Latency = 3, ReleaseAtCycles = [LMulLat] in
540    defm "" : LMULSEWWriteResMXSEW<"WriteVFWCvtIToFV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
541  }
542}
543foreach mx = SchedMxListFW in {
544  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
545  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxListFW>.c;
546  let Latency = 6, ReleaseAtCycles = [LMulLat] in
547  defm "" : LMULWriteResMX<"WriteVFWCvtFToIV", [SiFiveP600VectorArith], mx, IsWorstCase>;
548}
549foreach mx = SchedMxListFW in {
550  foreach sew = SchedSEWSet<mx, isF=1, isWidening=1>.val in {
551    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
552    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListFW, isF=1>.c;
553    let Latency = 6, ReleaseAtCycles = [LMulLat] in {
554      defm "" : LMULSEWWriteResMXSEW<"WriteVFWALUV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
555      defm "" : LMULSEWWriteResMXSEW<"WriteVFWALUF", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
556      defm "" : LMULSEWWriteResMXSEW<"WriteVFWMulV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
557      defm "" : LMULSEWWriteResMXSEW<"WriteVFWMulF", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
558      defm "" : LMULSEWWriteResMXSEW<"WriteVFWMulAddV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
559      defm "" : LMULSEWWriteResMXSEW<"WriteVFWMulAddF", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
560      defm "" : LMULSEWWriteResMXSEW<"WriteVFWCvtFToFV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
561    }
562  }
563}
564// Narrowing
565foreach mx = SchedMxListW in {
566  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
567  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxListW>.c;
568  let Latency = 3, ReleaseAtCycles = [LMulLat] in {
569    defm "" : LMULWriteResMX<"WriteVFNCvtFToIV", [SiFiveP600VectorArith], mx, IsWorstCase>;
570  }
571}
572foreach mx = SchedMxListFW in {
573  foreach sew = SchedSEWSet<mx, isF=1, isWidening=1>.val in {
574    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
575    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListFW, isF=1>.c;
576    let Latency = 3, ReleaseAtCycles = [LMulLat] in {
577      defm "" : LMULSEWWriteResMXSEW<"WriteVFNCvtIToFV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
578      defm "" : LMULSEWWriteResMXSEW<"WriteVFNCvtFToFV", [SiFiveP600VectorArith], mx, sew, IsWorstCase>;
579    }
580  }
581}
582
583// Worst case needs 76 cycles if SEW is equal to 64.
584foreach mx = SchedMxListF in {
585  foreach sew = SchedSEWSet<mx, 1>.val in {
586    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
587    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListF, 1>.c;
588    let Latency = 76, ReleaseAtCycles = [LMulLat, !mul(76, LMulLat)] in {
589      defm "" : LMULSEWWriteResMXSEW<"WriteVFDivV",  [SiFiveP600VEXQ1, SiFiveP600VFloatDiv], mx, sew, IsWorstCase>;
590      defm "" : LMULSEWWriteResMXSEW<"WriteVFDivF",  [SiFiveP600VEXQ1, SiFiveP600VFloatDiv], mx, sew, IsWorstCase>;
591      defm "" : LMULSEWWriteResMXSEW<"WriteVFSqrtV", [SiFiveP600VEXQ1, SiFiveP600VFloatDiv], mx, sew, IsWorstCase>;
592    }
593  }
594}
595
596// 14. Vector Reduction Operations
597foreach mx = SchedMxList in {
598  foreach sew = SchedSEWSet<mx>.val in {
599    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
600    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxList>.c;
601    let Latency = !add(2, !mul(2, LMulLat)), ReleaseAtCycles = [LMulLat] in {
602      defm "" : LMULSEWWriteResMXSEW<"WriteVIRedV_From", [SiFiveP600VEXQ1],
603                                     mx, sew, IsWorstCase>;
604      defm "" : LMULSEWWriteResMXSEW<"WriteVIRedMinMaxV_From", [SiFiveP600VEXQ1],
605                                     mx, sew, IsWorstCase>;
606    }
607  }
608}
609
610foreach mx = SchedMxListWRed in {
611  foreach sew = SchedSEWSet<mx, 0, 1>.val in {
612    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
613    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListWRed>.c;
614    let Latency = !add(2, !mul(2, LMulLat)), ReleaseAtCycles = [LMulLat] in {
615      defm "" : LMULSEWWriteResMXSEW<"WriteVIWRedV_From", [SiFiveP600VEXQ1],
616                                     mx, sew, IsWorstCase>;
617    }
618  }
619}
620
621foreach mx = SchedMxListF in {
622  foreach sew = SchedSEWSet<mx, 1>.val in {
623    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
624    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListF, 1>.c;
625    let Latency = !add(6, !mul(6, LMulLat)), ReleaseAtCycles = [LMulLat] in {
626      defm "" : LMULSEWWriteResMXSEW<"WriteVFRedV_From", [SiFiveP600VEXQ1],
627                                     mx, sew, IsWorstCase>;
628      defm "" : LMULSEWWriteResMXSEW<"WriteVFRedMinMaxV_From",
629                                     [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
630      defm "" : LMULSEWWriteResMXSEW<"WriteVFRedOV_From", [SiFiveP600VEXQ1],
631                                     mx, sew, IsWorstCase>;
632    }
633  }
634}
635
636foreach mx = SchedMxListFWRed in {
637  foreach sew = SchedSEWSet<mx, 1, 1>.val in {
638    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
639    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxListFWRed, 1>.c;
640    let Latency = !add(6, !mul(6, LMulLat)), ReleaseAtCycles = [LMulLat] in {
641      defm "" : LMULSEWWriteResMXSEW<"WriteVFWRedV_From",  [SiFiveP600VEXQ1],
642                                     mx, sew, IsWorstCase>;
643      defm "" : LMULSEWWriteResMXSEW<"WriteVFWRedOV_From", [SiFiveP600VEXQ1],
644                                     mx, sew, IsWorstCase>;
645    }
646  }
647}
648
649// 15. Vector Mask Instructions
650foreach mx = SchedMxList in {
651  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
652  let Latency = 1, ReleaseAtCycles = [1] in {
653    defm "" : LMULWriteResMX<"WriteVMALUV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
654    defm "" : LMULWriteResMX<"WriteVMPopV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
655    defm "" : LMULWriteResMX<"WriteVMFFSV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
656    defm "" : LMULWriteResMX<"WriteVMSFSV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
657  }
658  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
659  let Latency = 1, ReleaseAtCycles = [LMulLat] in {
660    defm "" : LMULWriteResMX<"WriteVIotaV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
661    defm "" : LMULWriteResMX<"WriteVIdxV", [SiFiveP600VEXQ0], mx, IsWorstCase>;
662  }
663}
664
665// 16. Vector Permutation Instructions
666// Simple Slide
667foreach mx = SchedMxList in {
668  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
669  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
670  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
671    defm "" : LMULWriteResMX<"WriteVSlideI",  [SiFiveP600VEXQ0], mx, IsWorstCase>;
672  }
673  let Latency = 1, ReleaseAtCycles = [LMulLat] in {
674    defm "" : LMULWriteResMX<"WriteVISlide1X", [SiFiveP600VEXQ0], mx, IsWorstCase>;
675    defm "" : LMULWriteResMX<"WriteVFSlide1F", [SiFiveP600VEXQ0], mx, IsWorstCase>;
676  }
677}
678foreach mx = ["MF8", "MF4", "MF2", "M1"] in {
679  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
680  let Latency = 2, ReleaseAtCycles = [1] in {
681    defm "" : LMULWriteResMX<"WriteVSlideUpX",   [SiFiveP600VEXQ0], mx, IsWorstCase>;
682    defm "" : LMULWriteResMX<"WriteVSlideDownX", [SiFiveP600VEXQ0], mx, IsWorstCase>;
683  }
684}
685
686// Complex Slide
687foreach mx = ["M8", "M4", "M2"] in {
688  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
689  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
690  let Latency = !add(4, LMulLat), ReleaseAtCycles = [LMulLat] in {
691    defm "" : LMULWriteResMX<"WriteVSlideUpX",   [SiFiveP600VEXQ1], mx, IsWorstCase>;
692    defm "" : LMULWriteResMX<"WriteVSlideDownX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
693  }
694}
695
696let Latency = 2, ReleaseAtCycles = [1] in {
697  def : WriteRes<WriteVMovSX, [SiFiveP600VectorArith]>;
698  def : WriteRes<WriteVMovXS, [SiFiveP600VectorArith]>;
699}
700let Latency = 6, ReleaseAtCycles = [1] in {
701  def : WriteRes<WriteVMovSF, [SiFiveP600VectorArith]>;
702  def : WriteRes<WriteVMovFS, [SiFiveP600VectorArith]>;
703}
704
705// Simple Gather and Compress
706foreach mx = ["MF8", "MF4", "MF2", "M1"] in {
707  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
708  let Latency = 3, ReleaseAtCycles = [1] in {
709    defm "" : LMULWriteResMX<"WriteVRGatherVX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
710  }
711}
712
713foreach mx = ["MF8", "MF4", "MF2", "M1"] in {
714  foreach sew = SchedSEWSet<mx>.val in {
715    defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
716    let Latency = 3, ReleaseAtCycles = [1] in {
717      defm "" : LMULSEWWriteResMXSEW<"WriteVRGatherVV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
718      defm "" : LMULSEWWriteResMXSEW<"WriteVRGatherEI16VV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
719      defm "" : LMULSEWWriteResMXSEW<"WriteVCompressV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
720    }
721  }
722}
723
724// Complex Gather and Compress
725foreach mx = ["M2", "M4", "M8"] in {
726  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
727  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
728  let Latency = 6, ReleaseAtCycles = [LMulLat] in {
729    defm "" : LMULWriteResMX<"WriteVRGatherVX", [SiFiveP600VEXQ1], mx, IsWorstCase>;
730  }
731}
732
733foreach mx = ["M2", "M4", "M8"] in {
734  foreach sew = SchedSEWSet<mx>.val in {
735    defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
736    defvar IsWorstCase = SiFiveP600IsWorstCaseMXSEW<mx, sew, SchedMxList>.c;
737    let Latency = 6, ReleaseAtCycles = [LMulLat] in {
738      defm "" : LMULSEWWriteResMXSEW<"WriteVRGatherVV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
739      defm "" : LMULSEWWriteResMXSEW<"WriteVRGatherEI16VV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
740      defm "" : LMULSEWWriteResMXSEW<"WriteVCompressV", [SiFiveP600VEXQ1], mx, sew, IsWorstCase>;
741    }
742  }
743}
744
745// Simple Vrgather.vi
746foreach mx = SchedMxList in {
747  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
748  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
749  let Latency = 3, ReleaseAtCycles = [LMulLat] in {
750    defm "" : LMULWriteResMX<"WriteVRGatherVI", [SiFiveP600VEXQ1], mx, IsWorstCase>;
751  }
752}
753
754// Vector Crypto
755foreach mx = SchedMxList in {
756  defvar LMulLat = SiFiveP600GetLMulCycles<mx>.c;
757  defvar IsWorstCase = SiFiveP600IsWorstCaseMX<mx, SchedMxList>.c;
758  // Zvbb
759  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
760    defm "" : LMULWriteResMX<"WriteVBREVV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
761    defm "" : LMULWriteResMX<"WriteVCLZV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
762    defm "" : LMULWriteResMX<"WriteVCPOPV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
763    defm "" : LMULWriteResMX<"WriteVCTZV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
764    defm "" : LMULWriteResMX<"WriteVWSLLV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
765    defm "" : LMULWriteResMX<"WriteVWSLLX",   [SiFiveP600VectorArith], mx, IsWorstCase>;
766    defm "" : LMULWriteResMX<"WriteVWSLLI",   [SiFiveP600VectorArith], mx, IsWorstCase>;
767  }
768  // Zvbc
769  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
770    defm "" : LMULWriteResMX<"WriteVCLMULV", [SiFiveP600VectorArith], mx, IsWorstCase>;
771    defm "" : LMULWriteResMX<"WriteVCLMULX", [SiFiveP600VectorArith], mx, IsWorstCase>;
772  }
773  // Zvkb
774  // VANDN uses WriteVIALU[V|X|I]
775  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
776    defm "" : LMULWriteResMX<"WriteVBREV8V",  [SiFiveP600VectorArith], mx, IsWorstCase>;
777    defm "" : LMULWriteResMX<"WriteVREV8V",   [SiFiveP600VectorArith], mx, IsWorstCase>;
778    defm "" : LMULWriteResMX<"WriteVRotV",    [SiFiveP600VectorArith], mx, IsWorstCase>;
779    defm "" : LMULWriteResMX<"WriteVRotX",    [SiFiveP600VectorArith], mx, IsWorstCase>;
780    defm "" : LMULWriteResMX<"WriteVRotI",    [SiFiveP600VectorArith], mx, IsWorstCase>;
781  }
782  // Zvkg
783  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
784    defm "" : LMULWriteResMX<"WriteVGHSHV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
785    defm "" : LMULWriteResMX<"WriteVGMULV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
786  }
787  // ZvknhaOrZvknhb
788  let Latency = 3, ReleaseAtCycles = [LMulLat] in {
789    defm "" : LMULWriteResMX<"WriteVSHA2CHV", [SiFiveP600VectorArith], mx, IsWorstCase>;
790    defm "" : LMULWriteResMX<"WriteVSHA2CLV", [SiFiveP600VectorArith], mx, IsWorstCase>;
791    defm "" : LMULWriteResMX<"WriteVSHA2MSV", [SiFiveP600VectorArith], mx, IsWorstCase>;
792  }
793  // Zvkned
794  let Latency = 2, ReleaseAtCycles = [LMulLat] in {
795    defm "" : LMULWriteResMX<"WriteVAESMVV",  [SiFiveP600VectorArith], mx, IsWorstCase>;
796    defm "" : LMULWriteResMX<"WriteVAESKF1V", [SiFiveP600VectorArith], mx, IsWorstCase>;
797    defm "" : LMULWriteResMX<"WriteVAESKF2V", [SiFiveP600VectorArith], mx, IsWorstCase>;
798  }
799  let Latency = 1, ReleaseAtCycles = [LMulLat] in
800  defm "" : LMULWriteResMX<"WriteVAESZV",   [SiFiveP600VectorArith], mx, IsWorstCase>;
801  // Zvksed
802  let Latency = 3, ReleaseAtCycles = [LMulLat] in {
803    defm "" : LMULWriteResMX<"WriteVSM4KV",   [SiFiveP600VEXQ0], mx, IsWorstCase>;
804    defm "" : LMULWriteResMX<"WriteVSM4RV",   [SiFiveP600VEXQ0], mx, IsWorstCase>;
805    defm "" : LMULWriteResMX<"WriteVSM3CV",   [SiFiveP600VEXQ0], mx, IsWorstCase>;
806    defm "" : LMULWriteResMX<"WriteVSM3MEV",  [SiFiveP600VEXQ0], mx, IsWorstCase>;
807  }
808}
809
810// Others
811def : WriteRes<WriteCSR, [SiFiveP600SYS]>;
812def : WriteRes<WriteNop, []>;
813def : WriteRes<WriteRdVLENB, [SiFiveP600SYS]>;
814
815// FIXME: This could be better modeled by looking at the regclasses of the operands.
816def : InstRW<[WriteIALU, ReadIALU], (instrs COPY)>;
817
818//===----------------------------------------------------------------------===//
819// Bypass and advance
820def : ReadAdvance<ReadJmp, 0>;
821def : ReadAdvance<ReadJalr, 0>;
822def : ReadAdvance<ReadCSR, 0>;
823def : ReadAdvance<ReadStoreData, 0>;
824def : ReadAdvance<ReadMemBase, 0>;
825def : ReadAdvance<ReadIALU, 0>;
826def : ReadAdvance<ReadIALU32, 0>;
827def : ReadAdvance<ReadShiftImm, 0>;
828def : ReadAdvance<ReadShiftImm32, 0>;
829def : ReadAdvance<ReadShiftReg, 0>;
830def : ReadAdvance<ReadShiftReg32, 0>;
831def : ReadAdvance<ReadIDiv, 0>;
832def : ReadAdvance<ReadIDiv32, 0>;
833def : ReadAdvance<ReadIRem, 0>;
834def : ReadAdvance<ReadIRem32, 0>;
835def : ReadAdvance<ReadIMul, 0>;
836def : ReadAdvance<ReadIMul32, 0>;
837def : ReadAdvance<ReadAtomicWA, 0>;
838def : ReadAdvance<ReadAtomicWD, 0>;
839def : ReadAdvance<ReadAtomicDA, 0>;
840def : ReadAdvance<ReadAtomicDD, 0>;
841def : ReadAdvance<ReadAtomicLDW, 0>;
842def : ReadAdvance<ReadAtomicLDD, 0>;
843def : ReadAdvance<ReadAtomicSTW, 0>;
844def : ReadAdvance<ReadAtomicSTD, 0>;
845def : ReadAdvance<ReadFStoreData, 0>;
846def : ReadAdvance<ReadFMemBase, 0>;
847def : ReadAdvance<ReadFAdd16, 0>;
848def : ReadAdvance<ReadFAdd32, 0>;
849def : ReadAdvance<ReadFAdd64, 0>;
850def : ReadAdvance<ReadFMul16, 0>;
851def : ReadAdvance<ReadFMA16, 0>;
852def : ReadAdvance<ReadFMA16Addend, 0>;
853def : ReadAdvance<ReadFMul32, 0>;
854def : ReadAdvance<ReadFMA32, 0>;
855def : ReadAdvance<ReadFMA32Addend, 0>;
856def : ReadAdvance<ReadFMul64, 0>;
857def : ReadAdvance<ReadFMA64, 0>;
858def : ReadAdvance<ReadFMA64Addend, 0>;
859def : ReadAdvance<ReadFDiv16, 0>;
860def : ReadAdvance<ReadFDiv32, 0>;
861def : ReadAdvance<ReadFDiv64, 0>;
862def : ReadAdvance<ReadFSqrt16, 0>;
863def : ReadAdvance<ReadFSqrt32, 0>;
864def : ReadAdvance<ReadFSqrt64, 0>;
865def : ReadAdvance<ReadFCmp16, 0>;
866def : ReadAdvance<ReadFCmp32, 0>;
867def : ReadAdvance<ReadFCmp64, 0>;
868def : ReadAdvance<ReadFSGNJ16, 0>;
869def : ReadAdvance<ReadFSGNJ32, 0>;
870def : ReadAdvance<ReadFSGNJ64, 0>;
871def : ReadAdvance<ReadFMinMax16, 0>;
872def : ReadAdvance<ReadFMinMax32, 0>;
873def : ReadAdvance<ReadFMinMax64, 0>;
874def : ReadAdvance<ReadFCvtF16ToI32, 0>;
875def : ReadAdvance<ReadFCvtF16ToI64, 0>;
876def : ReadAdvance<ReadFCvtF32ToI32, 0>;
877def : ReadAdvance<ReadFCvtF32ToI64, 0>;
878def : ReadAdvance<ReadFCvtF64ToI32, 0>;
879def : ReadAdvance<ReadFCvtF64ToI64, 0>;
880def : ReadAdvance<ReadFCvtI32ToF16, 0>;
881def : ReadAdvance<ReadFCvtI32ToF32, 0>;
882def : ReadAdvance<ReadFCvtI32ToF64, 0>;
883def : ReadAdvance<ReadFCvtI64ToF16, 0>;
884def : ReadAdvance<ReadFCvtI64ToF32, 0>;
885def : ReadAdvance<ReadFCvtI64ToF64, 0>;
886def : ReadAdvance<ReadFCvtF32ToF64, 0>;
887def : ReadAdvance<ReadFCvtF64ToF32, 0>;
888def : ReadAdvance<ReadFCvtF16ToF32, 0>;
889def : ReadAdvance<ReadFCvtF32ToF16, 0>;
890def : ReadAdvance<ReadFCvtF16ToF64, 0>;
891def : ReadAdvance<ReadFCvtF64ToF16, 0>;
892def : ReadAdvance<ReadFMovF16ToI16, 0>;
893def : ReadAdvance<ReadFMovI16ToF16, 0>;
894def : ReadAdvance<ReadFMovF32ToI32, 0>;
895def : ReadAdvance<ReadFMovI32ToF32, 0>;
896def : ReadAdvance<ReadFMovF64ToI64, 0>;
897def : ReadAdvance<ReadFMovI64ToF64, 0>;
898def : ReadAdvance<ReadFClass16, 0>;
899def : ReadAdvance<ReadFClass32, 0>;
900def : ReadAdvance<ReadFClass64, 0>;
901
902// Bitmanip
903def : ReadAdvance<ReadRotateImm, 0>;
904def : ReadAdvance<ReadRotateImm32, 0>;
905def : ReadAdvance<ReadRotateReg, 0>;
906def : ReadAdvance<ReadRotateReg32, 0>;
907def : ReadAdvance<ReadCLZ, 0>;
908def : ReadAdvance<ReadCLZ32, 0>;
909def : ReadAdvance<ReadCTZ, 0>;
910def : ReadAdvance<ReadCTZ32, 0>;
911def : ReadAdvance<ReadCPOP, 0>;
912def : ReadAdvance<ReadCPOP32, 0>;
913def : ReadAdvance<ReadORCB, 0>;
914def : ReadAdvance<ReadIMinMax, 0>;
915def : ReadAdvance<ReadREV8, 0>;
916def : ReadAdvance<ReadSHXADD, 0>;
917def : ReadAdvance<ReadSHXADD32, 0>;
918def : ReadAdvance<ReadSingleBit, 0>;
919def : ReadAdvance<ReadSingleBitImm, 0>;
920
921// 6. Configuration-Setting Instructions
922def : ReadAdvance<ReadVSETVLI, 0>;
923def : ReadAdvance<ReadVSETVL, 0>;
924
925// 7. Vector Loads and Stores
926def : ReadAdvance<ReadVLDX, 0>;
927def : ReadAdvance<ReadVSTX, 0>;
928defm "" : LMULReadAdvance<"ReadVSTEV", 0>;
929defm "" : LMULReadAdvance<"ReadVSTM", 0>;
930def : ReadAdvance<ReadVLDSX, 0>;
931def : ReadAdvance<ReadVSTSX, 0>;
932defm "" : LMULReadAdvance<"ReadVSTS8V", 0>;
933defm "" : LMULReadAdvance<"ReadVSTS16V", 0>;
934defm "" : LMULReadAdvance<"ReadVSTS32V", 0>;
935defm "" : LMULReadAdvance<"ReadVSTS64V", 0>;
936defm "" : LMULReadAdvance<"ReadVLDUXV", 0>;
937defm "" : LMULReadAdvance<"ReadVLDOXV", 0>;
938defm "" : LMULReadAdvance<"ReadVSTUX8", 0>;
939defm "" : LMULReadAdvance<"ReadVSTUX16", 0>;
940defm "" : LMULReadAdvance<"ReadVSTUX32", 0>;
941defm "" : LMULReadAdvance<"ReadVSTUX64", 0>;
942defm "" : LMULReadAdvance<"ReadVSTUXV", 0>;
943defm "" : LMULReadAdvance<"ReadVSTUX8V", 0>;
944defm "" : LMULReadAdvance<"ReadVSTUX16V", 0>;
945defm "" : LMULReadAdvance<"ReadVSTUX32V", 0>;
946defm "" : LMULReadAdvance<"ReadVSTUX64V", 0>;
947defm "" : LMULReadAdvance<"ReadVSTOX8", 0>;
948defm "" : LMULReadAdvance<"ReadVSTOX16", 0>;
949defm "" : LMULReadAdvance<"ReadVSTOX32", 0>;
950defm "" : LMULReadAdvance<"ReadVSTOX64", 0>;
951defm "" : LMULReadAdvance<"ReadVSTOXV", 0>;
952defm "" : LMULReadAdvance<"ReadVSTOX8V", 0>;
953defm "" : LMULReadAdvance<"ReadVSTOX16V", 0>;
954defm "" : LMULReadAdvance<"ReadVSTOX32V", 0>;
955defm "" : LMULReadAdvance<"ReadVSTOX64V", 0>;
956// LMUL Aware
957def : ReadAdvance<ReadVST1R, 0>;
958def : ReadAdvance<ReadVST2R, 0>;
959def : ReadAdvance<ReadVST4R, 0>;
960def : ReadAdvance<ReadVST8R, 0>;
961
962// 12. Vector Integer Arithmetic Instructions
963defm : LMULReadAdvance<"ReadVIALUV", 0>;
964defm : LMULReadAdvance<"ReadVIALUX", 0>;
965defm : LMULReadAdvanceW<"ReadVIWALUV", 0>;
966defm : LMULReadAdvanceW<"ReadVIWALUX", 0>;
967defm : LMULReadAdvance<"ReadVExtV", 0>;
968defm : LMULReadAdvance<"ReadVICALUV", 0>;
969defm : LMULReadAdvance<"ReadVICALUX", 0>;
970defm : LMULReadAdvance<"ReadVShiftV", 0>;
971defm : LMULReadAdvance<"ReadVShiftX", 0>;
972defm : LMULReadAdvanceW<"ReadVNShiftV", 0>;
973defm : LMULReadAdvanceW<"ReadVNShiftX", 0>;
974defm : LMULReadAdvance<"ReadVICmpV", 0>;
975defm : LMULReadAdvance<"ReadVICmpX", 0>;
976defm : LMULReadAdvance<"ReadVIMinMaxV", 0>;
977defm : LMULReadAdvance<"ReadVIMinMaxX", 0>;
978defm : LMULReadAdvance<"ReadVIMulV", 0>;
979defm : LMULReadAdvance<"ReadVIMulX", 0>;
980defm : LMULSEWReadAdvance<"ReadVIDivV", 0>;
981defm : LMULSEWReadAdvance<"ReadVIDivX", 0>;
982defm : LMULReadAdvanceW<"ReadVIWMulV", 0>;
983defm : LMULReadAdvanceW<"ReadVIWMulX", 0>;
984defm : LMULReadAdvance<"ReadVIMulAddV", 0>;
985defm : LMULReadAdvance<"ReadVIMulAddX", 0>;
986defm : LMULReadAdvanceW<"ReadVIWMulAddV", 0>;
987defm : LMULReadAdvanceW<"ReadVIWMulAddX", 0>;
988defm : LMULReadAdvance<"ReadVIMergeV", 0>;
989defm : LMULReadAdvance<"ReadVIMergeX", 0>;
990defm : LMULReadAdvance<"ReadVIMovV", 0>;
991defm : LMULReadAdvance<"ReadVIMovX", 0>;
992
993// 13. Vector Fixed-Point Arithmetic Instructions
994defm "" : LMULReadAdvance<"ReadVSALUV", 0>;
995defm "" : LMULReadAdvance<"ReadVSALUX", 0>;
996defm "" : LMULReadAdvance<"ReadVAALUV", 0>;
997defm "" : LMULReadAdvance<"ReadVAALUX", 0>;
998defm "" : LMULReadAdvance<"ReadVSMulV", 0>;
999defm "" : LMULReadAdvance<"ReadVSMulX", 0>;
1000defm "" : LMULReadAdvance<"ReadVSShiftV", 0>;
1001defm "" : LMULReadAdvance<"ReadVSShiftX", 0>;
1002defm "" : LMULReadAdvanceW<"ReadVNClipV", 0>;
1003defm "" : LMULReadAdvanceW<"ReadVNClipX", 0>;
1004
1005// 14. Vector Floating-Point Instructions
1006defm "" : LMULSEWReadAdvanceF<"ReadVFALUV", 0>;
1007defm "" : LMULSEWReadAdvanceF<"ReadVFALUF", 0>;
1008defm "" : LMULSEWReadAdvanceFW<"ReadVFWALUV", 0>;
1009defm "" : LMULSEWReadAdvanceFW<"ReadVFWALUF", 0>;
1010defm "" : LMULSEWReadAdvanceF<"ReadVFMulV", 0>;
1011defm "" : LMULSEWReadAdvanceF<"ReadVFMulF", 0>;
1012defm "" : LMULSEWReadAdvanceF<"ReadVFDivV", 0>;
1013defm "" : LMULSEWReadAdvanceF<"ReadVFDivF", 0>;
1014defm "" : LMULSEWReadAdvanceFW<"ReadVFWMulV", 0>;
1015defm "" : LMULSEWReadAdvanceFW<"ReadVFWMulF", 0>;
1016defm "" : LMULSEWReadAdvanceF<"ReadVFMulAddV", 0>;
1017defm "" : LMULSEWReadAdvanceF<"ReadVFMulAddF", 0>;
1018defm "" : LMULSEWReadAdvanceFW<"ReadVFWMulAddV", 0>;
1019defm "" : LMULSEWReadAdvanceFW<"ReadVFWMulAddF", 0>;
1020defm "" : LMULSEWReadAdvanceF<"ReadVFSqrtV", 0>;
1021defm "" : LMULSEWReadAdvance<"ReadVFRecpV", 0>;
1022defm "" : LMULReadAdvance<"ReadVFCmpV", 0>;
1023defm "" : LMULReadAdvance<"ReadVFCmpF", 0>;
1024defm "" : LMULSEWReadAdvanceF<"ReadVFMinMaxV", 0>;
1025defm "" : LMULSEWReadAdvanceF<"ReadVFMinMaxF", 0>;
1026defm "" : LMULSEWReadAdvanceF<"ReadVFSgnjV", 0>;
1027defm "" : LMULSEWReadAdvanceF<"ReadVFSgnjF", 0>;
1028defm "" : LMULReadAdvance<"ReadVFClassV", 0>;
1029defm "" : LMULReadAdvance<"ReadVFMergeV", 0>;
1030defm "" : LMULReadAdvance<"ReadVFMergeF", 0>;
1031defm "" : LMULReadAdvance<"ReadVFMovF", 0>;
1032defm "" : LMULSEWReadAdvanceF<"ReadVFCvtIToFV", 0>;
1033defm "" : LMULReadAdvance<"ReadVFCvtFToIV", 0>;
1034defm "" : LMULSEWReadAdvanceW<"ReadVFWCvtIToFV", 0>;
1035defm "" : LMULReadAdvanceFW<"ReadVFWCvtFToIV", 0>;
1036defm "" : LMULSEWReadAdvanceFW<"ReadVFWCvtFToFV", 0>;
1037defm "" : LMULSEWReadAdvanceFW<"ReadVFNCvtIToFV", 0>;
1038defm "" : LMULReadAdvanceW<"ReadVFNCvtFToIV", 0>;
1039defm "" : LMULSEWReadAdvanceFW<"ReadVFNCvtFToFV", 0>;
1040
1041// 15. Vector Reduction Operations
1042def : ReadAdvance<ReadVIRedV, 0>;
1043def : ReadAdvance<ReadVIRedV0, 0>;
1044def : ReadAdvance<ReadVIWRedV, 0>;
1045def : ReadAdvance<ReadVIWRedV0, 0>;
1046def : ReadAdvance<ReadVFRedV, 0>;
1047def : ReadAdvance<ReadVFRedV0, 0>;
1048def : ReadAdvance<ReadVFRedOV, 0>;
1049def : ReadAdvance<ReadVFRedOV0, 0>;
1050def : ReadAdvance<ReadVFWRedV, 0>;
1051def : ReadAdvance<ReadVFWRedV0, 0>;
1052def : ReadAdvance<ReadVFWRedOV, 0>;
1053def : ReadAdvance<ReadVFWRedOV0, 0>;
1054
1055// 16. Vector Mask Instructions
1056defm "" : LMULReadAdvance<"ReadVMALUV", 0>;
1057defm "" : LMULReadAdvance<"ReadVMPopV", 0>;
1058defm "" : LMULReadAdvance<"ReadVMFFSV", 0>;
1059defm "" : LMULReadAdvance<"ReadVMSFSV", 0>;
1060defm "" : LMULReadAdvance<"ReadVIotaV", 0>;
1061
1062// 17. Vector Permutation Instructions
1063def : ReadAdvance<ReadVMovXS, 0>;
1064def : ReadAdvance<ReadVMovSX_V, 0>;
1065def : ReadAdvance<ReadVMovSX_X, 0>;
1066def : ReadAdvance<ReadVMovFS, 0>;
1067def : ReadAdvance<ReadVMovSF_V, 0>;
1068def : ReadAdvance<ReadVMovSF_F, 0>;
1069defm "" : LMULReadAdvance<"ReadVISlideV", 0>;
1070defm "" : LMULReadAdvance<"ReadVISlideX", 0>;
1071defm "" : LMULReadAdvance<"ReadVFSlideV", 0>;
1072defm "" : LMULReadAdvance<"ReadVFSlideF", 0>;
1073defm "" : LMULSEWReadAdvance<"ReadVRGatherVV_data", 0>;
1074defm "" : LMULSEWReadAdvance<"ReadVRGatherVV_index", 0>;
1075defm "" : LMULSEWReadAdvance<"ReadVRGatherEI16VV_data", 0>;
1076defm "" : LMULSEWReadAdvance<"ReadVRGatherEI16VV_index", 0>;
1077defm "" : LMULReadAdvance<"ReadVRGatherVX_data", 0>;
1078defm "" : LMULReadAdvance<"ReadVRGatherVX_index", 0>;
1079defm "" : LMULReadAdvance<"ReadVRGatherVI_data", 0>;
1080defm "" : LMULSEWReadAdvance<"ReadVCompressV", 0>;
1081// LMUL Aware
1082def : ReadAdvance<ReadVMov1V, 0>;
1083def : ReadAdvance<ReadVMov2V, 0>;
1084def : ReadAdvance<ReadVMov4V, 0>;
1085def : ReadAdvance<ReadVMov8V, 0>;
1086
1087// Others
1088def : ReadAdvance<ReadVMask, 0>;
1089def : ReadAdvance<ReadVMergeOp_WorstCase, 0>;
1090foreach mx = SchedMxList in {
1091  def : ReadAdvance<!cast<SchedRead>("ReadVMergeOp_" # mx), 0>;
1092  foreach sew = SchedSEWSet<mx>.val in
1093    def : ReadAdvance<!cast<SchedRead>("ReadVMergeOp_" # mx  # "_E" # sew), 0>;
1094}
1095
1096// Vector Crypto Extensions
1097// Zvbb
1098defm "" : LMULReadAdvance<"ReadVBREVV", 0>;
1099defm "" : LMULReadAdvance<"ReadVCLZV", 0>;
1100defm "" : LMULReadAdvance<"ReadVCPOPV", 0>;
1101defm "" : LMULReadAdvance<"ReadVCTZV", 0>;
1102defm "" : LMULReadAdvance<"ReadVWSLLV", 0>;
1103defm "" : LMULReadAdvance<"ReadVWSLLX", 0>;
1104// Zvbc
1105defm "" : LMULReadAdvance<"ReadVCLMULV", 0>;
1106defm "" : LMULReadAdvance<"ReadVCLMULX", 0>;
1107// Zvkb
1108// VANDN uses ReadVIALU[V|X|I]
1109defm "" : LMULReadAdvance<"ReadVBREV8V", 0>;
1110defm "" : LMULReadAdvance<"ReadVREV8V", 0>;
1111defm "" : LMULReadAdvance<"ReadVRotV", 0>;
1112defm "" : LMULReadAdvance<"ReadVRotX", 0>;
1113// Zvkg
1114defm "" : LMULReadAdvance<"ReadVGHSHV", 0>;
1115defm "" : LMULReadAdvance<"ReadVGMULV", 0>;
1116// Zvknha or Zvknhb
1117defm "" : LMULReadAdvance<"ReadVSHA2CHV", 0>;
1118defm "" : LMULReadAdvance<"ReadVSHA2CLV", 0>;
1119defm "" : LMULReadAdvance<"ReadVSHA2MSV", 0>;
1120// Zvkned
1121defm "" : LMULReadAdvance<"ReadVAESMVV", 0>;
1122defm "" : LMULReadAdvance<"ReadVAESKF1V", 0>;
1123defm "" : LMULReadAdvance<"ReadVAESKF2V", 0>;
1124defm "" : LMULReadAdvance<"ReadVAESZV", 0>;
1125// Zvksed
1126defm "" : LMULReadAdvance<"ReadVSM4KV", 0>;
1127defm "" : LMULReadAdvance<"ReadVSM4RV", 0>;
1128// Zbksh
1129defm "" : LMULReadAdvance<"ReadVSM3CV", 0>;
1130defm "" : LMULReadAdvance<"ReadVSM3MEV", 0>;
1131
1132//===----------------------------------------------------------------------===//
1133// Unsupported extensions
1134defm : UnsupportedSchedZabha;
1135defm : UnsupportedSchedZbc;
1136defm : UnsupportedSchedZbkb;
1137defm : UnsupportedSchedZbkx;
1138defm : UnsupportedSchedSFB;
1139defm : UnsupportedSchedZfa;
1140defm : UnsupportedSchedXsfvcp;
1141}
1142