1//=- MipsScheduleGeneric.td - Generic Scheduling Definitions -*- tablegen -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the interAptiv processor in a manner of speaking. It
11// describes a hypothetical version of the in-order MIPS32R2 interAptiv with all
12// branches of the MIPS ISAs, ASEs and ISA variants. The itinerary lists are
13// broken down into per ISA lists, so that this file can be used to rapidly
14// develop new schedule models.
15//
16//===----------------------------------------------------------------------===//
17def MipsGenericModel : SchedMachineModel {
18  int IssueWidth = 1;
19  int MicroOpBufferSize = 0;
20
21  // These figures assume an L1 hit.
22  int LoadLatency = 2;
23  int MispredictPenalty = 4;
24
25  int HighLatency = 37;
26  list<Predicate> UnsupportedFeatures = [];
27
28  let CompleteModel = 1;
29  let PostRAScheduler = 1;
30}
31
32let SchedModel = MipsGenericModel in {
33
34// ALU Pipeline
35// ============
36
37def GenericALU : ProcResource<1> { let BufferSize = 1; }
38def GenericIssueALU : ProcResource<1> { let Super = GenericALU; }
39
40def GenericWriteALU : SchedWriteRes<[GenericIssueALU]>;
41
42// and, lui, nor, or, slti, sltiu, sub, subu, xor
43// add, addi, addiu, addu, andi, ori, rotr, se[bh], sllv?, sr[al]v?, slt, sltu,
44// xori
45def : ItinRW<[GenericWriteALU], [II_ADD, II_ADDU, II_ADDI, II_ADDIU, II_ANDI,
46                                 II_AND, II_ANDI, II_CLO, II_CLZ, II_EXT,
47                                 II_INS, II_LUI, II_MULT, II_MULTU, II_NOR,
48                                 II_ORI, II_OR, II_ROTR, II_ROTRV, II_SEB,
49                                 II_SEH, II_SLTI_SLTIU, II_SLT_SLTU, II_SLL,
50                                 II_SRA, II_SRL, II_SLLV, II_SRAV, II_SRLV,
51                                 II_SSNOP, II_SUB, II_SUBU, II_WSBH, II_XOR,
52                                 II_XORI]>;
53
54def : InstRW<[GenericWriteALU], (instrs COPY)>;
55
56def GenericMDU : ProcResource<1> { let BufferSize = 1; }
57def GenericIssueMDU : ProcResource<1> { let Super = GenericALU; }
58def GenericIssueDIV : ProcResource<1> { let Super = GenericMDU; }
59def GenericWriteHILO : SchedWriteRes<[GenericIssueMDU]>;
60def GenericWriteALULong : SchedWriteRes<[GenericIssueALU]> { let Latency = 5; }
61def GenericWriteMove : SchedWriteRes<[GenericIssueALU]> { let Latency = 2; }
62
63def : ItinRW<[GenericWriteHILO], [II_MADD, II_MADDU, II_MSUB, II_MSUBU]>;
64
65def GenericWriteMDUtoGPR : SchedWriteRes<[GenericIssueMDU]> {
66  let Latency = 5;
67}
68
69def : ItinRW<[GenericWriteMDUtoGPR], [II_MUL]>;
70
71def GenericWriteDIV : SchedWriteRes<[GenericIssueDIV]> {
72  // Estimated worst case
73  let Latency = 33;
74  let ResourceCycles = [1, 33];
75}
76def GenericWriteDIVU : SchedWriteRes<[GenericIssueDIV]> {
77  // Estimated worst case
78  let Latency = 31;
79  let ResourceCycles = [1, 31];
80}
81
82def : ItinRW<[GenericWriteDIV], [II_DIV]>;
83
84def : ItinRW<[GenericWriteDIVU], [II_DIVU]>;
85
86// MIPS64
87// ======
88
89def : ItinRW<[GenericWriteALU], [II_DADDIU, II_DADDU, II_DADDI, II_DADD,
90                                 II_DCLO, II_DCLZ, II_DROTR, II_DROTR32,
91                                 II_DROTRV, II_DSBH, II_DSHD, II_DSLL,
92                                 II_DSLL32, II_DSLLV, II_DSRA, II_DSRA32,
93                                 II_DSRAV, II_DSRL, II_DSRL32, II_DSRLV,
94                                 II_DSUBU, II_DSUB]>;
95
96def : ItinRW<[GenericWriteDIV], [II_DDIV]>;
97
98def : ItinRW<[GenericWriteDIVU], [II_DDIVU]>;
99
100def : ItinRW<[GenericWriteMDUtoGPR], [II_DMUL]>;
101
102def : ItinRW<[GenericWriteHILO], [II_DMULU, II_DMULT, II_DMULTU]>;
103
104// MIPS16e
105// =======
106
107def : ItinRW<[GenericWriteALU], [IIM16Alu, IIPseudo]>;
108
109// microMIPS
110// =========
111
112def : ItinRW<[GenericWriteALU], [II_MOVE, II_LI, II_NOT]>;
113
114// MIPSR6
115// ======
116
117def GenericWriteMul : SchedWriteRes<[GenericIssueMDU]> { let Latency = 4; }
118def : ItinRW<[GenericWriteMul], [II_MUH, II_MUHU, II_MULU]>;
119
120def : ItinRW<[GenericWriteDIV], [II_MOD, II_MODU]>;
121
122def : ItinRW<[GenericWriteALU], [II_ADDIUPC, II_ALIGN, II_ALUIPC, II_AUI,
123                                 II_AUIPC, II_BITSWAP, II_LSA, II_SELCCZ]>;
124
125// MIPS64R6
126// ========
127
128def : ItinRW<[GenericWriteALU], [II_DALIGN, II_DAHI, II_DATI, II_DAUI,
129                               II_DBITSWAP, II_DLSA]>;
130
131def : ItinRW<[GenericWriteMDUtoGPR], [II_DMUH, II_DMUHU]>;
132def : ItinRW<[GenericWriteDIV], [II_DMOD, II_DMODU]>;
133
134// clo, clz, di, mfhi, mflo
135def : ItinRW<[GenericWriteALULong], [II_MFHI_MFLO]>;
136def : ItinRW<[GenericWriteALU], [II_MOVN, II_MOVZ]>;
137def : ItinRW<[GenericWriteMove], [II_MTHI_MTLO, II_RDHWR]>;
138
139
140// CTISTD Pipeline
141// ---------------
142
143def GenericIssueCTISTD : ProcResource<1> { let Super = GenericALU; }
144
145def GenericLDST : ProcResource<1> { let BufferSize = 1; }
146def GenericIssueLDST : ProcResource<1> { let Super = GenericLDST; }
147
148def GenericWriteJump : SchedWriteRes<[GenericIssueCTISTD]>;
149def GenericWriteJumpAndLink : SchedWriteRes<[GenericIssueCTISTD]> {
150  let Latency = 2;
151}
152
153// b, beq, beql, bg[et]z, bl[et]z, bne, bnel, j, syscall, jal, bltzal, jalx,
154// jalr, jr.hb, jr, jalr.hb, jarlc, jialc
155def : ItinRW<[GenericWriteJump], [II_B, II_BCC, II_BCCZ, II_BCCZAL, II_J,
156                                  II_JR, II_JR_HB, II_ERET, II_ERETNC,
157                                  II_DERET]>;
158
159def : ItinRW<[GenericWriteJumpAndLink], [II_JAL, II_JALR, II_JALR_HB,
160                                         II_BC2CCZ]>;
161
162def : ItinRW<[GenericWriteJump], [II_JRC, II_JRADDIUSP]>;
163
164def : ItinRW<[GenericWriteJumpAndLink], [II_BCCZALS, II_JALS, II_JALRS]>;
165
166// MIPSR6
167// ======
168
169def : ItinRW<[GenericWriteJumpAndLink], [II_BALC, II_JALRC, II_JIALC]>;
170
171def : ItinRW<[GenericWriteJump], [II_JIC, II_BC, II_BCCC, II_BCCZC]>;
172
173
174def GenericWriteTrap : SchedWriteRes<[GenericIssueCTISTD]>;
175
176def : ItinRW<[GenericWriteTrap], [II_BREAK, II_SYSCALL, II_TEQ, II_TEQI,
177                                  II_TGE, II_TGEI, II_TGEIU, II_TGEU, II_TNE,
178                                  II_TNEI, II_TLT, II_TLTI, II_TLTU, II_TTLTIU,
179                                  II_TRAP, II_SDBBP]>;
180
181// COP0 Pipeline
182// =============
183
184def GenericCOP0 : ProcResource<1> { let BufferSize = 1; }
185
186def GenericIssueCOP0 : ProcResource<1> { let Super = GenericCOP0; }
187def GenericWriteCOP0TLB : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 4; }
188def GenericWriteCOP0 : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 3; }
189def GenericReadCOP0 : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 2; }
190def GenericReadWritePGPR : SchedWriteRes<[GenericIssueCOP0]>;
191def GenericReadWriteCOP0Long : SchedWriteRes<[GenericIssueCOP0]> {
192  let Latency = 5;
193}
194def GenericWriteCOP0Short : SchedWriteRes<[GenericIssueCOP0]>;
195
196def : ItinRW<[GenericWriteCOP0TLB], [II_TLBP, II_TLBR, II_TLBWI, II_TLBWR]>;
197def : ItinRW<[GenericWriteCOP0TLB], [II_TLBINV, II_TLBINVF]>;
198
199def : ItinRW<[GenericReadCOP0], [II_MFC0]>;
200def : ItinRW<[GenericWriteCOP0], [II_MTC0]>;
201
202def : ItinRW<[GenericWriteCOP0], [II_EVP, II_DVP]>;
203
204// MIPSR5
205// ======
206def : ItinRW<[GenericReadCOP0], [II_MFHC0]>;
207def : ItinRW<[GenericWriteCOP0], [II_MTHC0]>;
208
209// MIPS64
210// ======
211
212def : ItinRW<[GenericReadCOP0], [II_DMFC0]>;
213def : ItinRW<[GenericWriteCOP0], [II_DMTC0]>;
214
215def : ItinRW<[GenericWriteCOP0], [II_RDPGPR, II_WRPGPR]>;
216
217def : ItinRW<[GenericWriteCOP0], [II_DI, II_EI]>;
218
219def : ItinRW<[GenericWriteCOP0], [II_EHB, II_PAUSE, II_WAIT]>;
220
221def GenericCOP2 : ProcResource<1> { let BufferSize = 1; }
222def GenericWriteCOPOther : SchedWriteRes<[GenericCOP2]>;
223
224def : ItinRW<[GenericWriteCOPOther], [II_MFC2, II_MTC2, II_DMFC2, II_DMTC2]>;
225
226// LDST Pipeline
227// -------------
228
229def GenericWriteLoad : SchedWriteRes<[GenericIssueLDST]> {
230  let Latency = 2;
231}
232
233def GenericWritePref : SchedWriteRes<[GenericIssueLDST]>;
234def GenericWriteSync : SchedWriteRes<[GenericIssueLDST]>;
235def GenericWriteCache : SchedWriteRes<[GenericIssueLDST]> { let Latency = 5; }
236
237def GenericWriteStore : SchedWriteRes<[GenericIssueLDST]>;
238def GenericWriteStoreSC : SchedWriteRes<[GenericIssueLDST]> { let Latency = 2; }
239
240def GenericWriteGPRFromBypass : SchedWriteRes<[GenericIssueLDST]> {
241  let Latency = 2;
242}
243
244def GenericWriteStoreFromOtherUnits : SchedWriteRes<[GenericIssueLDST]>;
245def GenericWriteLoadToOtherUnits : SchedWriteRes<[GenericIssueLDST]> {
246  let Latency = 0;
247}
248
249// l[bhw], l[bh]u, ll
250def : ItinRW<[GenericWriteLoad], [II_LB, II_LBU, II_LH, II_LHU, II_LW, II_LL,
251                                  II_LWC2, II_LWC3, II_LDC2, II_LDC3]>;
252
253// lw[lr]
254def : ItinRW<[GenericWriteLoad], [II_LWL, II_LWR]>;
255
256// MIPS64 loads
257def : ItinRW<[GenericWriteLoad], [II_LD, II_LLD, II_LWU]>;
258
259// ld[lr]
260def : ItinRW<[GenericWriteLoad], [II_LDL, II_LDR]>;
261
262// MIPS32 EVA
263def : ItinRW<[GenericWriteLoad], [II_LBE, II_LBUE, II_LHE, II_LHUE, II_LWE,
264                                  II_LLE]>;
265
266def : ItinRW<[GenericWriteLoad], [II_LWLE, II_LWRE]>;
267
268// MIPS MT instructions
269// ====================
270
271def : ItinRW<[GenericWriteMove], [II_DMT, II_DVPE, II_EMT, II_EVPE]>;
272
273def : ItinRW<[GenericReadWriteCOP0Long], [II_YIELD]>;
274def : ItinRW<[GenericWriteCOP0Short], [II_FORK]>;
275
276// MIPS32R6 and MIPS16e
277// ====================
278
279def : ItinRW<[GenericWriteLoad], [II_LWPC]>;
280
281// MIPS64R6
282// ====================
283
284def : ItinRW<[GenericWriteLoad], [II_LWUPC, II_LDPC]>;
285
286
287// s[bhw], sc, s[dw]c[23]
288def : ItinRW<[GenericWriteStore], [II_SB, II_SH, II_SW, II_SWC2, II_SWC3,
289                                   II_SDC2, II_SDC3]>;
290
291def : ItinRW<[GenericWriteStoreSC], [II_SC]>;
292
293// PreMIPSR6 sw[lr]
294def : ItinRW<[GenericWriteStore], [II_SWL, II_SWR]>;
295
296// EVA ASE stores
297def : ItinRW<[GenericWriteStore], [II_SBE, II_SHE, II_SWE, II_SCE]>;
298
299def : ItinRW<[GenericWriteStore], [II_SWLE, II_SWRE]>;
300
301// MIPS64
302// ======
303
304def : ItinRW<[GenericWriteStore], [II_SD, II_SCD]>;
305
306// PreMIPSR6 stores
307// ================
308
309def : ItinRW<[GenericWriteStore], [II_SDL, II_SDR]>;
310
311// MIPS16e
312// =======
313
314def : ItinRW<[GenericWriteLoad], [II_RESTORE]>;
315
316def : ItinRW<[GenericWriteStore], [II_SAVE]>;
317
318// microMIPS
319// =========
320
321def : ItinRW<[GenericWriteLoad], [II_LWM, II_LWP, II_LWXS]>;
322
323def : ItinRW<[GenericWriteStore], [II_SWM, II_SWP]>;
324
325// pref
326def : ItinRW<[GenericWritePref], [II_PREF]>;
327
328def : ItinRW<[GenericWritePref], [II_PREFE]>;
329
330// cache
331def : ItinRW<[GenericWriteCache], [II_CACHE]>;
332
333def : ItinRW<[GenericWriteCache], [II_CACHEE]>;
334
335// sync
336def : ItinRW<[GenericWriteSync], [II_SYNC]>;
337
338def : ItinRW<[GenericWriteSync], [II_SYNCI]>;
339
340// FPU Pipelines
341// =============
342
343def GenericFPQ : ProcResource<1> { let BufferSize = 1; }
344def GenericIssueFPUS : ProcResource<1> { let Super = GenericFPQ; }
345def GenericIssueFPUL : ProcResource<1> { let Super = GenericFPQ; }
346def GenericIssueFPULoad : ProcResource<1> { let Super = GenericFPQ; }
347def GenericIssueFPUStore : ProcResource<1> { let Super = GenericFPQ; }
348def GenericIssueFPUMove : ProcResource<1> { let Super = GenericFPQ; }
349def GenericFPUDivSqrt : ProcResource<1> { let Super = GenericFPQ; }
350
351// The floating point compare of the 24k series including interAptiv has a
352// listed latency of 1-2. Using the higher latency here.
353
354def GenericWriteFPUCmp : SchedWriteRes<[GenericIssueFPUS]> { let Latency = 2; }
355def GenericWriteFPUS : SchedWriteRes<[GenericIssueFPUS]> { let Latency = 4; }
356def GenericWriteFPUL : SchedWriteRes<[GenericIssueFPUL]> { let Latency = 5; }
357def GenericWriteFPUStore : SchedWriteRes<[GenericIssueFPUStore]> { let
358  Latency = 1;
359}
360def GenericWriteFPULoad : SchedWriteRes<[GenericIssueFPULoad]> {
361  let Latency = 2;
362}
363def GenericWriteFPUMoveFP : SchedWriteRes<[GenericIssueFPUMove]> {
364  let Latency = 4;
365}
366def GenericWriteFPUMoveGPRFPU : SchedWriteRes<[GenericIssueFPUMove]> {
367  let Latency = 2;
368}
369def GenericWriteFPUDivS : SchedWriteRes<[GenericFPUDivSqrt]> {
370  let Latency = 17;
371  let ResourceCycles = [ 14 ];
372}
373def GenericWriteFPUDivD : SchedWriteRes<[GenericFPUDivSqrt]> {
374  let Latency = 32;
375  let ResourceCycles = [ 29 ];
376}
377def GenericWriteFPURcpS : SchedWriteRes<[GenericFPUDivSqrt]> {
378  let Latency = 13;
379  let ResourceCycles = [ 10 ];
380}
381def GenericWriteFPURcpD : SchedWriteRes<[GenericFPUDivSqrt]> {
382  let Latency = 25;
383  let ResourceCycles = [ 21 ];
384}
385def GenericWriteFPURsqrtS : SchedWriteRes<[GenericFPUDivSqrt]> {
386  let Latency = 17;
387  let ResourceCycles = [ 14 ];
388}
389def GenericWriteFPURsqrtD : SchedWriteRes<[GenericFPUDivSqrt]> {
390  let Latency = 32;
391  let ResourceCycles = [ 29 ];
392}
393def GenericWriteFPUSqrtS : SchedWriteRes<[GenericFPUDivSqrt]> {
394  let Latency = 17;
395  let ResourceCycles = [ 14 ];
396}
397def GenericWriteFPUSqrtD : SchedWriteRes<[GenericFPUDivSqrt]> {
398  let Latency = 29;
399  let ResourceCycles = [ 29 ];
400}
401
402// Floating point compare and branch
403// ---------------------------------
404//
405// c.<cc>.[ds], bc1[tf], bc1[tf]l
406def : ItinRW<[GenericWriteFPUCmp], [II_C_CC_D, II_C_CC_S, II_BC1F, II_BC1T,
407                                    II_BC1FL, II_BC1TL]>;
408
409def : ItinRW<[GenericWriteFPUCmp], [II_CMP_CC_D, II_CMP_CC_S]>;
410
411// Short Pipe
412// ----------
413//
414// abs.[ds], abs.ps, add.[ds], neg.[ds], neg.ps, madd.s, msub.s, nmadd,s
415// nmsub.s, sub.[ds], mul.s
416
417def : ItinRW<[GenericWriteFPUS], [II_ABS, II_ADD_D, II_ADD_S, II_MADD_S,
418                                  II_MSUB_S, II_MUL_S, II_NEG, II_NMADD_S,
419                                  II_NMSUB_S, II_SUB_S, II_SUB_D]>;
420// mov[tf].[ds]
421
422def : ItinRW<[GenericWriteFPUS], [II_MOVF_S, II_MOVF_D, II_MOVT_S, II_MOVT_D]>;
423
424// MIPSR6
425// ------
426//
427// sel(eq|ne).[ds], max.[ds], maxa.[ds], min.[ds], mina.[ds], class.[ds]
428def : ItinRW<[GenericWriteFPUS], [II_SELCCZ_S, II_SELCCZ_D, II_MAX_S,
429                                  II_MAX_D, II_MAXA_S, II_MAXA_D, II_MIN_S,
430                                  II_MIN_D, II_MINA_S, II_MINA_D, II_CLASS_S,
431                                  II_CLASS_D]>;
432
433// Long Pipe
434// ----------
435//
436// nmadd.d, nmsub.d, mul.[ds], mul.ps, ceil.[wl].[sd], cvt.d.[sw], cvt.s.[dw],
437// cvt.w.[sd], cvt.[sw].ps, trunc.w.[ds], trunc.w.ps, floor.[ds],
438// round.[lw].[ds], floor.[lw].ds
439
440// madd.d, msub.dm mul.d, mul.ps, nmadd.d, nmsub.d, ceil.[wl].[sd], cvt.d.[sw],
441// cvt.s.[dw], cvt.w.[sd], cvt.[sw].ps, round.[lw].[ds], floor.[lw].ds,
442// trunc.w.[ds], trunc.w.ps,
443def : ItinRW<[GenericWriteFPUL], [II_MADD_D, II_MSUB_D, II_MUL_D, II_NMADD_D,
444                                  II_NMSUB_D, II_CEIL, II_CVT,
445                                  II_FLOOR, II_ROUND, II_TRUNC]>;
446
447// div.[ds], div.ps
448def : ItinRW<[GenericWriteFPUDivS], [II_DIV_S]>;
449def : ItinRW<[GenericWriteFPUDivD], [II_DIV_D]>;
450
451// sqrt.[ds], sqrt.ps
452def : ItinRW<[GenericWriteFPUSqrtS], [II_SQRT_S]>;
453def : ItinRW<[GenericWriteFPUSqrtD], [II_SQRT_D]>;
454
455// rsqrt.[ds], recip.[ds]
456def : ItinRW<[GenericWriteFPURcpS], [II_RECIP_S, II_RSQRT_S]>;
457def : ItinRW<[GenericWriteFPURcpD], [II_RECIP_D, II_RSQRT_D]>;
458
459// MIPSR6
460// ======
461//
462// rint.[ds]
463def : ItinRW<[GenericWriteFPUL], [II_RINT_S, II_RINT_D]>;
464
465// Load Pipe
466// ---------
467
468// ctc1, mtc1, mthc1, cfc1, mfc1, mfhc1
469def : ItinRW<[GenericWriteFPUMoveGPRFPU], [II_CFC1, II_CTC1, II_MFC1, II_MFHC1,
470                                           II_MTC1, II_MTHC1]>;
471
472// swc1, swxc1
473def : ItinRW<[GenericWriteFPUStore], [II_SDC1, II_SDXC1, II_SUXC1, II_SWC1,
474                                      II_SWXC1]>;
475
476// movn.[ds], movz.[ds]
477def : ItinRW<[GenericWriteFPUMoveFP], [II_MOV_D, II_MOV_S, II_MOVF, II_MOVT,
478                                       II_MOVN_D, II_MOVN_S, II_MOVZ_D,
479                                       II_MOVZ_S]>;
480
481// l[dw]x?c1
482def : ItinRW<[GenericWriteFPULoad], [II_LDC1, II_LDXC1, II_LUXC1, II_LWC1,
483                                     II_LWXC1]>;
484
485// MIPS64
486// ======
487
488def : ItinRW<[GenericWriteFPUMoveGPRFPU], [II_DMFC1, II_DMTC1]>;
489
490// MIPSR6
491// ======
492
493def : ItinRW<[GenericWriteFPUS], [II_MADDF_S, II_MSUBF_S]>;
494
495def : ItinRW<[GenericWriteFPUS], [II_MADDF_D, II_MSUBF_D]>;
496
497def : ItinRW<[GenericWriteFPUCmp], [II_BC1CCZ, II_SEL_D, II_SEL_S]>;
498
499// Cavium Networks MIPS (cnMIPS) - Octeon, HasCnMips
500// =================================================
501
502def : ItinRW<[GenericWriteALU], [II_SEQ_SNE, II_SEQI_SNEI, II_POP, II_BADDU,
503                                 II_BBIT]>;
504
505// MIPS DSP ASE, HasDSP
506// ====================
507
508def GenericDSP : ProcResource<1> { let BufferSize = 1; }
509def GenericDSPShort : SchedWriteRes<[GenericDSP]> { let Latency = 2; }
510def GenericDSPLong : SchedWriteRes<[GenericDSP]> { let Latency = 6; }
511def GenericDSPBypass : SchedWriteRes<[GenericDSP]> { let Latency = 1; }
512def GenericDSPMTHILO : SchedWriteRes<[GenericDSP]> { let Latency = 5; }
513def GenericDSPLoad : SchedWriteRes<[GenericDSP]> { let Latency = 4; }
514def GenericDSPMTHLIP : SchedWriteRes<[GenericDSP]> { let Latency = 5; }
515
516def : InstRW<[GenericDSPLong], (instregex "^EXTRV_RS_W$")>;
517def : InstRW<[GenericDSPLong], (instregex "^EXTRV_R_W$")>;
518def : InstRW<[GenericDSPLong], (instregex "^EXTRV_S_H$")>;
519def : InstRW<[GenericDSPLong], (instregex "^EXTRV_W$")>;
520def : InstRW<[GenericDSPLong], (instregex "^EXTR_RS_W$")>;
521def : InstRW<[GenericDSPLong], (instregex "^EXTR_R_W$")>;
522def : InstRW<[GenericDSPLong], (instregex "^EXTR_S_H$")>;
523def : InstRW<[GenericDSPLong], (instregex "^EXTR_W$")>;
524def : InstRW<[GenericDSPLong], (instregex "^INSV$")>;
525
526def : InstRW<[GenericDSPMTHLIP], (instregex "^MTHLIP$")>;
527def : InstRW<[GenericDSPMTHILO], (instregex "^MTHI_DSP$")>;
528def : InstRW<[GenericDSPMTHILO], (instregex "^MTLO_DSP$")>;
529
530def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_PH$")>;
531def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_W$")>;
532def : InstRW<[GenericDSPShort], (instregex "^ADDQ_PH$")>;
533def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_PH$")>;
534def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_W$")>;
535def : InstRW<[GenericDSPShort], (instregex "^ADDSC$")>;
536def : InstRW<[GenericDSPShort], (instregex "^ADDU_QB$")>;
537def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_QB$")>;
538def : InstRW<[GenericDSPShort], (instregex "^ADDWC$")>;
539def : InstRW<[GenericDSPShort], (instregex "^BITREV$")>;
540def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32$")>;
541def : InstRW<[GenericDSPShort], (instregex "^CMPGU_EQ_QB$")>;
542def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LE_QB$")>;
543def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LT_QB$")>;
544def : InstRW<[GenericDSPShort], (instregex "^CMPU_EQ_QB$")>;
545def : InstRW<[GenericDSPShort], (instregex "^CMPU_LE_QB$")>;
546def : InstRW<[GenericDSPShort], (instregex "^CMPU_LT_QB$")>;
547def : InstRW<[GenericDSPShort], (instregex "^CMP_EQ_PH$")>;
548def : InstRW<[GenericDSPShort], (instregex "^CMP_LE_PH$")>;
549def : InstRW<[GenericDSPShort], (instregex "^CMP_LT_PH$")>;
550def : InstRW<[GenericDSPShort], (instregex "^DPAQ_SA_L_W$")>;
551def : InstRW<[GenericDSPShort], (instregex "^DPAQ_S_W_PH$")>;
552def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBL$")>;
553def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBR$")>;
554def : InstRW<[GenericDSPShort], (instregex "^DPSQ_SA_L_W$")>;
555def : InstRW<[GenericDSPShort], (instregex "^DPSQ_S_W_PH$")>;
556def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBL$")>;
557def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBR$")>;
558def : InstRW<[GenericDSPShort], (instregex "^EXTPDPV$")>;
559def : InstRW<[GenericDSPShort], (instregex "^EXTPDP$")>;
560def : InstRW<[GenericDSPShort], (instregex "^EXTPV$")>;
561def : InstRW<[GenericDSPShort], (instregex "^EXTP$")>;
562def : InstRW<[GenericDSPShort], (instregex "^LBUX$")>;
563def : InstRW<[GenericDSPShort], (instregex "^LHX$")>;
564def : InstRW<[GenericDSPShort], (instregex "^LWX$")>;
565def : InstRW<[GenericDSPShort], (instregex "^MADDU_DSP$")>;
566def : InstRW<[GenericDSPShort], (instregex "^MADD_DSP$")>;
567def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHL$")>;
568def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHR$")>;
569def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHL$")>;
570def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHR$")>;
571def : InstRW<[GenericDSPShort], (instregex "^MFHI_DSP$")>;
572def : InstRW<[GenericDSPShort], (instregex "^MFLO_DSP$")>;
573def : InstRW<[GenericDSPShort], (instregex "^MODSUB$")>;
574def : InstRW<[GenericDSPShort], (instregex "^MSUBU_DSP$")>;
575def : InstRW<[GenericDSPShort], (instregex "^MSUB_DSP$")>;
576def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHL$")>;
577def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHR$")>;
578def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBL$")>;
579def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBR$")>;
580def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_PH$")>;
581def : InstRW<[GenericDSPShort], (instregex "^MULSAQ_S_W_PH$")>;
582def : InstRW<[GenericDSPShort], (instregex "^MULTU_DSP$")>;
583def : InstRW<[GenericDSPShort], (instregex "^MULT_DSP$")>;
584def : InstRW<[GenericDSPShort], (instregex "^PACKRL_PH$")>;
585def : InstRW<[GenericDSPShort], (instregex "^PICK_PH$")>;
586def : InstRW<[GenericDSPShort], (instregex "^PICK_QB$")>;
587def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBLA$")>;
588def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBL$")>;
589def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBRA$")>;
590def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBR$")>;
591def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHL$")>;
592def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHR$")>;
593def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBLA$")>;
594def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBL$")>;
595def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBRA$")>;
596def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBR$")>;
597def : InstRW<[GenericDSPShort], (instregex "^PRECRQU_S_QB_PH$")>;
598def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_PH_W$")>;
599def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_QB_PH$")>;
600def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_RS_PH_W$")>;
601def : InstRW<[GenericDSPShort], (instregex "^RADDU_W_QB$")>;
602def : InstRW<[GenericDSPShort], (instregex "^RDDSP$")>;
603def : InstRW<[GenericDSPShort], (instregex "^REPLV_PH$")>;
604def : InstRW<[GenericDSPShort], (instregex "^REPLV_QB$")>;
605def : InstRW<[GenericDSPShort], (instregex "^REPL_PH$")>;
606def : InstRW<[GenericDSPShort], (instregex "^REPL_QB$")>;
607def : InstRW<[GenericDSPShort], (instregex "^SHILOV$")>;
608def : InstRW<[GenericDSPShort], (instregex "^SHILO$")>;
609def : InstRW<[GenericDSPShort], (instregex "^SHLLV_PH$")>;
610def : InstRW<[GenericDSPShort], (instregex "^SHLLV_QB$")>;
611def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_PH$")>;
612def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_W$")>;
613def : InstRW<[GenericDSPShort], (instregex "^SHLL_PH$")>;
614def : InstRW<[GenericDSPShort], (instregex "^SHLL_QB$")>;
615def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_PH$")>;
616def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_W$")>;
617def : InstRW<[GenericDSPShort], (instregex "^SHRAV_PH$")>;
618def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_PH$")>;
619def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_W$")>;
620def : InstRW<[GenericDSPShort], (instregex "^SHRA_PH$")>;
621def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_PH$")>;
622def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_W$")>;
623def : InstRW<[GenericDSPShort], (instregex "^SHRLV_QB$")>;
624def : InstRW<[GenericDSPShort], (instregex "^SHRL_QB$")>;
625def : InstRW<[GenericDSPShort], (instregex "^SUBQ_PH$")>;
626def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_PH$")>;
627def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_W$")>;
628def : InstRW<[GenericDSPShort], (instregex "^SUBU_QB$")>;
629def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_QB$")>;
630def : InstRW<[GenericDSPShort], (instregex "^WRDSP$")>;
631
632// MIPS DSP R2 - hasDSP, HasDSPR2, InMicroMips
633// ===========================================
634
635def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_QB$")>;
636def : InstRW<[GenericDSPShort], (instregex "^ADDQH_PH$")>;
637def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_PH$")>;
638def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_W$")>;
639def : InstRW<[GenericDSPShort], (instregex "^ADDQH_W$")>;
640def : InstRW<[GenericDSPShort], (instregex "^ADDUH_QB$")>;
641def : InstRW<[GenericDSPShort], (instregex "^ADDUH_R_QB$")>;
642def : InstRW<[GenericDSPShort], (instregex "^ADDU_PH$")>;
643def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_PH$")>;
644def : InstRW<[GenericDSPShort], (instregex "^APPEND$")>;
645def : InstRW<[GenericDSPShort], (instregex "^BALIGN$")>;
646def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_EQ_QB$")>;
647def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LE_QB$")>;
648def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LT_QB$")>;
649def : InstRW<[GenericDSPShort], (instregex "^DPA_W_PH$")>;
650def : InstRW<[GenericDSPShort], (instregex "^DPAQX_SA_W_PH$")>;
651def : InstRW<[GenericDSPShort], (instregex "^DPAQX_S_W_PH$")>;
652def : InstRW<[GenericDSPShort], (instregex "^DPAX_W_PH$")>;
653def : InstRW<[GenericDSPShort], (instregex "^DPS_W_PH$")>;
654def : InstRW<[GenericDSPShort], (instregex "^DPSQX_S_W_PH$")>;
655def : InstRW<[GenericDSPShort], (instregex "^DPSQX_SA_W_PH$")>;
656def : InstRW<[GenericDSPShort], (instregex "^DPSX_W_PH$")>;
657def : InstRW<[GenericDSPShort], (instregex "^MUL_PH$")>;
658def : InstRW<[GenericDSPShort], (instregex "^MUL_S_PH$")>;
659def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_W$")>;
660def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_PH$")>;
661def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_W$")>;
662def : InstRW<[GenericDSPShort], (instregex "^MULSA_W_PH$")>;
663def : InstRW<[GenericDSPShort], (instregex "^PRECR_QB_PH$")>;
664def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_PH_W$")>;
665def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_R_PH_W$")>;
666def : InstRW<[GenericDSPShort], (instregex "^PREPEND$")>;
667def : InstRW<[GenericDSPShort], (instregex "^SHRA_QB$")>;
668def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_QB$")>;
669def : InstRW<[GenericDSPShort], (instregex "^SHRAV_QB$")>;
670def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_QB$")>;
671def : InstRW<[GenericDSPShort], (instregex "^SHRL_PH$")>;
672def : InstRW<[GenericDSPShort], (instregex "^SHRLV_PH$")>;
673def : InstRW<[GenericDSPShort], (instregex "^SUBQH_PH$")>;
674def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_PH$")>;
675def : InstRW<[GenericDSPShort], (instregex "^SUBQH_W$")>;
676def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_W$")>;
677def : InstRW<[GenericDSPShort], (instregex "^SUBU_PH$")>;
678def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_PH$")>;
679def : InstRW<[GenericDSPShort], (instregex "^SUBUH_QB$")>;
680def : InstRW<[GenericDSPShort], (instregex "^SUBUH_R_QB$")>;
681
682// microMIPS DSP R1 - HasDSP, InMicroMips
683// ======================================
684
685def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_PH_MM$")>;
686def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_W_MM$")>;
687def : InstRW<[GenericDSPShort], (instregex "^ADDQ_PH_MM$")>;
688def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_PH_MM$")>;
689def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_W_MM$")>;
690def : InstRW<[GenericDSPShort], (instregex "^ADDSC_MM$")>;
691def : InstRW<[GenericDSPShort], (instregex "^ADDU_QB_MM$")>;
692def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_QB_MM$")>;
693def : InstRW<[GenericDSPShort], (instregex "^ADDWC_MM$")>;
694def : InstRW<[GenericDSPShort], (instregex "^BITREV_MM$")>;
695def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32_MM$")>;
696def : InstRW<[GenericDSPShort], (instregex "^CMPGU_EQ_QB_MM$")>;
697def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LE_QB_MM$")>;
698def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LT_QB_MM$")>;
699def : InstRW<[GenericDSPShort], (instregex "^CMPU_EQ_QB_MM$")>;
700def : InstRW<[GenericDSPShort], (instregex "^CMPU_LE_QB_MM$")>;
701def : InstRW<[GenericDSPShort], (instregex "^CMPU_LT_QB_MM$")>;
702def : InstRW<[GenericDSPShort], (instregex "^CMP_EQ_PH_MM$")>;
703def : InstRW<[GenericDSPShort], (instregex "^CMP_LE_PH_MM$")>;
704def : InstRW<[GenericDSPShort], (instregex "^CMP_LT_PH_MM$")>;
705def : InstRW<[GenericDSPShort], (instregex "^DPAQ_SA_L_W_MM$")>;
706def : InstRW<[GenericDSPShort], (instregex "^DPAQ_S_W_PH_MM$")>;
707def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBL_MM$")>;
708def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBR_MM$")>;
709def : InstRW<[GenericDSPShort], (instregex "^DPSQ_SA_L_W_MM$")>;
710def : InstRW<[GenericDSPShort], (instregex "^DPSQ_S_W_PH_MM$")>;
711def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBL_MM$")>;
712def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBR_MM$")>;
713def : InstRW<[GenericDSPShort], (instregex "^EXTPDPV_MM$")>;
714def : InstRW<[GenericDSPShort], (instregex "^EXTPDP_MM$")>;
715def : InstRW<[GenericDSPShort], (instregex "^EXTPV_MM$")>;
716def : InstRW<[GenericDSPShort], (instregex "^EXTP_MM$")>;
717def : InstRW<[GenericDSPShort], (instregex "^EXTRV_RS_W_MM$")>;
718def : InstRW<[GenericDSPShort], (instregex "^EXTRV_R_W_MM$")>;
719def : InstRW<[GenericDSPShort], (instregex "^EXTRV_S_H_MM$")>;
720def : InstRW<[GenericDSPShort], (instregex "^EXTRV_W_MM$")>;
721def : InstRW<[GenericDSPShort], (instregex "^EXTR_RS_W_MM$")>;
722def : InstRW<[GenericDSPShort], (instregex "^EXTR_R_W_MM$")>;
723def : InstRW<[GenericDSPShort], (instregex "^EXTR_S_H_MM$")>;
724def : InstRW<[GenericDSPShort], (instregex "^EXTR_W_MM$")>;
725def : InstRW<[GenericDSPShort], (instregex "^INSV_MM$")>;
726def : InstRW<[GenericDSPShort], (instregex "^LBUX_MM$")>;
727def : InstRW<[GenericDSPShort], (instregex "^LHX_MM$")>;
728def : InstRW<[GenericDSPShort], (instregex "^LWX_MM$")>;
729def : InstRW<[GenericDSPShort], (instregex "^MADDU_DSP_MM$")>;
730def : InstRW<[GenericDSPShort], (instregex "^MADD_DSP_MM$")>;
731def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHL_MM$")>;
732def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHR_MM$")>;
733def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHL_MM$")>;
734def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHR_MM$")>;
735def : InstRW<[GenericDSPShort], (instregex "^MFHI_DSP_MM$")>;
736def : InstRW<[GenericDSPShort], (instregex "^MFLO_DSP_MM$")>;
737def : InstRW<[GenericDSPShort], (instregex "^MODSUB_MM$")>;
738def : InstRW<[GenericDSPShort], (instregex "^MOVEP_MM$")>;
739def : InstRW<[GenericDSPShort], (instregex "^MOVN_I_MM$")>;
740def : InstRW<[GenericDSPShort], (instregex "^MOVZ_I_MM$")>;
741def : InstRW<[GenericDSPShort], (instregex "^MSUBU_DSP_MM$")>;
742def : InstRW<[GenericDSPShort], (instregex "^MSUB_DSP_MM$")>;
743def : InstRW<[GenericDSPShort], (instregex "^MTHI_DSP_MM$")>;
744def : InstRW<[GenericDSPShort], (instregex "^MTHLIP_MM$")>;
745def : InstRW<[GenericDSPShort], (instregex "^MTLO_DSP_MM$")>;
746def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHL_MM$")>;
747def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHR_MM$")>;
748def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBL_MM$")>;
749def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBR_MM$")>;
750def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_PH_MM$")>;
751def : InstRW<[GenericDSPShort], (instregex "^MULSAQ_S_W_PH_MM$")>;
752def : InstRW<[GenericDSPShort], (instregex "^MULTU_DSP_MM$")>;
753def : InstRW<[GenericDSPShort], (instregex "^MULT_DSP_MM$")>;
754def : InstRW<[GenericDSPShort], (instregex "^PACKRL_PH_MM$")>;
755def : InstRW<[GenericDSPShort], (instregex "^PICK_PH_MM$")>;
756def : InstRW<[GenericDSPShort], (instregex "^PICK_QB_MM$")>;
757def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBLA_MM$")>;
758def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBL_MM$")>;
759def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBRA_MM$")>;
760def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBR_MM$")>;
761def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHL_MM$")>;
762def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHR_MM$")>;
763def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBLA_MM$")>;
764def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBL_MM$")>;
765def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBRA_MM$")>;
766def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBR_MM$")>;
767def : InstRW<[GenericDSPShort], (instregex "^PRECRQU_S_QB_PH_MM$")>;
768def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_PH_W_MM$")>;
769def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_QB_PH_MM$")>;
770def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_RS_PH_W_MM$")>;
771def : InstRW<[GenericDSPShort], (instregex "^RADDU_W_QB_MM$")>;
772def : InstRW<[GenericDSPShort], (instregex "^RDDSP_MM$")>;
773def : InstRW<[GenericDSPShort], (instregex "^REPLV_PH_MM$")>;
774def : InstRW<[GenericDSPShort], (instregex "^REPLV_QB_MM$")>;
775def : InstRW<[GenericDSPShort], (instregex "^REPL_PH_MM$")>;
776def : InstRW<[GenericDSPShort], (instregex "^REPL_QB_MM$")>;
777def : InstRW<[GenericDSPShort], (instregex "^SHILOV_MM$")>;
778def : InstRW<[GenericDSPShort], (instregex "^SHILO_MM$")>;
779def : InstRW<[GenericDSPShort], (instregex "^SHLLV_PH_MM$")>;
780def : InstRW<[GenericDSPShort], (instregex "^SHLLV_QB_MM$")>;
781def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_PH_MM$")>;
782def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_W_MM$")>;
783def : InstRW<[GenericDSPShort], (instregex "^SHLL_PH_MM$")>;
784def : InstRW<[GenericDSPShort], (instregex "^SHLL_QB_MM$")>;
785def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_PH_MM$")>;
786def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_W_MM$")>;
787def : InstRW<[GenericDSPShort], (instregex "^SHRAV_PH_MM$")>;
788def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_PH_MM$")>;
789def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_W_MM$")>;
790def : InstRW<[GenericDSPShort], (instregex "^SHRA_PH_MM$")>;
791def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_PH_MM$")>;
792def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_W_MM$")>;
793def : InstRW<[GenericDSPShort], (instregex "^SHRLV_QB_MM$")>;
794def : InstRW<[GenericDSPShort], (instregex "^SHRL_QB_MM$")>;
795def : InstRW<[GenericDSPShort], (instregex "^SUBQ_PH_MM$")>;
796def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_PH_MM$")>;
797def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_W_MM$")>;
798def : InstRW<[GenericDSPShort], (instregex "^SUBU_QB_MM$")>;
799def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_QB_MM$")>;
800def : InstRW<[GenericDSPShort], (instregex "^WRDSP_MM$")>;
801
802
803// microMIPS DSP R2 - hasDSP, HasDSPR2, InMicroMips
804// ================================================
805
806def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_QB_MMR2$")>;
807def : InstRW<[GenericDSPShort], (instregex "^ADDQH_PH_MMR2$")>;
808def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_PH_MMR2$")>;
809def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_W_MMR2$")>;
810def : InstRW<[GenericDSPShort], (instregex "^ADDQH_W_MMR2$")>;
811def : InstRW<[GenericDSPShort], (instregex "^ADDUH_QB_MMR2$")>;
812def : InstRW<[GenericDSPShort], (instregex "^ADDUH_R_QB_MMR2$")>;
813def : InstRW<[GenericDSPShort], (instregex "^ADDU_PH_MMR2$")>;
814def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_PH_MMR2$")>;
815def : InstRW<[GenericDSPShort], (instregex "^APPEND_MMR2$")>;
816def : InstRW<[GenericDSPShort], (instregex "^BALIGN_MMR2$")>;
817def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_EQ_QB_MMR2$")>;
818def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LE_QB_MMR2$")>;
819def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LT_QB_MMR2$")>;
820def : InstRW<[GenericDSPShort], (instregex "^DPA_W_PH_MMR2$")>;
821def : InstRW<[GenericDSPShort], (instregex "^DPAQX_SA_W_PH_MMR2$")>;
822def : InstRW<[GenericDSPShort], (instregex "^DPAQX_S_W_PH_MMR2$")>;
823def : InstRW<[GenericDSPShort], (instregex "^DPAX_W_PH_MMR2$")>;
824def : InstRW<[GenericDSPShort], (instregex "^DPS_W_PH_MMR2$")>;
825def : InstRW<[GenericDSPShort], (instregex "^DPSQX_S_W_PH_MMR2$")>;
826def : InstRW<[GenericDSPShort], (instregex "^DPSQX_SA_W_PH_MMR2$")>;
827def : InstRW<[GenericDSPShort], (instregex "^DPSX_W_PH_MMR2$")>;
828def : InstRW<[GenericDSPShort], (instregex "^MUL_PH_MMR2$")>;
829def : InstRW<[GenericDSPShort], (instregex "^MUL_S_PH_MMR2$")>;
830def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_W_MMR2$")>;
831def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_PH_MMR2$")>;
832def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_W_MMR2$")>;
833def : InstRW<[GenericDSPShort], (instregex "^MULSA_W_PH_MMR2$")>;
834def : InstRW<[GenericDSPShort], (instregex "^PRECR_QB_PH_MMR2$")>;
835def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_PH_W_MMR2$")>;
836def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_R_PH_W_MMR2$")>;
837def : InstRW<[GenericDSPShort], (instregex "^PREPEND_MMR2$")>;
838def : InstRW<[GenericDSPShort], (instregex "^SHRA_QB_MMR2$")>;
839def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_QB_MMR2$")>;
840def : InstRW<[GenericDSPShort], (instregex "^SHRAV_QB_MMR2$")>;
841def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_QB_MMR2$")>;
842def : InstRW<[GenericDSPShort], (instregex "^SHRL_PH_MMR2$")>;
843def : InstRW<[GenericDSPShort], (instregex "^SHRLV_PH_MMR2$")>;
844def : InstRW<[GenericDSPShort], (instregex "^SUBQH_PH_MMR2$")>;
845def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_PH_MMR2$")>;
846def : InstRW<[GenericDSPShort], (instregex "^SUBQH_W_MMR2$")>;
847def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_W_MMR2$")>;
848def : InstRW<[GenericDSPShort], (instregex "^SUBU_PH_MMR2$")>;
849def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_PH_MMR2$")>;
850def : InstRW<[GenericDSPShort], (instregex "^SUBUH_QB_MMR2$")>;
851def : InstRW<[GenericDSPShort], (instregex "^SUBUH_R_QB_MMR2$")>;
852
853// microMIPS DSP R3 - hasDSP, hasDSPR2, hasDSPR3, InMicroMips
854// ==========================================================
855
856def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32C_MMR3$")>;
857
858// MIPS MSA ASE - hasMSA
859// =====================
860
861def GenericWriteMSAShortLogic : SchedWriteRes<[GenericIssueFPUS]>;
862def GenericWriteMSAShortInt : SchedWriteRes<[GenericIssueFPUS]> {
863let Latency = 2;
864}
865def GenericWriteMoveOtherUnitsToFPU : SchedWriteRes<[GenericIssueFPUS]>;
866def GenericWriteMSAOther3 : SchedWriteRes<[GenericIssueFPUS]> {
867let Latency = 3;
868}
869def GenericWriteMSALongInt : SchedWriteRes<[GenericIssueFPUS]> {
870let Latency = 5;
871}
872def GenericWriteFPUDivI : SchedWriteRes<[GenericFPQ]> {
873  let Latency = 33;
874  let ResourceCycles = [ 33 ];
875}
876
877// FPUS is also used in moves from floating point and MSA registers to general
878// purpose registers.
879def GenericWriteMoveFPUSToOtherUnits : SchedWriteRes<[GenericIssueFPUS]> {
880  let Latency = 0;
881}
882
883// FPUL is also used in moves from floating point and MSA registers to general
884// purpose registers.
885def GenericWriteMoveFPULToOtherUnits : SchedWriteRes<[GenericIssueFPUL]>;
886
887
888// adds_a.[bhwd], adds_[asu].[bhwd], addvi?.[bhwd], asub_[us].[bhwd],
889// aver?_[us].[bhwd]
890def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADD_A_[BHWD]$")>;
891def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADDS_[ASU]_[BHWD]$")>;
892
893// TODO: ADDVI_[BHW] might be 1 cycle latency rather than 2. Need to confirm it.
894// add.[bhwd], addvi.[bhwd], asub_[us].[bhwd], ave.[bhwd], aver.[bhwd]
895def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADDVI?_[BHWD]$")>;
896def : InstRW<[GenericWriteMSAShortInt], (instregex "^ASUB_[US].[BHWD]$")>;
897def : InstRW<[GenericWriteMSAShortInt], (instregex "^AVER?_[US].[BHWD]$")>;
898
899// and.v, andi.b, move.v, ldi.[bhwd], xor.v, nor.v, xori.b, nori.b
900def : InstRW<[GenericWriteMSAShortLogic], (instregex "^MOVE_V$")>;
901def : InstRW<[GenericWriteMSAShortLogic], (instregex "^LDI_[BHWD]$")>;
902def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(AND|OR|[XN]OR)_V$")>;
903def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(AND|OR|[XN]OR)I_B$")>;
904def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(AND|OR|[XN]OR)I_B$")>;
905
906// vshf.[bhwd], binsl.[bhwd], binsr.[bhwd], insert.[bhwd], sld?.[bhwd],
907// bset.[bhwd], bclr.[bhwd], bneg.[bhwd], bsel_v, bseli_b
908def : InstRW<[GenericWriteMSAShortInt], (instregex "^VSHF_[BHWD]$")>;
909def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BINSL|BINSLI)_[BHWD]$")>;
910def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BINSR|BINSRI)_[BHWD]$")>;
911def : InstRW<[GenericWriteMSAShortInt], (instregex "^INSERT_[BHWD]$")>;
912def : InstRW<[GenericWriteMSAShortInt], (instregex "^(SLD|SLDI)_[BHWD]$")>;
913def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BSET|BSETI)_[BHWD]$")>;
914def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BCLR|BCLRI)_[BHWD]$")>;
915def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BNEG|BNEGI)_[BHWD]$")>;
916def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BSEL_V|BSELI_B)$")>;
917def : InstRW<[GenericWriteMSAShortInt], (instregex "^BMN*Z.*$")>;
918
919// pcnt.[bhwd], sat_s.[bhwd], sat_u.bhwd]
920def : InstRW<[GenericWriteMSAOther3], (instregex "^PCNT_[BHWD]$")>;
921def : InstRW<[GenericWriteMSAOther3], (instregex "^SAT_(S|U)_[BHWD]$")>;
922
923// bnz.[bhwdv], cfcmsa, ctcmsa
924def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(BNZ|BZ)_[BHWDV]$")>;
925def : InstRW<[GenericWriteMSAShortLogic], (instregex "^C(F|T)CMSA$")>;
926
927// shf.[bhw], fill[bhwd], splat?.[bhwd]
928def : InstRW<[GenericWriteMSAShortInt], (instregex "^SHF_[BHW]$")>;
929def : InstRW<[GenericWriteMSAShortInt], (instregex "^FILL_[BHWD]$")>;
930def : InstRW<[GenericWriteMSAShortInt], (instregex "^(SPLAT|SPLATI)_[BHWD]$")>;
931
932// pcnt.[bhwd], sat_s.[bhwd], sat_u.bhwd]
933def : InstRW<[GenericWriteMSAOther3], (instregex "^PCNT_[BHWD]$")>;
934def : InstRW<[GenericWriteMSAOther3], (instregex "^SAT_(S|U)_[BHWD]$")>;
935
936// fexp2_w, fexp2_d
937def : InstRW<[GenericWriteFPUS], (instregex "^FEXP2_(W|D)$")>;
938
939// compare, converts, round to int, floating point truncate.
940def : InstRW<[GenericWriteFPUS], (instregex "^(CLT|CLTI)_(S|U)_[BHWD]$")>;
941def : InstRW<[GenericWriteFPUS], (instregex "^(CLE|CLEI)_(S|U)_[BHWD]$")>;
942def : InstRW<[GenericWriteFPUS], (instregex "^(CEQ|CEQI)_[BHWD]$")>;
943def : InstRW<[GenericWriteFPUS], (instregex "^CMP_UN_(S|D)$")>;
944def : InstRW<[GenericWriteFPUS], (instregex "^CMP_UEQ_(S|D)$")>;
945def : InstRW<[GenericWriteFPUS], (instregex "^CMP_EQ_(S|D)$")>;
946def : InstRW<[GenericWriteFPUS], (instregex "^CMP_LT_(S|D)$")>;
947def : InstRW<[GenericWriteFPUS], (instregex "^CMP_ULT_(S|D)$")>;
948def : InstRW<[GenericWriteFPUS], (instregex "^CMP_LE_(S|D)$")>;
949def : InstRW<[GenericWriteFPUS], (instregex "^CMP_ULE_(S|D)$")>;
950def : InstRW<[GenericWriteFPUS], (instregex "^FS(AF|EQ|LT|LE|NE|OR)_(W|D)$")>;
951def : InstRW<[GenericWriteFPUS], (instregex "^FSUEQ_(W|D)$")>;
952def : InstRW<[GenericWriteFPUS], (instregex "^FSULE_(W|D)$")>;
953def : InstRW<[GenericWriteFPUS], (instregex "^FSULT_(W|D)$")>;
954def : InstRW<[GenericWriteFPUS], (instregex "^FSUNE_(W|D)$")>;
955def : InstRW<[GenericWriteFPUS], (instregex "^FSUN_(W|D)$")>;
956def : InstRW<[GenericWriteFPUS], (instregex "^FCAF_(W|D)$")>;
957def : InstRW<[GenericWriteFPUS], (instregex "^FCEQ_(W|D)$")>;
958def : InstRW<[GenericWriteFPUS], (instregex "^FCLE_(W|D)$")>;
959def : InstRW<[GenericWriteFPUS], (instregex "^FCLT_(W|D)$")>;
960def : InstRW<[GenericWriteFPUS], (instregex "^FCNE_(W|D)$")>;
961def : InstRW<[GenericWriteFPUS], (instregex "^FCOR_(W|D)$")>;
962def : InstRW<[GenericWriteFPUS], (instregex "^FCUEQ_(W|D)$")>;
963def : InstRW<[GenericWriteFPUS], (instregex "^FCULE_(W|D)$")>;
964def : InstRW<[GenericWriteFPUS], (instregex "^FCULT_(W|D)$")>;
965def : InstRW<[GenericWriteFPUS], (instregex "^FCUNE_(W|D)$")>;
966def : InstRW<[GenericWriteFPUS], (instregex "^FCUN_(W|D)$")>;
967def : InstRW<[GenericWriteFPUS], (instregex "^FABS_(W|D)$")>;
968def : InstRW<[GenericWriteFPUS], (instregex "^FFINT_(U|S)_(W|D)$")>;
969def : InstRW<[GenericWriteFPUS], (instregex "^FFQL_(W|D)$")>;
970def : InstRW<[GenericWriteFPUS], (instregex "^FFQR_(W|D)$")>;
971def : InstRW<[GenericWriteFPUS], (instregex "^FTINT_(U|S)_(W|D)$")>;
972def : InstRW<[GenericWriteFPUS], (instregex "^FRINT_(W|D)$")>;
973def : InstRW<[GenericWriteFPUS], (instregex "^FTQ_(H|W)$")>;
974def : InstRW<[GenericWriteFPUS], (instregex "^FTRUNC_(U|S)_(W|D)$")>;
975
976// fexdo.[hw], fexupl.[wd], fexupr.[wd]
977def : InstRW<[GenericWriteFPUS], (instregex "^FEXDO_(H|W)$")>;
978def : InstRW<[GenericWriteFPUS], (instregex "^FEXUPL_(W|D)$")>;
979def : InstRW<[GenericWriteFPUS], (instregex "^FEXUPR_(W|D)$")>;
980
981// fclass.[wd], fmax.[wd], fmax_a.[wd], fmin.[wd], fmin_a.[wd], flog2.[wd]
982def : InstRW<[GenericWriteFPUS], (instregex "^FCLASS_(W|D)$")>;
983def : InstRW<[GenericWriteFPUS], (instregex "^FMAX_A_(W|D)$")>;
984def : InstRW<[GenericWriteFPUS], (instregex "^FMAX_(W|D)$")>;
985def : InstRW<[GenericWriteFPUS], (instregex "^FMIN_A_(W|D)$")>;
986def : InstRW<[GenericWriteFPUS], (instregex "^FMIN_(W|D)$")>;
987def : InstRW<[GenericWriteFPUS], (instregex "^FLOG2_(W|D)$")>;
988
989// interleave right/left, interleave even/odd, insert
990def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(ILVR|ILVL)_[BHWD]$")>;
991def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(ILVEV|ILVOD)_[BHWD]$")>;
992def : InstRW<[GenericWriteMSAShortLogic], (instregex "^INSVE_[BHWD]$")>;
993
994// subs_?.[bhwd], subsus_?.[bhwd], subsuu_?.[bhwd], subvi.[bhwd], subv.[bhwd],
995def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBS_(S|U)_[BHWD]$")>;
996def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBSUS_(S|U)_[BHWD]$")>;
997def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBSUU_(S|U)_[BHWD]$")>;
998def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBVI_[BHWD]$")>;
999def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBV_[BHWD]$")>;
1000
1001// mod_[su].[bhwd], div_[su].[bhwd]
1002def : InstRW<[GenericWriteFPUDivI], (instregex "^MOD_(S|U)_[BHWD]$")>;
1003def : InstRW<[GenericWriteFPUDivI], (instregex "^DIV_(S|U)_[BHWD]$")>;
1004
1005// hadd_[su].[bhwd], hsub_[su].[bhwd], max_[sua].[bhwd], min_[sua].[bhwd],
1006// maxi_[su].[bhwd], mini_[su].[bhwd], sra?.[bhwd], srar?.[bhwd], srlr.[bhwd],
1007// sll?.[bhwd], pckev.[bhwd], pckod.[bhwd], nloc.[bhwd], nlzc.[bhwd],
1008// insve.[bhwd]
1009def : InstRW<[GenericWriteMSAShortLogic], (instregex "^HADD_(S|U)_[BHWD]$")>;
1010def : InstRW<[GenericWriteMSAShortLogic], (instregex "^HSUB_(S|U)_[BHWD]$")>;
1011def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_S_[BHWD]$")>;
1012def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_U_[BHWD]$")>;
1013def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_A_[BHWD]$")>;
1014def : InstRW<[GenericWriteMSAShortLogic],
1015             (instregex "^(MAXI|MINI)_(S|U)_[BHWD]$")>;
1016def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRA|SRAI)_[BHWD]$")>;
1017def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRL|SRLI)_[BHWD]$")>;
1018def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRAR|SRARI)_[BHWD]$")>;
1019def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRLR|SRLRI)_[BHWD]$")>;
1020def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SLL|SLLI)_[BHWD]$")>;
1021def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(PCKEV|PCKOD)_[BHWD]$")>;
1022def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(NLOC|NLZC)_[BHWD]$")>;
1023def : InstRW<[GenericWriteMSAShortLogic], (instregex "^INSVE_[BHWD]$")>;
1024
1025// dpadd_?.[bhwd], dpsub_?.[bhwd], dotp_?.[bhwd], msubv.[bhwd], maddv.[bhwd]
1026// mulv.[bhwd].
1027def : InstRW<[GenericWriteMSALongInt], (instregex "^DPADD_(S|U)_[HWD]$")>;
1028def : InstRW<[GenericWriteMSALongInt], (instregex "^DPSUB_(S|U)_[HWD]$")>;
1029def : InstRW<[GenericWriteMSALongInt], (instregex "^DOTP_(S|U)_[HWD]$")>;
1030def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUBV_[BHWD]$")>;
1031def : InstRW<[GenericWriteMSALongInt], (instregex "^MADDV_[BHWD]$")>;
1032def : InstRW<[GenericWriteMSALongInt], (instregex "^MULV_[BHWD]$")>;
1033
1034// madd?.q.[hw], msub?.q.[hw], mul?.q.[hw]
1035def : InstRW<[GenericWriteMSALongInt], (instregex "^MADDR_Q_[HW]$")>;
1036def : InstRW<[GenericWriteMSALongInt], (instregex "^MADD_Q_[HW]$")>;
1037def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUBR_Q_[HW]$")>;
1038def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUB_Q_[HW]$")>;
1039def : InstRW<[GenericWriteMSALongInt], (instregex "^MULR_Q_[HW]$")>;
1040def : InstRW<[GenericWriteMSALongInt], (instregex "^MUL_Q_[HW]$")>;
1041
1042// fadd.[dw], fmadd.[dw], fmul.[dw], frcp.[dw], frsqrt.[dw], fsqrt.[dw]
1043// fsub.[dw], fdiv.[dw]
1044def : InstRW<[GenericWriteFPUL], (instregex "^FADD_[DW]$")>;
1045def : InstRW<[GenericWriteFPUL], (instregex "^FMADD_[DW]$")>;
1046def : InstRW<[GenericWriteFPUL], (instregex "^FMSUB_[DW]$")>;
1047def : InstRW<[GenericWriteFPUL], (instregex "^FMUL_[DW]$")>;
1048def : InstRW<[GenericWriteFPUL], (instregex "^FRCP_[DW]$")>;
1049def : InstRW<[GenericWriteFPUL], (instregex "^FRSQRT_[DW]$")>;
1050def : InstRW<[GenericWriteFPUL], (instregex "^FSQRT_[DW]$")>;
1051def : InstRW<[GenericWriteFPUL], (instregex "^FSUB_[DW]$")>;
1052def : InstRW<[GenericWriteFPUL], (instregex "^FDIV_[DW]$")>;
1053
1054// copy.[su]_[bhwd]
1055def : InstRW<[GenericWriteFPUMoveGPRFPU], (instregex "^COPY_U_[BHW]$")>;
1056def : InstRW<[GenericWriteFPUMoveGPRFPU], (instregex "^COPY_S_[BHWD]$")>;
1057
1058def : InstRW<[GenericWriteFPUStore], (instregex "^ST_[BHWD]$")>;
1059def : InstRW<[GenericWriteFPULoad], (instregex "^LD_[BHWD]$")>;
1060}
1061