]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Mips / MipsScheduleGeneric.td
1 //=- MipsScheduleGeneric.td - Generic Scheduling Definitions -*- tablegen -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file describes the interAptiv processor in a manner of speaking. It
10 // describes a hypothetical version of the in-order MIPS32R2 interAptiv with all
11 // branches of the MIPS ISAs, ASEs and ISA variants. The itinerary lists are
12 // broken down into per ISA lists, so that this file can be used to rapidly
13 // develop new schedule models.
14 //
15 //===----------------------------------------------------------------------===//
16 def MipsGenericModel : SchedMachineModel {
17   int IssueWidth = 1;
18   int MicroOpBufferSize = 0;
19
20   // These figures assume an L1 hit.
21   int LoadLatency = 2;
22   int MispredictPenalty = 4;
23
24   int HighLatency = 37;
25   list<Predicate> UnsupportedFeatures = [];
26
27   let CompleteModel = 1;
28   let PostRAScheduler = 1;
29
30   // FIXME: Remove when all errors have been fixed.
31   let FullInstRWOverlapCheck = 1;
32 }
33
34 let SchedModel = MipsGenericModel in {
35
36 // ALU Pipeline
37 // ============
38
39 def GenericALU : ProcResource<1> { let BufferSize = 1; }
40 def GenericIssueALU : ProcResource<1> { let Super = GenericALU; }
41
42 def GenericWriteALU : SchedWriteRes<[GenericIssueALU]>;
43
44 // add, addi, addiu, addu, and, andi, clo, clz, ext, ins, lui, nor, or, ori,
45 // rotr, rotrv, seb, seh, sll, sllv, slt, slti, sltiu, sltu, sra, srav, srl,
46 // srlv, ssnop, sub, subu, wsbh, xor, xori
47 def : InstRW<[GenericWriteALU], (instrs ADD, ADDi, ADDiu, ADDu, AND, ANDi,
48                                  CLO, CLZ, EXT, INS, LEA_ADDiu, LUi, NOP,
49                                  NOR, OR, ORi, ROTR, ROTRV, SEB, SEH, SLL,
50                                  SLLV, SLT, SLTi, SLTiu, SLTu, SRA, SRAV, SRL,
51                                  SRLV, SSNOP, SUB, SUBu, WSBH, XOR, XORi)>;
52
53 def : InstRW<[GenericWriteALU], (instrs COPY)>;
54
55 // MIPSR6
56 // ======
57
58 // addiupc, align, aluipc, aui, auipc, bitswap, clo, clz, lsa, seleqz, selnez
59 def : InstRW<[GenericWriteALU], (instrs ADDIUPC, ALIGN, ALUIPC, AUI,
60                                  AUIPC, BITSWAP, CLO_R6, CLZ_R6, LSA_R6,
61                                  SELEQZ, SELNEZ)>;
62
63 // MIPS16e
64 // =======
65
66 def : InstRW<[GenericWriteALU], (instrs AddiuRxImmX16, AddiuRxRxImm16,
67                                  AddiuRxRxImmX16, AddiuRxRyOffMemX16,
68                                  AddiuRxPcImmX16, AddiuSpImm16, AddiuSpImmX16,
69                                  AdduRxRyRz16, AndRxRxRy16, CmpRxRy16,
70                                  CmpiRxImm16, CmpiRxImmX16, LiRxImm16,
71                                  LiRxImmX16, LiRxImmAlignX16, Move32R16,
72                                  MoveR3216, Mfhi16, Mflo16, NegRxRy16,
73                                  NotRxRy16, OrRxRxRy16, SebRx16, SehRx16,
74                                  SllX16, SllvRxRy16, SltiRxImm16,
75                                  SltiRxImmX16, SltiCCRxImmX16,
76                                  SltiuRxImm16, SltiuRxImmX16, SltiuCCRxImmX16,
77                                  SltRxRy16, SltCCRxRy16, SltuRxRy16,
78                                  SltuRxRyRz16, SltuCCRxRy16, SravRxRy16,
79                                  SraX16, SrlvRxRy16, SrlX16, SubuRxRyRz16,
80                                  XorRxRxRy16)>;
81
82 def : InstRW<[GenericWriteALU], (instrs Constant32, LwConstant32,
83                                  GotPrologue16, CONSTPOOL_ENTRY)>;
84
85 // microMIPS
86 // =========
87
88 def : InstRW<[GenericWriteALU], (instrs ADDIUPC_MM, ADDIUR1SP_MM, ADDIUR2_MM,
89                                  ADDIUS5_MM, ADDIUSP_MM, ADDU16_MM, ADD_MM,
90                                  ADDi_MM, ADDiu_MM, ADDu_MM, AND16_MM,
91                                  ANDI16_MM, AND_MM, ANDi_MM, CLO_MM, CLZ_MM,
92                                  EXT_MM, INS_MM, LEA_ADDiu_MM, LI16_MM,
93                                  LUi_MM, MOVE16_MM, MOVEP_MM, NOR_MM,
94                                  NOT16_MM, OR16_MM, OR_MM, ORi_MM, ROTRV_MM,
95                                  ROTR_MM, SEB_MM, SEH_MM, SLL16_MM, SLLV_MM,
96                                  SLL_MM, SLT_MM, SLTi_MM, SLTiu_MM, SLTu_MM,
97                                  SRAV_MM, SRA_MM, SRL16_MM, SRLV_MM, SRL_MM,
98                                  SSNOP_MM, SUBU16_MM, SUB_MM, SUBu_MM,
99                                  WSBH_MM, XOR16_MM, XOR_MM, XORi_MM)>;
100
101 // microMIPS32r6
102 // =============
103
104 def : InstRW<[GenericWriteALU], (instrs ADDIUPC_MMR6, ADDIU_MMR6, ADDU16_MMR6,
105                                  ADDU_MMR6, ADD_MMR6, ALIGN_MMR6, ALUIPC_MMR6,
106                                  AND16_MMR6, ANDI16_MMR6, ANDI_MMR6, AND_MMR6,
107                                  AUIPC_MMR6, AUI_MMR6, BITSWAP_MMR6, CLO_MMR6,
108                                  CLZ_MMR6, EXT_MMR6, INS_MMR6, LI16_MMR6,
109                                  LSA_MMR6, LUI_MMR6, MOVE16_MMR6, NOR_MMR6,
110                                  NOT16_MMR6, OR16_MMR6, ORI_MMR6, OR_MMR6,
111                                  SELEQZ_MMR6, SELNEZ_MMR6, SLL16_MMR6,
112                                  SLL_MMR6, SRL16_MMR6, SSNOP_MMR6, SUBU16_MMR6,
113                                  SUBU_MMR6, SUB_MMR6, WSBH_MMR6, XOR16_MMR6,
114                                                                                              XORI_MMR6, XOR_MMR6)>;
115
116 // MIPS64
117 // ======
118
119 def : InstRW<[GenericWriteALU], (instrs AND64, ANDi64, DEXT64_32, DSLL64_32,
120                                  ORi64, SEB64, SEH64, SLL64_32, SLL64_64,
121                                  SLT64, SLTi64, SLTiu64, SLTu64, XOR64,
122                                  XORi64)>;
123
124 def : InstRW<[GenericWriteALU], (instrs DADD, DADDi, DADDiu, DADDu, DCLO,
125                                  DCLZ, DEXT, DEXTM, DEXTU, DINS, DINSM, DINSU,
126                                  DROTR, DROTR32, DROTRV, DSBH, DSHD, DSLL,
127                                  DSLL32, DSLLV, DSRA, DSRA32, DSRAV, DSRL,
128                                  DSRL32, DSRLV, DSUB, DSUBu, LEA_ADDiu64,
129                                  LUi64, NOR64, OR64)>;
130
131 // MIPS64R6
132 // ========
133
134 def : InstRW<[GenericWriteALU], (instrs DALIGN, DAHI, DATI, DAUI, DCLO_R6,
135                                  DCLZ_R6, DBITSWAP, DLSA, DLSA_R6, SELEQZ64,
136                                  SELNEZ64)>;
137
138
139 def GenericMDU : ProcResource<1> { let BufferSize = 1; }
140 def GenericIssueMDU : ProcResource<1> { let Super = GenericALU; }
141 def GenericIssueDIV : ProcResource<1> { let Super = GenericMDU; }
142 def GenericWriteHILO : SchedWriteRes<[GenericIssueMDU]>;
143 def GenericWriteALULong : SchedWriteRes<[GenericIssueALU]> { let Latency = 5; }
144 def GenericWriteMove : SchedWriteRes<[GenericIssueALU]> { let Latency = 2; }
145 def GenericWriteMul : SchedWriteRes<[GenericIssueMDU]> { let Latency = 4; }
146
147 def : InstRW<[GenericWriteHILO], (instrs MADD, MADDU, MSUB, MSUBU)>;
148
149 def : InstRW<[GenericWriteHILO], (instrs PseudoMADD_MM, PseudoMADDU_MM,
150                                   PseudoMSUB_MM, PseudoMSUBU_MM,
151                                   PseudoMULT_MM, PseudoMULTu_MM)>;
152
153 def : InstRW<[GenericWriteHILO], (instrs PseudoMADD, PseudoMADDU, PseudoMSUB,
154                                   PseudoMSUBU, PseudoMULT, PseudoMULTu)>;
155
156 def GenericWriteMDUtoGPR : SchedWriteRes<[GenericIssueMDU]> {
157   let Latency = 5;
158 }
159
160 def GenericWriteDIV : SchedWriteRes<[GenericIssueDIV]> {
161   // Estimated worst case
162   let Latency = 33;
163   let ResourceCycles = [33];
164 }
165 def GenericWriteDIVU : SchedWriteRes<[GenericIssueDIV]> {
166   // Estimated worst case
167   let Latency = 31;
168   let ResourceCycles = [31];
169 }
170
171 // mul
172 def : InstRW<[GenericWriteMDUtoGPR], (instrs MUL)>;
173
174 // mult, multu
175 def : InstRW<[GenericWriteMul], (instrs MULT, MULTu)>;
176
177 // div, sdiv
178 def : InstRW<[GenericWriteDIV], (instrs PseudoSDIV, SDIV)>;
179
180 def : InstRW<[GenericWriteDIVU], (instrs PseudoUDIV, UDIV)>;
181
182 // mfhi, mflo, movn, mthi, mtlo, rdwhr
183 def : InstRW<[GenericWriteALULong], (instrs MFHI, MFLO, PseudoMFHI,
184                                      PseudoMFLO)>;
185
186 def : InstRW<[GenericWriteALULong], (instrs PseudoMFHI_MM, PseudoMFLO_MM)>;
187
188 def : InstRW<[GenericWriteMove], (instrs MTHI, MTLO, RDHWR, PseudoMTLOHI)>;
189 def : InstRW<[GenericWriteMove], (instrs PseudoMTLOHI_MM)>;
190
191 def : InstRW<[GenericWriteALU], (instrs MOVN_I_I, MOVZ_I_I)>;
192
193 // MIPSR6
194 // ======
195
196 // muh, muhu, mulu, mul
197 def : InstRW<[GenericWriteMul], (instrs MUH, MUHU, MULU, MUL_R6)>;
198
199 // divu, udiv
200 def : InstRW<[GenericWriteDIV], (instrs MOD, MODU, DIV, DIVU)>;
201
202
203 // MIPS16e
204 // =======
205
206 def : InstRW<[GenericWriteHILO], (instrs MultRxRy16, MultuRxRy16,
207                                   MultRxRyRz16, MultuRxRyRz16)>;
208
209 def : InstRW<[GenericWriteDIV], (instrs DivRxRy16)>;
210
211 def : InstRW<[GenericWriteDIVU], (instrs DivuRxRy16)>;
212
213 // microMIPS
214 // =========
215
216 def : InstRW<[GenericWriteMul], (instrs MULT_MM, MULTu_MM, MADD_MM, MADDU_MM,
217                                  MSUB_MM, MSUBU_MM)>;
218
219 def : InstRW<[GenericWriteALULong], (instrs MUL_MM)>;
220
221 def : InstRW<[GenericWriteDIV], (instrs SDIV_MM, SDIV_MM_Pseudo)>;
222
223 def : InstRW<[GenericWriteDIVU], (instrs UDIV_MM, UDIV_MM_Pseudo)>;
224
225 def : InstRW<[GenericWriteMove], (instrs MFHI16_MM, MFLO16_MM, MOVF_I_MM,
226                                   MOVT_I_MM, MFHI_MM, MFLO_MM, MTHI_MM,
227                                   MTLO_MM)>;
228
229 def : InstRW<[GenericWriteMove], (instrs RDHWR_MM)>;
230
231 // microMIPS32r6
232 // =============
233
234 def : InstRW<[GenericWriteMul], (instrs MUHU_MMR6, MUH_MMR6, MULU_MMR6,
235                                  MUL_MMR6)>;
236
237 def : InstRW<[GenericWriteDIV], (instrs MODU_MMR6, MOD_MMR6, DIVU_MMR6,
238                                  DIV_MMR6)>;
239
240 def : InstRW<[GenericWriteMove], (instrs RDHWR_MMR6)>;
241
242 // MIPS64
243 // ======
244
245 def : InstRW<[GenericWriteHILO], (instrs DMULU, DMULT, DMULTu, PseudoDMULT,
246                                   PseudoDMULTu)>;
247
248 def : InstRW<[GenericWriteDIV], (instrs DSDIV, PseudoDSDIV)>;
249
250 def : InstRW<[GenericWriteDIVU], (instrs DUDIV, PseudoDUDIV)>;
251
252 def : InstRW<[GenericWriteALULong], (instrs MFHI64, MFLO64, PseudoMFHI64,
253                                      PseudoMFLO64, PseudoMTLOHI64)>;
254
255 def : InstRW<[GenericWriteMove], (instrs MTHI64, MTLO64, RDHWR64)>;
256
257 // mov[zn]
258 def : InstRW<[GenericWriteALU], (instrs MOVN_I_I64, MOVN_I64_I, MOVN_I64_I64,
259                                  MOVZ_I_I64, MOVZ_I64_I, MOVZ_I64_I64)>;
260
261
262 // MIPS64R6
263 // ========
264
265 def : InstRW<[GenericWriteMDUtoGPR], (instrs DMUH, DMUHU, DMUL_R6)>;
266
267 def : InstRW<[GenericWriteDIV], (instrs DDIV, DMOD)>;
268
269 def : InstRW<[GenericWriteDIVU], (instrs DDIVU, DMODU)>;
270
271 // CTISTD Pipeline
272 // ---------------
273
274 def GenericIssueCTISTD : ProcResource<1> { let Super = GenericALU; }
275
276 def GenericLDST : ProcResource<1> { let BufferSize = 1; }
277 def GenericIssueLDST : ProcResource<1> { let Super = GenericLDST; }
278
279 def GenericWriteJump : SchedWriteRes<[GenericIssueCTISTD]>;
280 def GenericWriteJumpAndLink : SchedWriteRes<[GenericIssueCTISTD]> {
281   let Latency = 2;
282 }
283
284 // b, beq, beql, bg[et]z, bl[et]z, bne, bnel, j, syscall, jal, bltzal, jalx,
285 // jalr, jr.hb, jr, jalr.hb, jarlc, jialc
286 def : InstRW<[GenericWriteJump], (instrs B, BAL, BAL_BR, BEQ, BNE, BGTZ, BGEZ,
287                                   BLEZ, BLTZ, BLTZAL, J, JALX, JR, JR_HB, ERET,
288                                   ERet, ERETNC, DERET)>;
289
290 def : InstRW<[GenericWriteJump], (instrs BEQL, BNEL, BGEZL, BGTZL, BLEZL,
291                                   BLTZL)>;
292
293 def : InstRW<[GenericWriteJump], (instrs TAILCALL, TAILCALLREG,
294                                   TAILCALLREGHB, PseudoIndirectBranch,
295                                   PseudoIndirectHazardBranch, PseudoReturn,
296                                   RetRA)>;
297
298 def : InstRW<[GenericWriteJumpAndLink], (instrs BGEZAL, JAL, JALR, JALR_HB,
299                                          JALRHBPseudo, JALRPseudo)>;
300
301 def : InstRW<[GenericWriteJumpAndLink], (instrs BGEZALL, BLTZALL)>;
302
303 def GenericWriteTrap : SchedWriteRes<[GenericIssueCTISTD]>;
304
305 def : InstRW<[GenericWriteTrap], (instrs BREAK, SYSCALL, TEQ, TEQI,
306                                   TGE, TGEI, TGEIU, TGEU, TNE,
307                                   TNEI, TLT, TLTI, TLTU, TTLTIU,
308                                   TRAP, SDBBP)>;
309
310 // MIPSR6
311 // ======
312
313 def : InstRW<[GenericWriteJumpAndLink], (instrs BALC, BEQZALC, BGEZALC,
314                                          BGTZALC, BLEZALC, BLTZALC,
315                                          BNEZALC,
316                                          JIALC)>;
317
318 def : InstRW<[GenericWriteJump], (instrs BC, BC2EQZ, BC2NEZ, BEQC, BEQZC, BGEC,
319                                   BGEUC, BGEZC, BGTZC, BLEZC, BLTC, BLTUC,
320                                   BLTZC, BNEC, BNEZC, BNVC, BOVC, JIC, JR_HB_R6,
321                                   SIGRIE, PseudoIndirectBranchR6,
322                                   PseudoIndrectHazardBranchR6)>;
323
324 def : InstRW<[GenericWriteJump], (instrs TAILCALLR6REG, TAILCALLHBR6REG)>;
325
326 def : InstRW<[GenericWriteTrap], (instrs SDBBP_R6)>;
327
328 // MIPS16e
329 // =======
330
331 def : InstRW<[GenericWriteJump], (instrs Bimm16, BimmX16, BeqzRxImm16,
332                                   BeqzRxImmX16, BnezRxImm16, BnezRxImmX16,
333                                   Bteqz16, BteqzX16, BteqzT8CmpX16,
334                                   BteqzT8CmpiX16, BteqzT8SltX16,
335                                   BteqzT8SltuX16, BteqzT8SltiX16,
336                                   BteqzT8SltiuX16, Btnez16, BtnezX16,
337                                   BtnezT8CmpX16, BtnezT8CmpiX16,
338                                   BtnezT8SltX16, BtnezT8SltuX16,
339                                   BtnezT8SltiX16, BtnezT8SltiuX16, JrRa16,
340                                   JrcRa16, JrcRx16, RetRA16)>;
341
342 def : InstRW<[GenericWriteJumpAndLink], (instrs Jal16, JalB16, JumpLinkReg16)>;
343
344 def : InstRW<[GenericWriteTrap], (instrs Break16)>;
345
346 def : InstRW<[GenericWriteALULong], (instrs SelBeqZ, SelTBteqZCmp,
347                                      SelTBteqZCmpi, SelTBteqZSlt,
348                                      SelTBteqZSlti, SelTBteqZSltu,
349                                      SelTBteqZSltiu, SelBneZ, SelTBtneZCmp,
350                                      SelTBtneZCmpi, SelTBtneZSlt,
351                                      SelTBtneZSlti, SelTBtneZSltu,
352                                      SelTBtneZSltiu)>;
353
354 // microMIPS
355 // =========
356
357 def : InstRW<[GenericWriteJump], (instrs B16_MM, BAL_BR_MM, BC1F_MM, BC1T_MM,
358                                   BEQZ16_MM, BEQZC_MM, BEQ_MM, BGEZ_MM,
359                                   BGTZ_MM, BLEZ_MM, BLTZ_MM, BNEZ16_MM,
360                                   BNEZC_MM, BNE_MM, B_MM, DERET_MM, ERET_MM,
361                                   JR16_MM, JR_MM, J_MM, B_MM_Pseudo)>;
362
363 def : InstRW<[GenericWriteJumpAndLink], (instrs BGEZALS_MM, BGEZAL_MM,
364                                          BLTZALS_MM, BLTZAL_MM, JALR16_MM,
365                                          JALRS16_MM, JALRS_MM, JALR_MM,
366                                          JALS_MM, JALX_MM, JAL_MM)>;
367
368 def : InstRW<[GenericWriteJump], (instrs TAILCALLREG_MM, TAILCALL_MM,
369                                   PseudoIndirectBranch_MM)>;
370
371 def : InstRW<[GenericWriteTrap], (instrs BREAK16_MM, BREAK_MM, SDBBP16_MM,
372                                   SDBBP_MM, SYSCALL_MM, TEQI_MM, TEQ_MM,
373                                   TGEIU_MM, TGEI_MM, TGEU_MM, TGE_MM, TLTIU_MM,
374                                   TLTI_MM, TLTU_MM, TLT_MM, TNEI_MM, TNE_MM,
375                                   TRAP_MM)>;
376
377 // microMIPS32r6
378 // =============
379
380 def : InstRW<[GenericWriteJump], (instrs BC16_MMR6, BC1EQZC_MMR6, BC1NEZC_MMR6,
381                                   BC2EQZC_MMR6, BC2NEZC_MMR6, BC_MMR6,
382                                   BEQC_MMR6, BEQZC16_MMR6, BEQZC_MMR6,
383                                   BGEC_MMR6, BGEUC_MMR6, BGEZC_MMR6,
384                                   BGTZC_MMR6, BLEZC_MMR6, BLTC_MMR6,
385                                   BLTUC_MMR6, BLTZC_MMR6, BNEC_MMR6,
386                                   BNEZC16_MMR6, BNEZC_MMR6, BNVC_MMR6,
387                                   BOVC_MMR6, DERET_MMR6, ERETNC_MMR6, JAL_MMR6,
388                                   ERET_MMR6, JIC_MMR6, JRADDIUSP, JRC16_MM,
389                                   JRC16_MMR6, JRCADDIUSP_MMR6, SIGRIE_MMR6,
390                                   B_MMR6_Pseudo, PseudoIndirectBranch_MMR6)>;
391
392 def : InstRW<[GenericWriteJumpAndLink], (instrs BALC_MMR6, BEQZALC_MMR6,
393                                          BGEZALC_MMR6, BGTZALC_MMR6,
394                                          BLEZALC_MMR6, BLTZALC_MMR6,
395                                          BNEZALC_MMR6, JALRC16_MMR6,
396                                          JALRC_HB_MMR6, JALRC_MMR6,
397                                          JIALC_MMR6)>;
398
399 def : InstRW<[GenericWriteJump], (instrs TAILCALLREG_MMR6, TAILCALL_MMR6)>;
400
401 def : InstRW<[GenericWriteTrap], (instrs BREAK16_MMR6, BREAK_MMR6, SDBBP_MMR6,
402                                   SDBBP16_MMR6)>;
403
404 // MIPS64
405 // ======
406
407 def : InstRW<[GenericWriteJump], (instrs BEQ64, BGEZ64, BGTZ64, BLEZ64,
408                                   BLTZ64, BNE64, JR64)>;
409
410 def : InstRW<[GenericWriteJumpAndLink], (instrs JALR64, JALR64Pseudo,
411                                          JALRHB64Pseudo, JALR_HB64)>;
412
413 def : InstRW<[GenericWriteJump], (instrs JR_HB64, TAILCALLREG64,
414                                   TAILCALLREGHB64, PseudoReturn64)>;
415
416 // MIPS64R6
417 // ========
418
419 def : InstRW<[GenericWriteJump], (instrs BEQC64, BEQZC64, BGEC64, BGEUC64,
420                                   BGEZC64, BGTZC64, BLEZC64, BLTC64, BLTUC64,
421                                   BLTZC64, BNEC64, BNEZC64, JIC64,
422                                   PseudoIndirectBranch64,
423                                   PseudoIndirectHazardBranch64)>;
424
425 def : InstRW<[GenericWriteJumpAndLink], (instrs JIALC64)>;
426
427 def : InstRW<[GenericWriteJump], (instrs JR_HB64_R6, TAILCALL64R6REG,
428                                   TAILCALLHB64R6REG, PseudoIndirectBranch64R6,
429                                   PseudoIndrectHazardBranch64R6)>;
430
431 // COP0 Pipeline
432 // =============
433
434 def GenericCOP0 : ProcResource<1> { let BufferSize = 1; }
435
436 def GenericIssueCOP0 : ProcResource<1> { let Super = GenericCOP0; }
437 def GenericWriteCOP0TLB : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 4; }
438 def GenericWriteCOP0 : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 3; }
439 def GenericReadCOP0 : SchedWriteRes<[GenericIssueCOP0]> { let Latency = 2; }
440 def GenericReadWritePGPR : SchedWriteRes<[GenericIssueCOP0]>;
441 def GenericReadWriteCOP0Long : SchedWriteRes<[GenericIssueCOP0]> {
442   let Latency = 5;
443 }
444 def GenericWriteCOP0Short : SchedWriteRes<[GenericIssueCOP0]>;
445
446 def : InstRW<[GenericWriteCOP0TLB], (instrs TLBP, TLBR, TLBWI, TLBWR)>;
447 def : InstRW<[GenericWriteCOP0TLB], (instrs TLBINV, TLBINVF)>;
448
449 def : InstRW<[GenericReadCOP0], (instrs MFC0)>;
450 def : InstRW<[GenericWriteCOP0], (instrs MTC0)>;
451
452 def : InstRW<[GenericWriteCOP0], (instrs EVP, DVP)>;
453
454 def : InstRW<[GenericWriteCOP0], (instrs DI, EI)>;
455
456 def : InstRW<[GenericWriteCOP0], (instrs EHB, PAUSE, WAIT)>;
457
458 // microMIPS
459 // =========
460
461 def : InstRW<[GenericWriteCOP0TLB], (instrs TLBP_MM, TLBR_MM, TLBWI_MM,
462                                      TLBWR_MM)>;
463
464 def : InstRW<[GenericWriteCOP0], (instrs DI_MM, EI_MM)>;
465
466 def : InstRW<[GenericWriteCOP0], (instrs EHB_MM, PAUSE_MM, WAIT_MM)>;
467
468
469 // microMIPS32R6
470 // =============
471
472 def : InstRW<[GenericWriteCOP0], (instrs RDPGPR_MMR6, WRPGPR_MMR6)>;
473
474 def : InstRW<[GenericWriteCOP0TLB], (instrs TLBINV_MMR6, TLBINVF_MMR6)>;
475
476 def : InstRW<[GenericReadCOP0], (instrs MFHC0_MMR6, MFC0_MMR6, MFHC2_MMR6,
477                                  MFC2_MMR6)>;
478
479 def : InstRW<[GenericWriteCOP0], (instrs MTHC0_MMR6, MTC0_MMR6, MTHC2_MMR6,
480                                   MTC2_MMR6)>;
481
482 def : InstRW<[GenericWriteCOP0], (instrs EVP_MMR6, DVP_MMR6)>;
483
484 def : InstRW<[GenericWriteCOP0], (instrs DI_MMR6, EI_MMR6)>;
485
486 def : InstRW<[GenericWriteCOP0], (instrs EHB_MMR6, PAUSE_MMR6, WAIT_MMR6)>;
487
488 // MIPS64
489 // ======
490
491 def : InstRW<[GenericReadCOP0], (instrs DMFC0)>;
492
493 def : InstRW<[GenericWriteCOP0], (instrs DMTC0)>;
494
495
496 def GenericCOP2 : ProcResource<1> { let BufferSize = 1; }
497 def GenericWriteCOPOther : SchedWriteRes<[GenericCOP2]>;
498
499 def : InstRW<[GenericWriteCOPOther], (instrs MFC2, MTC2)>;
500
501 def : InstRW<[GenericWriteCOPOther], (instrs DMFC2, DMTC2)>;
502
503 // microMIPS32R6
504 // =============
505
506 // The latency and repeat rate of these instructions are implementation
507 // dependant.
508 def : InstRW<[GenericWriteMove], (instrs CFC2_MM, CTC2_MM)>;
509
510
511 // MIPS MT ASE - hasMT
512 // ====================
513
514 def : InstRW<[GenericWriteMove], (instrs DMT, DVPE, EMT, EVPE, MFTR,
515                                   MTTR)>;
516
517 def : InstRW<[GenericReadWriteCOP0Long], (instrs YIELD)>;
518
519 def : InstRW<[GenericWriteCOP0Short], (instrs FORK)>;
520
521 // MIPS Virtualization ASE
522 // =======================
523
524 def : InstRW<[GenericWriteCOP0Short], (instrs HYPCALL, TLBGINV, TLBGINVF, TLBGP,
525                                        TLBGR, TLBGWI, TLBGWR, MFGC0, MFHGC0,
526                                        MTGC0, MTHGC0)>;
527
528 // MIPS64 Virtualization ASE
529 // =========================
530
531 def : InstRW<[GenericWriteCOP0Short], (instrs DMFGC0, DMTGC0)>;
532
533 // microMIPS virtualization ASE
534 // ============================
535
536 def : InstRW<[GenericWriteCOP0Short], (instrs HYPCALL_MM, TLBGINVF_MM,
537                                        TLBGINV_MM, TLBGP_MM, TLBGR_MM,
538                                        TLBGWI_MM, TLBGWR_MM, MFGC0_MM,
539                                        MFHGC0_MM, MTGC0_MM, MTHGC0_MM)>;
540
541 // LDST Pipeline
542 // -------------
543
544 def GenericWriteLoad : SchedWriteRes<[GenericIssueLDST]> {
545   let Latency = 2;
546 }
547
548 def GenericWritePref : SchedWriteRes<[GenericIssueLDST]>;
549 def GenericWriteSync : SchedWriteRes<[GenericIssueLDST]>;
550 def GenericWriteCache : SchedWriteRes<[GenericIssueLDST]> { let Latency = 5; }
551
552 def GenericWriteStore : SchedWriteRes<[GenericIssueLDST]>;
553 def GenericWriteStoreSC : SchedWriteRes<[GenericIssueLDST]> { let Latency = 2; }
554
555 def GenericWriteGPRFromBypass : SchedWriteRes<[GenericIssueLDST]> {
556   let Latency = 2;
557 }
558
559 def GenericWriteStoreFromOtherUnits : SchedWriteRes<[GenericIssueLDST]>;
560 def GenericWriteLoadToOtherUnits : SchedWriteRes<[GenericIssueLDST]> {
561   let Latency = 0;
562 }
563
564 // l[bhw], l[bh]u, ll
565 def : InstRW<[GenericWriteLoad], (instrs LB, LBu, LH, LHu, LW, LL,
566                                   LWC2, LWC3, LDC2, LDC3)>;
567
568 // lw[lr]
569 def : InstRW<[GenericWriteLoad], (instrs LWL, LWR)>;
570
571 // s[bhw], sc, s[dw]c[23]
572 def : InstRW<[GenericWriteStore], (instrs SB, SH, SW, SWC2, SWC3,
573                                    SDC2, SDC3)>;
574
575 // PreMIPSR6 sw[lr]
576 def : InstRW<[GenericWriteStore], (instrs SWL, SWR)>;
577
578 def : InstRW<[GenericWriteStoreSC], (instrs SC, SC_MMR6)>;
579
580 // pref
581 def : InstRW<[GenericWritePref], (instrs PREF)>;
582 // cache
583 def : InstRW<[GenericWriteCache], (instrs CACHE)>;
584
585 // sync
586 def : InstRW<[GenericWriteSync], (instrs SYNC, SYNCI)>;
587
588 // MIPSR6
589 // ======
590
591 def : InstRW<[GenericWriteLoad], (instrs LDC2_R6, LL_R6, LWC2_R6, LWPC)>;
592
593 def : InstRW<[GenericWriteStore], (instrs SWC2_R6,  SDC2_R6)>;
594
595 def : InstRW<[GenericWriteStoreSC], (instrs SC_R6)>;
596
597 def : InstRW<[GenericWritePref], (instrs PREF_R6)>;
598
599 def : InstRW<[GenericWriteCache], (instrs CACHE_R6)>;
600
601 def : InstRW<[GenericWriteSync], (instrs GINVI, GINVT)>;
602
603 // MIPS32 EVA
604 // ==========
605
606 def : InstRW<[GenericWriteLoad], (instrs LBE, LBuE, LHE, LHuE, LWE,
607                                   LLE)>;
608
609 def : InstRW<[GenericWriteStore], (instrs SBE, SHE, SWE, SCE)>;
610
611 def : InstRW<[GenericWriteLoad], (instrs LWLE, LWRE)>;
612
613 def : InstRW<[GenericWriteStore], (instrs SWLE, SWRE)>;
614
615 def : InstRW<[GenericWritePref], (instrs PREFE)>;
616
617 def : InstRW<[GenericWriteCache], (instrs CACHEE)>;
618
619 // microMIPS EVA ASE - InMicroMipsMode, hasEVA
620 // ===========================================
621
622 def : InstRW<[GenericWriteLoad], (instrs LBE_MM, LBuE_MM, LHE_MM, LHuE_MM,
623                                   LWE_MM, LWLE_MM, LWRE_MM, LLE_MM)>;
624
625 def : InstRW<[GenericWriteStore], (instrs SBE_MM, SB_MM, SHE_MM, SWE_MM,
626                                    SWLE_MM, SWRE_MM, SCE_MM)>;
627
628 def : InstRW<[GenericWritePref], (instrs PREFE_MM)>;
629 def : InstRW<[GenericWriteCache], (instrs CACHEE_MM)>;
630
631
632 // MIPS16e
633 // =======
634
635 def : InstRW<[GenericWriteLoad], (instrs Restore16, RestoreX16,
636                                   LbRxRyOffMemX16,
637                                   LbuRxRyOffMemX16, LhRxRyOffMemX16,
638                                   LhuRxRyOffMemX16, LwRxRyOffMemX16,
639                                   LwRxSpImmX16, LwRxPcTcp16, LwRxPcTcpX16)>;
640
641 def : InstRW<[GenericWriteStore], (instrs Save16, SaveX16, SbRxRyOffMemX16,
642                                    ShRxRyOffMemX16, SwRxRyOffMemX16,
643                                    SwRxSpImmX16)>;
644
645 // microMIPS
646 // =========
647
648 def : InstRW<[GenericWriteLoad], (instrs LBU16_MM, LB_MM, LBu_MM, LHU16_MM,
649                                   LH_MM, LHu_MM, LL_MM, LW16_MM, LWGP_MM,
650                                   LWL_MM, LWM16_MM, LWM32_MM, LWP_MM, LWR_MM,
651                                   LWSP_MM, LWU_MM, LWXS_MM, LW_MM)>;
652
653 def : InstRW<[GenericWriteStore], (instrs SB16_MM, SC_MM, SH16_MM, SH_MM,
654                                    SW16_MM, SWL_MM, SWM16_MM, SWM32_MM, SWM_MM,
655                                    SWP_MM, SWR_MM, SWSP_MM, SW_MM)>;
656
657
658 def : InstRW<[GenericWritePref], (instrs PREF_MM, PREFX_MM)>;
659
660 def : InstRW<[GenericWriteCache], (instrs CACHE_MM)>;
661
662 def : InstRW<[GenericWriteSync], (instrs SYNC_MM, SYNCI_MM)>;
663 def : InstRW<[GenericWriteSync], (instrs GINVI_MMR6, GINVT_MMR6)>;
664
665 // microMIPS32r6
666 // =============
667
668 def : InstRW<[GenericWriteLoad], (instrs LBU_MMR6, LB_MMR6, LDC2_MMR6, LL_MMR6,
669                                   LWM16_MMR6, LWC2_MMR6, LWPC_MMR6, LW_MMR6)>;
670
671 def : InstRW<[GenericWriteStore], (instrs SB16_MMR6, SB_MMR6, SDC2_MMR6,
672                                    SH16_MMR6, SH_MMR6, SW16_MMR6, SWC2_MMR6,
673                                    SWM16_MMR6, SWSP_MMR6, SW_MMR6)>;
674
675 def : InstRW<[GenericWriteSync], (instrs SYNC_MMR6, SYNCI_MMR6)>;
676
677 def : InstRW<[GenericWritePref], (instrs PREF_MMR6)>;
678
679 def : InstRW<[GenericWriteCache], (instrs CACHE_MMR6)>;
680
681 // MIPS64
682 // ======
683
684 def : InstRW<[GenericWriteLoad], (instrs LD, LL64, LLD, LWu, LB64, LBu64,
685                                   LH64, LHu64, LW64)>;
686
687 // l[dw][lr]
688 def : InstRW<[GenericWriteLoad], (instrs LWL64, LWR64, LDL, LDR)>;
689
690 def : InstRW<[GenericWriteStore], (instrs SD, SC64, SCD, SB64, SH64, SW64,
691                                    SWL64, SWR64)>;
692
693 def : InstRW<[GenericWriteStore], (instrs SDL, SDR)>;
694
695 // MIPS64R6
696 // ========
697
698 def : InstRW<[GenericWriteLoad], (instrs LWUPC, LDPC)>;
699
700 def : InstRW<[GenericWriteLoad], (instrs LLD_R6, LL64_R6)>;
701
702 def : InstRW<[GenericWriteStoreSC], (instrs SC64_R6, SCD_R6)>;
703
704 // MIPSR6 CRC ASE - hasCRC
705 // =======================
706
707 def : InstRW<[GenericWriteALU], (instrs CRC32B, CRC32H, CRC32W, CRC32CB,
708                                  CRC32CH, CRC32CW)>;
709
710 // MIPS64R6 CRC ASE - hasCRC
711 // -------------------------
712
713 def : InstRW<[GenericWriteALU], (instrs CRC32D, CRC32CD)>;
714
715
716 // Cavium Networks MIPS (cnMIPS) - Octeon, HasCnMips
717 // =================================================
718
719 def : InstRW<[GenericWriteALU], (instrs BADDu, BBIT0, BBIT032, BBIT1, BBIT132,
720                                  CINS, CINS32, CINS64_32, CINS_i32,
721                                  DMFC2_OCTEON, DMTC2_OCTEON, DPOP, EXTS,
722                                  EXTS32, MTM0, MTM1, MTM2, MTP0, MTP1, MTP2,
723                                  POP, SEQ, SEQi, SNE, SNEi,
724                                  V3MULU, VMM0, VMULU)>;
725
726 def : InstRW<[GenericWriteMDUtoGPR], (instrs DMUL)>;
727
728 // Cavium Networks MIPS (cnMIPSP) - Octeon+, HasCnMipsP
729 // =================================================
730
731 def : InstRW<[GenericWriteALU], (instrs SAA, SAAD)>;
732
733 // FPU Pipelines
734 // =============
735
736 def GenericFPQ : ProcResource<1> { let BufferSize = 1; }
737 def GenericIssueFPUS : ProcResource<1> { let Super = GenericFPQ; }
738 def GenericIssueFPUL : ProcResource<1> { let Super = GenericFPQ; }
739 def GenericIssueFPULoad : ProcResource<1> { let Super = GenericFPQ; }
740 def GenericIssueFPUStore : ProcResource<1> { let Super = GenericFPQ; }
741 def GenericIssueFPUMove : ProcResource<1> { let Super = GenericFPQ; }
742 def GenericFPUDivSqrt : ProcResource<1> { let Super = GenericFPQ; }
743
744 // The floating point compare of the 24k series including interAptiv has a
745 // listed latency of 1-2. Using the higher latency here.
746
747 def GenericWriteFPUCmp : SchedWriteRes<[GenericIssueFPUS]> { let Latency = 2; }
748 def GenericWriteFPUS : SchedWriteRes<[GenericIssueFPUS]> { let Latency = 4; }
749 def GenericWriteFPUL : SchedWriteRes<[GenericIssueFPUL]> { let Latency = 5; }
750 def GenericWriteFPUStore : SchedWriteRes<[GenericIssueFPUStore]> { let
751   Latency = 1;
752 }
753 def GenericWriteFPULoad : SchedWriteRes<[GenericIssueFPULoad]> {
754   let Latency = 2;
755 }
756 def GenericWriteFPUMoveFP : SchedWriteRes<[GenericIssueFPUMove]> {
757   let Latency = 4;
758 }
759 def GenericWriteFPUMoveGPRFPU : SchedWriteRes<[GenericIssueFPUMove]> {
760   let Latency = 2;
761 }
762 def GenericWriteFPUDivS : SchedWriteRes<[GenericFPUDivSqrt]> {
763   let Latency = 17;
764   let ResourceCycles = [ 14 ];
765 }
766 def GenericWriteFPUDivD : SchedWriteRes<[GenericFPUDivSqrt]> {
767   let Latency = 32;
768   let ResourceCycles = [ 29 ];
769 }
770 def GenericWriteFPURcpS : SchedWriteRes<[GenericFPUDivSqrt]> {
771   let Latency = 13;
772   let ResourceCycles = [ 10 ];
773 }
774 def GenericWriteFPURcpD : SchedWriteRes<[GenericFPUDivSqrt]> {
775   let Latency = 25;
776   let ResourceCycles = [ 21 ];
777 }
778 def GenericWriteFPURsqrtS : SchedWriteRes<[GenericFPUDivSqrt]> {
779   let Latency = 17;
780   let ResourceCycles = [ 14 ];
781 }
782 def GenericWriteFPURsqrtD : SchedWriteRes<[GenericFPUDivSqrt]> {
783   let Latency = 32;
784   let ResourceCycles = [ 29 ];
785 }
786 def GenericWriteFPUSqrtS : SchedWriteRes<[GenericFPUDivSqrt]> {
787   let Latency = 17;
788   let ResourceCycles = [ 14 ];
789 }
790 def GenericWriteFPUSqrtD : SchedWriteRes<[GenericFPUDivSqrt]> {
791   let Latency = 29;
792   let ResourceCycles = [ 29 ];
793 }
794
795 // Floating point compare and branch
796 // ---------------------------------
797 //
798 // c.<cc>.[ds], bc1[tf], bc1[tf]l
799 def : InstRW<[GenericWriteFPUCmp], (instrs FCMP_D32, FCMP_D64, FCMP_S32, BC1F,
800                                     BC1T, BC1FL, BC1TL)>;
801
802 def : InstRW<[GenericWriteFPUCmp], (instregex "C_[A-Z]+_(S|D32|D64)$")>;
803
804 // Short Pipe
805 // ----------
806 //
807 // abs.[ds], abs.ps, add.[ds], neg.[ds], neg.ps, madd.s, msub.s, nmadd,s
808 // nmsub.s, sub.[ds], mul.s
809
810 def : InstRW<[GenericWriteFPUS], (instrs FABS_S, FABS_D32, FABS_D64, FADD_D32,
811                                   FADD_D64, FADD_S, MADD_S, MSUB_S, FMUL_S,
812                                   FNEG_S, FNEG_D32, FNEG_D64, NMADD_S, NMSUB_S,
813                                   FSUB_S, FSUB_D32, FSUB_D64)>;
814
815 // Long Pipe
816 // ----------
817 //
818 // nmadd.d, nmsub.d, mul.[ds], mul.ps, ceil.[wl].[sd], cvt.d.[sw], cvt.s.[dw],
819 // cvt.w.[sd], cvt.[sw].ps, trunc.w.[ds], trunc.w.ps, floor.[ds],
820 // round.[lw].[ds], floor.[lw].ds
821
822 // madd.d, msub.dm mul.d, mul.ps, nmadd.d, nmsub.d, ceil.[wl].[sd], cvt.d.[sw],
823 // cvt.s.[dw], cvt.w.[sd], cvt.[sw].ps, round.[lw].[ds], floor.[lw].ds,
824 // trunc.w.[ds], trunc.w.ps,
825 def : InstRW<[GenericWriteFPUL], (instrs CEIL_L_D64, CEIL_L_S, CEIL_W_D32,
826                                   CEIL_W_D64, CEIL_W_S, CVT_D32_S, CVT_D32_W,
827                                   CVT_D64_L, CVT_D64_S, CVT_D64_W, CVT_L_D64,
828                                   CVT_L_S, CVT_S_D32, CVT_S_D64, CVT_S_L,
829                                   CVT_S_W, CVT_W_D32, CVT_W_D64, CVT_W_S,
830                                   CVT_PS_S64, CVT_S_PL64, CVT_S_PU64,
831                                   FLOOR_L_D64, FLOOR_L_S, FLOOR_W_D32,
832                                   FLOOR_W_D64, FLOOR_W_S, FMUL_D32, FMUL_D64,
833                                   MADD_D32, MADD_D64, MSUB_D32, MSUB_D64,
834                                   NMADD_D32, NMADD_D64, NMSUB_D32, NMSUB_D64,
835                                   PLL_PS64, PLU_PS64,
836                                   ROUND_L_D64, ROUND_L_S, ROUND_W_D32,
837                                   ROUND_W_D64, ROUND_W_S, TRUNC_L_D64,
838                                   TRUNC_L_S, TRUNC_W_D32, TRUNC_W_D64,
839                                   TRUNC_W_S, PseudoTRUNC_W_D,
840                                   PseudoTRUNC_W_D32, PseudoTRUNC_W_S)>;
841
842 // Pseudo convert instruction
843 def : InstRW<[GenericWriteFPUL], (instrs PseudoCVT_D32_W, PseudoCVT_D64_L,
844                                   PseudoCVT_D64_W, PseudoCVT_S_L,
845                                   PseudoCVT_S_W)>;
846
847 // div.[ds], div.ps
848 def : InstRW<[GenericWriteFPUDivS], (instrs FDIV_S)>;
849 def : InstRW<[GenericWriteFPUDivD], (instrs FDIV_D32, FDIV_D64)>;
850
851 // sqrt.[ds], sqrt.ps
852 def : InstRW<[GenericWriteFPUSqrtS], (instrs FSQRT_S)>;
853 def : InstRW<[GenericWriteFPUSqrtD], (instrs FSQRT_D32, FSQRT_D64)>;
854
855 // rsqrt.[ds], recip.[ds]
856 def : InstRW<[GenericWriteFPURcpS], (instrs RECIP_S, RSQRT_S)>;
857 def : InstRW<[GenericWriteFPURcpD], (instrs RECIP_D32, RECIP_D64,
858                                      RSQRT_D32, RSQRT_D64)>;
859
860
861 // Load Pipe
862 // ---------
863
864 // ctc1, mtc1, mthc1, cfc1, mfc1, mfhc1
865 def : InstRW<[GenericWriteFPUMoveGPRFPU], (instrs BuildPairF64,
866                                            BuildPairF64_64, ExtractElementF64,
867                                            ExtractElementF64_64, CFC1, CTC1,
868                                            MFC1, MFC1_D64, MFHC1_D32,
869                                            MFHC1_D64, MTC1, MTC1_D64,
870                                            MTHC1_D32, MTHC1_D64)>;
871
872 // swc1, swxc1
873 def : InstRW<[GenericWriteFPUStore], (instrs SDC1, SDC164, SDXC1, SDXC164,
874                                       SUXC1, SUXC164, SWC1, SWXC1)>;
875
876 def : InstRW<[GenericWriteFPUMoveFP], (instrs FMOV_D32, FMOV_D64, FMOV_S)>;
877
878
879 // movn.[ds], movz.[ds]
880 def : InstRW<[GenericWriteFPUMoveFP], (instrs MOVF_I, MOVF_D32, MOVF_D64,
881                                        MOVF_S, MOVT_I, MOVT_D32, MOVT_D64,
882                                        MOVT_S, MOVN_I_D32, MOVN_I_D64,
883                                        MOVN_I_S, MOVZ_I_D32, MOVZ_I_D64,
884                                        MOVZ_I_S)>;
885
886 def : InstRW<[GenericWriteFPUMoveFP], (instrs MOVT_I64, MOVF_I64, MOVZ_I64_S,
887                                        MOVN_I64_D64, MOVN_I64_S,
888                                        MOVZ_I64_D64)>;
889
890 // l[dw]x?c1
891 def : InstRW<[GenericWriteFPULoad], (instrs LDC1, LDC164, LDXC1, LDXC164,
892                                      LUXC1, LUXC164, LWC1, LWXC1)>;
893
894 // MIPSR6
895 // ======
896
897 // sel(eq|ne).[ds], max.[ds], maxa.[ds], min.[ds], mina.[ds], class.[ds]
898 def : InstRW<[GenericWriteFPUS], (instrs SELEQZ_S, SELNEZ_S, SELEQZ_D, SELNEZ_D,
899                                   MAX_S, MAX_D, MAXA_S, MAXA_D, MIN_S, MIN_D,
900                                   MINA_S, MINA_D, CLASS_S, CLASS_D)>;
901
902 def : InstRW<[GenericWriteFPUL], (instrs RINT_S, RINT_D)>;
903
904 def : InstRW<[GenericWriteFPUCmp], (instrs BC1EQZ, BC1NEZ, SEL_D, SEL_S)>;
905
906 def : InstRW<[GenericWriteFPUS], (instrs MADDF_S, MSUBF_S, MADDF_D, MSUBF_D)>;
907
908
909 // microMIPS
910 // =========
911
912 def : InstRW<[GenericWriteFPUMoveFP], (instrs MOVF_D32_MM, MOVF_S_MM,
913                                        MOVN_I_D32_MM, MOVN_I_S_MM,
914                                        MOVT_D32_MM, MOVT_S_MM, MOVZ_I_D32_MM,
915                                        MOVZ_I_S_MM)>;
916
917
918 //  cvt.?.?, ceil.?, floor.?, round.?, trunc.? (n)madd.? (n)msub.?
919 def : InstRW<[GenericWriteFPUL], (instrs CVT_D32_S_MM, CVT_D32_W_MM,
920                                   CVT_D64_S_MM, CVT_D64_W_MM, CVT_L_D64_MM,
921                                   CVT_L_S_MM, CVT_S_D32_MM, CVT_S_D64_MM,
922                                   CVT_S_W_MM, CVT_W_D32_MM, CVT_W_D64_MM,
923                                   CVT_W_S_MM, CEIL_W_MM, CEIL_W_S_MM,
924                                   FLOOR_W_MM, FLOOR_W_S_MM, NMADD_S_MM,
925                                   NMADD_D32_MM, NMSUB_S_MM, NMSUB_D32_MM,
926                                   MADD_S_MM, MADD_D32_MM, ROUND_W_MM,
927                                   ROUND_W_S_MM, TRUNC_W_MM, TRUNC_W_S_MM)>;
928
929 def : InstRW<[GenericWriteFPUCmp], (instregex "^C_[A-Z]_(S|D32|D64)_MM$")>;
930 def : InstRW<[GenericWriteFPUCmp], (instregex "^C_[A-Z][A-Z]_(S|D32|D64)_MM$")>;
931 def : InstRW<[GenericWriteFPUCmp], (instregex "^C_[A-Z][A-Z][A-Z]_(S|D32|D64)_MM$")>;
932 def : InstRW<[GenericWriteFPUCmp], (instregex "^C_NGLE_(S|D32|D64)_MM$")>;
933 def : InstRW<[GenericWriteFPUCmp], (instrs FCMP_S32_MM, FCMP_D32_MM)>;
934
935 def : InstRW<[GenericWriteFPUS], (instrs MFC1_MM, MFHC1_D32_MM, MFHC1_D64_MM,
936                                   MTC1_MM, MTC1_D64_MM,
937                                   MTHC1_D32_MM, MTHC1_D64_MM)>;
938
939 def : InstRW<[GenericWriteFPUS], (instrs FABS_D32_MM, FABS_D64_MM, FABS_S_MM,
940                                   FNEG_D32_MM, FNEG_D64_MM, FNEG_S_MM,
941                                   FADD_D32_MM, FADD_D64_MM, FADD_S_MM,
942                                   FMOV_D32_MM, FMOV_D64_MM, FMOV_S_MM,
943                                   FMUL_D32_MM, FMUL_D64_MM, FMUL_S_MM,
944                                   FSUB_D32_MM, FSUB_D64_MM, FSUB_S_MM,
945                                   MSUB_S_MM, MSUB_D32_MM)>;
946
947 def : InstRW<[GenericWriteFPUDivS], (instrs FDIV_S_MM)>;
948 def : InstRW<[GenericWriteFPUDivD], (instrs FDIV_D32_MM, FDIV_D64_MM)>;
949
950 def : InstRW<[GenericWriteFPUSqrtS], (instrs FSQRT_S_MM)>;
951 def : InstRW<[GenericWriteFPUSqrtD], (instrs FSQRT_D32_MM, FSQRT_D64_MM)>;
952
953 def : InstRW<[GenericWriteFPURcpS], (instrs RECIP_S_MM, RSQRT_S_MM)>;
954 def : InstRW<[GenericWriteFPURcpD], (instrs RECIP_D32_MM, RECIP_D64_MM,
955                                      RSQRT_D32_MM, RSQRT_D64_MM)>;
956
957 def : InstRW<[GenericWriteFPUStore], (instrs SDC1_MM, SWC1_MM, SUXC1_MM,
958                                       SWXC1_MM)>;
959
960 def : InstRW<[GenericWriteFPUMoveGPRFPU], (instrs CFC1_MM, CTC1_MM)>;
961
962 def : InstRW<[GenericWriteFPULoad], (instrs LDC1_MM, LUXC1_MM, LWC1_MM,
963                                      LWXC1_MM)>;
964
965 // microMIPS32r6
966 // =============
967
968 def : InstRW<[GenericWriteFPUS], (instrs FNEG_S_MMR6)>;
969
970 def : InstRW<[GenericWriteFPUCmp], (instregex "CMP_[A-Z][A-Z]_(S|D)_MMR6")>;
971 def : InstRW<[GenericWriteFPUCmp],
972              (instregex "CMP_[A-Z][A-Z][A-Z]_(S|D)_MMR6")>;
973 def : InstRW<[GenericWriteFPUCmp],
974              (instregex "CMP_[A-Z][A-Z][A-Z][A-Z]_(S|D)_MMR6")>;
975
976 def : InstRW<[GenericWriteFPUL],
977              (instregex "CVT_(L|D|S|W)_(L|D|S|L|W)_MMR6")>;
978
979 def : InstRW<[GenericWriteFPUL],
980              (instregex "TRUNC_(L|W)_(D|S)_MMR6")>;
981
982 def : InstRW<[GenericWriteFPUL],
983              (instregex "ROUND_(L|W)_(D|S)_MMR6")>;
984
985 def : InstRW<[GenericWriteFPUL],
986              (instregex "FLOOR_(L|W)_(D|S)_MMR6")>;
987
988 def : InstRW<[GenericWriteFPUL],
989              (instregex "CEIL_(L|W)_(S|D)_MMR6")>;
990
991 def : InstRW<[GenericWriteFPUS],
992              (instrs MFC1_MMR6, MTC1_MMR6, CLASS_S_MMR6, CLASS_D_MMR6,
993               FADD_S_MMR6)>;
994
995 def : InstRW<[GenericWriteFPUS], (instregex "M(IN|AX)_(S|D)_MMR6")>;
996
997 def : InstRW<[GenericWriteFPUS], (instregex "M(IN|AX)A_(S|D)_MMR6")>;
998
999 def : InstRW<[GenericWriteFPUS], (instregex "SEL(EQ|NE)Z_(S|D)_MMR6")>;
1000
1001 def : InstRW<[GenericWriteFPUS], (instregex "SEL_(S|D)_MMR6")>;
1002
1003 def : InstRW<[GenericWriteFPUL], (instrs RINT_S_MMR6, RINT_D_MMR6)>;
1004
1005 def : InstRW<[GenericWriteFPUS], (instregex "M(ADD|SUB)F_(S|D)_MMR6")>;
1006
1007 def : InstRW<[GenericWriteFPUS], (instrs FMOV_S_MMR6, FMUL_S_MMR6,
1008                                   FSUB_S_MMR6, FMOV_D_MMR6)>;
1009
1010 def : InstRW<[GenericWriteFPUL], (instrs FDIV_S_MMR6)>;
1011
1012 def : InstRW<[GenericWriteFPUStore], (instrs SDC1_D64_MMR6)>;
1013
1014 def : InstRW<[GenericWriteFPULoad], (instrs LDC1_D64_MMR6)>;
1015
1016 // MIPS64
1017 // ======
1018
1019 def : InstRW<[GenericWriteFPUMoveGPRFPU], (instrs DMFC1, DMTC1)>;
1020
1021 // MIPS DSP ASE, HasDSP
1022 // ====================
1023
1024 def : InstRW<[GenericWriteStore], (instrs SWDSP)>;
1025
1026 def : InstRW<[GenericWriteLoad], (instrs LWDSP)>;
1027
1028 def : InstRW<[GenericWriteMove], (instrs PseudoMTLOHI_DSP)>;
1029
1030 def GenericDSP : ProcResource<1> { let BufferSize = 1; }
1031 def GenericDSPShort : SchedWriteRes<[GenericDSP]> { let Latency = 2; }
1032 def GenericDSPLong : SchedWriteRes<[GenericDSP]> { let Latency = 6; }
1033 def GenericDSPBypass : SchedWriteRes<[GenericDSP]> { let Latency = 1; }
1034 def GenericDSPMTHILO : SchedWriteRes<[GenericDSP]> { let Latency = 5; }
1035 def GenericDSPLoad : SchedWriteRes<[GenericDSP]> { let Latency = 4; }
1036 def GenericDSPMTHLIP : SchedWriteRes<[GenericDSP]> { let Latency = 5; }
1037
1038 def : InstRW<[GenericDSPLong], (instregex "^EXTRV_RS_W$")>;
1039 def : InstRW<[GenericDSPLong], (instregex "^EXTRV_R_W$")>;
1040 def : InstRW<[GenericDSPLong], (instregex "^EXTRV_S_H$")>;
1041 def : InstRW<[GenericDSPLong], (instregex "^EXTRV_W$")>;
1042 def : InstRW<[GenericDSPLong], (instregex "^EXTR_RS_W$")>;
1043 def : InstRW<[GenericDSPLong], (instregex "^EXTR_R_W$")>;
1044 def : InstRW<[GenericDSPLong], (instregex "^EXTR_S_H$")>;
1045 def : InstRW<[GenericDSPLong], (instregex "^EXTR_W$")>;
1046 def : InstRW<[GenericDSPLong], (instregex "^INSV$")>;
1047
1048 def : InstRW<[GenericDSPMTHLIP], (instregex "^MTHLIP$")>;
1049 def : InstRW<[GenericDSPMTHILO], (instregex "^MTHI_DSP$")>;
1050 def : InstRW<[GenericDSPMTHILO], (instregex "^MTLO_DSP$")>;
1051
1052 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_PH$")>;
1053 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_W$")>;
1054 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_PH$")>;
1055 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_PH$")>;
1056 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_W$")>;
1057 def : InstRW<[GenericDSPShort], (instregex "^ADDSC$")>;
1058 def : InstRW<[GenericDSPShort], (instregex "^ADDU_QB$")>;
1059 def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_QB$")>;
1060 def : InstRW<[GenericDSPShort], (instregex "^ADDWC$")>;
1061 def : InstRW<[GenericDSPShort], (instregex "^BITREV$")>;
1062 def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32$")>;
1063 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_EQ_QB$")>;
1064 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LE_QB$")>;
1065 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LT_QB$")>;
1066 def : InstRW<[GenericDSPShort], (instregex "^CMPU_EQ_QB$")>;
1067 def : InstRW<[GenericDSPShort], (instregex "^CMPU_LE_QB$")>;
1068 def : InstRW<[GenericDSPShort], (instregex "^CMPU_LT_QB$")>;
1069 def : InstRW<[GenericDSPShort], (instregex "^CMP_EQ_PH$")>;
1070 def : InstRW<[GenericDSPShort], (instregex "^CMP_LE_PH$")>;
1071 def : InstRW<[GenericDSPShort], (instregex "^CMP_LT_PH$")>;
1072 def : InstRW<[GenericDSPShort], (instregex "^DPAQ_SA_L_W$")>;
1073 def : InstRW<[GenericDSPShort], (instregex "^DPAQ_S_W_PH$")>;
1074 def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBL$")>;
1075 def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBR$")>;
1076 def : InstRW<[GenericDSPShort], (instregex "^DPSQ_SA_L_W$")>;
1077 def : InstRW<[GenericDSPShort], (instregex "^DPSQ_S_W_PH$")>;
1078 def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBL$")>;
1079 def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBR$")>;
1080 def : InstRW<[GenericDSPShort], (instregex "^EXTPDPV$")>;
1081 def : InstRW<[GenericDSPShort], (instregex "^EXTPDP$")>;
1082 def : InstRW<[GenericDSPShort], (instregex "^EXTPV$")>;
1083 def : InstRW<[GenericDSPShort], (instregex "^EXTP$")>;
1084 def : InstRW<[GenericDSPShort], (instregex "^LBUX$")>;
1085 def : InstRW<[GenericDSPShort], (instregex "^LHX$")>;
1086 def : InstRW<[GenericDSPShort], (instregex "^LWX$")>;
1087 def : InstRW<[GenericDSPShort], (instregex "^MADDU_DSP$")>;
1088 def : InstRW<[GenericDSPShort], (instregex "^MADD_DSP$")>;
1089 def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHL$")>;
1090 def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHR$")>;
1091 def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHL$")>;
1092 def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHR$")>;
1093 def : InstRW<[GenericDSPShort], (instregex "^MFHI_DSP$")>;
1094 def : InstRW<[GenericDSPShort], (instregex "^MFLO_DSP$")>;
1095 def : InstRW<[GenericDSPShort], (instregex "^MODSUB$")>;
1096 def : InstRW<[GenericDSPShort], (instregex "^MSUBU_DSP$")>;
1097 def : InstRW<[GenericDSPShort], (instregex "^MSUB_DSP$")>;
1098 def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHL$")>;
1099 def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHR$")>;
1100 def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBL$")>;
1101 def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBR$")>;
1102 def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_PH$")>;
1103 def : InstRW<[GenericDSPShort], (instregex "^MULSAQ_S_W_PH$")>;
1104 def : InstRW<[GenericDSPShort], (instregex "^MULTU_DSP$")>;
1105 def : InstRW<[GenericDSPShort], (instregex "^MULT_DSP$")>;
1106 def : InstRW<[GenericDSPShort], (instregex "^PACKRL_PH$")>;
1107 def : InstRW<[GenericDSPShort], (instregex "^PICK_PH$")>;
1108 def : InstRW<[GenericDSPShort], (instregex "^PICK_QB$")>;
1109 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBLA$")>;
1110 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBL$")>;
1111 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBRA$")>;
1112 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBR$")>;
1113 def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHL$")>;
1114 def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHR$")>;
1115 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBLA$")>;
1116 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBL$")>;
1117 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBRA$")>;
1118 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBR$")>;
1119 def : InstRW<[GenericDSPShort], (instregex "^PRECRQU_S_QB_PH$")>;
1120 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_PH_W$")>;
1121 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_QB_PH$")>;
1122 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_RS_PH_W$")>;
1123 def : InstRW<[GenericDSPShort], (instregex "^RADDU_W_QB$")>;
1124 def : InstRW<[GenericDSPShort], (instregex "^RDDSP$")>;
1125 def : InstRW<[GenericDSPShort], (instregex "^REPLV_PH$")>;
1126 def : InstRW<[GenericDSPShort], (instregex "^REPLV_QB$")>;
1127 def : InstRW<[GenericDSPShort], (instregex "^REPL_PH$")>;
1128 def : InstRW<[GenericDSPShort], (instregex "^REPL_QB$")>;
1129 def : InstRW<[GenericDSPShort], (instregex "^SHILOV$")>;
1130 def : InstRW<[GenericDSPShort], (instregex "^SHILO$")>;
1131 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_PH$")>;
1132 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_QB$")>;
1133 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_PH$")>;
1134 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_W$")>;
1135 def : InstRW<[GenericDSPShort], (instregex "^SHLL_PH$")>;
1136 def : InstRW<[GenericDSPShort], (instregex "^SHLL_QB$")>;
1137 def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_PH$")>;
1138 def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_W$")>;
1139 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_PH$")>;
1140 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_PH$")>;
1141 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_W$")>;
1142 def : InstRW<[GenericDSPShort], (instregex "^SHRA_PH$")>;
1143 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_PH$")>;
1144 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_W$")>;
1145 def : InstRW<[GenericDSPShort], (instregex "^SHRLV_QB$")>;
1146 def : InstRW<[GenericDSPShort], (instregex "^SHRL_QB$")>;
1147 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_PH$")>;
1148 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_PH$")>;
1149 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_W$")>;
1150 def : InstRW<[GenericDSPShort], (instregex "^SUBU_QB$")>;
1151 def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_QB$")>;
1152 def : InstRW<[GenericDSPShort], (instregex "^WRDSP$")>;
1153
1154 def : InstRW<[GenericDSPShort],
1155              (instregex "^Pseudo(CMP|CMPU)_(EQ|LE|LT)_(PH|QB)$")>;
1156 def : InstRW<[GenericDSPShort],
1157                                                  (instregex "^PseudoPICK_(PH|QB)$")>;
1158
1159 // MIPS DSP R2 - hasDSP, HasDSPR2, InMicroMips
1160 // ===========================================
1161
1162 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_QB$")>;
1163 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_PH$")>;
1164 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_PH$")>;
1165 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_W$")>;
1166 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_W$")>;
1167 def : InstRW<[GenericDSPShort], (instregex "^ADDUH_QB$")>;
1168 def : InstRW<[GenericDSPShort], (instregex "^ADDUH_R_QB$")>;
1169 def : InstRW<[GenericDSPShort], (instregex "^ADDU_PH$")>;
1170 def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_PH$")>;
1171 def : InstRW<[GenericDSPShort], (instregex "^APPEND$")>;
1172 def : InstRW<[GenericDSPShort], (instregex "^BALIGN$")>;
1173 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_EQ_QB$")>;
1174 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LE_QB$")>;
1175 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LT_QB$")>;
1176 def : InstRW<[GenericDSPShort], (instregex "^DPA_W_PH$")>;
1177 def : InstRW<[GenericDSPShort], (instregex "^DPAQX_SA_W_PH$")>;
1178 def : InstRW<[GenericDSPShort], (instregex "^DPAQX_S_W_PH$")>;
1179 def : InstRW<[GenericDSPShort], (instregex "^DPAX_W_PH$")>;
1180 def : InstRW<[GenericDSPShort], (instregex "^DPS_W_PH$")>;
1181 def : InstRW<[GenericDSPShort], (instregex "^DPSQX_S_W_PH$")>;
1182 def : InstRW<[GenericDSPShort], (instregex "^DPSQX_SA_W_PH$")>;
1183 def : InstRW<[GenericDSPShort], (instregex "^DPSX_W_PH$")>;
1184 def : InstRW<[GenericDSPShort], (instregex "^MUL_PH$")>;
1185 def : InstRW<[GenericDSPShort], (instregex "^MUL_S_PH$")>;
1186 def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_W$")>;
1187 def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_PH$")>;
1188 def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_W$")>;
1189 def : InstRW<[GenericDSPShort], (instregex "^MULSA_W_PH$")>;
1190 def : InstRW<[GenericDSPShort], (instregex "^PRECR_QB_PH$")>;
1191 def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_PH_W$")>;
1192 def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_R_PH_W$")>;
1193 def : InstRW<[GenericDSPShort], (instregex "^PREPEND$")>;
1194 def : InstRW<[GenericDSPShort], (instregex "^SHRA_QB$")>;
1195 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_QB$")>;
1196 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_QB$")>;
1197 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_QB$")>;
1198 def : InstRW<[GenericDSPShort], (instregex "^SHRL_PH$")>;
1199 def : InstRW<[GenericDSPShort], (instregex "^SHRLV_PH$")>;
1200 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_PH$")>;
1201 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_PH$")>;
1202 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_W$")>;
1203 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_W$")>;
1204 def : InstRW<[GenericDSPShort], (instregex "^SUBU_PH$")>;
1205 def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_PH$")>;
1206 def : InstRW<[GenericDSPShort], (instregex "^SUBUH_QB$")>;
1207 def : InstRW<[GenericDSPShort], (instregex "^SUBUH_R_QB$")>;
1208
1209 // microMIPS DSP R1 - HasDSP, InMicroMips
1210 // ======================================
1211
1212 def : InstRW<[GenericWriteLoad], (instrs LWDSP_MM)>;
1213
1214 def : InstRW<[GenericWriteStore], (instrs SWDSP_MM)>;
1215
1216 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_PH_MM$")>;
1217 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_W_MM$")>;
1218 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_PH_MM$")>;
1219 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_PH_MM$")>;
1220 def : InstRW<[GenericDSPShort], (instregex "^ADDQ_S_W_MM$")>;
1221 def : InstRW<[GenericDSPShort], (instregex "^ADDSC_MM$")>;
1222 def : InstRW<[GenericDSPShort], (instregex "^ADDU_QB_MM$")>;
1223 def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_QB_MM$")>;
1224 def : InstRW<[GenericDSPShort], (instregex "^ADDWC_MM$")>;
1225 def : InstRW<[GenericDSPShort], (instregex "^BITREV_MM$")>;
1226 def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32_MM$")>;
1227 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_EQ_QB_MM$")>;
1228 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LE_QB_MM$")>;
1229 def : InstRW<[GenericDSPShort], (instregex "^CMPGU_LT_QB_MM$")>;
1230 def : InstRW<[GenericDSPShort], (instregex "^CMPU_EQ_QB_MM$")>;
1231 def : InstRW<[GenericDSPShort], (instregex "^CMPU_LE_QB_MM$")>;
1232 def : InstRW<[GenericDSPShort], (instregex "^CMPU_LT_QB_MM$")>;
1233 def : InstRW<[GenericDSPShort], (instregex "^CMP_EQ_PH_MM$")>;
1234 def : InstRW<[GenericDSPShort], (instregex "^CMP_LE_PH_MM$")>;
1235 def : InstRW<[GenericDSPShort], (instregex "^CMP_LT_PH_MM$")>;
1236 def : InstRW<[GenericDSPShort], (instregex "^DPAQ_SA_L_W_MM$")>;
1237 def : InstRW<[GenericDSPShort], (instregex "^DPAQ_S_W_PH_MM$")>;
1238 def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBL_MM$")>;
1239 def : InstRW<[GenericDSPShort], (instregex "^DPAU_H_QBR_MM$")>;
1240 def : InstRW<[GenericDSPShort], (instregex "^DPSQ_SA_L_W_MM$")>;
1241 def : InstRW<[GenericDSPShort], (instregex "^DPSQ_S_W_PH_MM$")>;
1242 def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBL_MM$")>;
1243 def : InstRW<[GenericDSPShort], (instregex "^DPSU_H_QBR_MM$")>;
1244 def : InstRW<[GenericDSPShort], (instregex "^EXTPDPV_MM$")>;
1245 def : InstRW<[GenericDSPShort], (instregex "^EXTPDP_MM$")>;
1246 def : InstRW<[GenericDSPShort], (instregex "^EXTPV_MM$")>;
1247 def : InstRW<[GenericDSPShort], (instregex "^EXTP_MM$")>;
1248 def : InstRW<[GenericDSPShort], (instregex "^EXTRV_RS_W_MM$")>;
1249 def : InstRW<[GenericDSPShort], (instregex "^EXTRV_R_W_MM$")>;
1250 def : InstRW<[GenericDSPShort], (instregex "^EXTRV_S_H_MM$")>;
1251 def : InstRW<[GenericDSPShort], (instregex "^EXTRV_W_MM$")>;
1252 def : InstRW<[GenericDSPShort], (instregex "^EXTR_RS_W_MM$")>;
1253 def : InstRW<[GenericDSPShort], (instregex "^EXTR_R_W_MM$")>;
1254 def : InstRW<[GenericDSPShort], (instregex "^EXTR_S_H_MM$")>;
1255 def : InstRW<[GenericDSPShort], (instregex "^EXTR_W_MM$")>;
1256 def : InstRW<[GenericDSPShort], (instregex "^INSV_MM$")>;
1257 def : InstRW<[GenericDSPShort], (instregex "^LBUX_MM$")>;
1258 def : InstRW<[GenericDSPShort], (instregex "^LHX_MM$")>;
1259 def : InstRW<[GenericDSPShort], (instregex "^LWX_MM$")>;
1260 def : InstRW<[GenericDSPShort], (instregex "^MADDU_DSP_MM$")>;
1261 def : InstRW<[GenericDSPShort], (instregex "^MADD_DSP_MM$")>;
1262 def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHL_MM$")>;
1263 def : InstRW<[GenericDSPShort], (instregex "^MAQ_SA_W_PHR_MM$")>;
1264 def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHL_MM$")>;
1265 def : InstRW<[GenericDSPShort], (instregex "^MAQ_S_W_PHR_MM$")>;
1266 def : InstRW<[GenericDSPShort], (instregex "^MFHI_DSP_MM$")>;
1267 def : InstRW<[GenericDSPShort], (instregex "^MFLO_DSP_MM$")>;
1268 def : InstRW<[GenericDSPShort], (instregex "^MODSUB_MM$")>;
1269 def : InstRW<[GenericDSPShort], (instregex "^MOVEP_MMR6$")>;
1270 def : InstRW<[GenericDSPShort], (instregex "^MOVN_I_MM$")>;
1271 def : InstRW<[GenericDSPShort], (instregex "^MOVZ_I_MM$")>;
1272 def : InstRW<[GenericDSPShort], (instregex "^MSUBU_DSP_MM$")>;
1273 def : InstRW<[GenericDSPShort], (instregex "^MSUB_DSP_MM$")>;
1274 def : InstRW<[GenericDSPShort], (instregex "^MTHI_DSP_MM$")>;
1275 def : InstRW<[GenericDSPShort], (instregex "^MTHLIP_MM$")>;
1276 def : InstRW<[GenericDSPShort], (instregex "^MTLO_DSP_MM$")>;
1277 def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHL_MM$")>;
1278 def : InstRW<[GenericDSPShort], (instregex "^MULEQ_S_W_PHR_MM$")>;
1279 def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBL_MM$")>;
1280 def : InstRW<[GenericDSPShort], (instregex "^MULEU_S_PH_QBR_MM$")>;
1281 def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_PH_MM$")>;
1282 def : InstRW<[GenericDSPShort], (instregex "^MULSAQ_S_W_PH_MM$")>;
1283 def : InstRW<[GenericDSPShort], (instregex "^MULTU_DSP_MM$")>;
1284 def : InstRW<[GenericDSPShort], (instregex "^MULT_DSP_MM$")>;
1285 def : InstRW<[GenericDSPShort], (instregex "^PACKRL_PH_MM$")>;
1286 def : InstRW<[GenericDSPShort], (instregex "^PICK_PH_MM$")>;
1287 def : InstRW<[GenericDSPShort], (instregex "^PICK_QB_MM$")>;
1288 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBLA_MM$")>;
1289 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBL_MM$")>;
1290 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBRA_MM$")>;
1291 def : InstRW<[GenericDSPShort], (instregex "^PRECEQU_PH_QBR_MM$")>;
1292 def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHL_MM$")>;
1293 def : InstRW<[GenericDSPShort], (instregex "^PRECEQ_W_PHR_MM$")>;
1294 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBLA_MM$")>;
1295 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBL_MM$")>;
1296 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBRA_MM$")>;
1297 def : InstRW<[GenericDSPShort], (instregex "^PRECEU_PH_QBR_MM$")>;
1298 def : InstRW<[GenericDSPShort], (instregex "^PRECRQU_S_QB_PH_MM$")>;
1299 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_PH_W_MM$")>;
1300 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_QB_PH_MM$")>;
1301 def : InstRW<[GenericDSPShort], (instregex "^PRECRQ_RS_PH_W_MM$")>;
1302 def : InstRW<[GenericDSPShort], (instregex "^RADDU_W_QB_MM$")>;
1303 def : InstRW<[GenericDSPShort], (instregex "^RDDSP_MM$")>;
1304 def : InstRW<[GenericDSPShort], (instregex "^REPLV_PH_MM$")>;
1305 def : InstRW<[GenericDSPShort], (instregex "^REPLV_QB_MM$")>;
1306 def : InstRW<[GenericDSPShort], (instregex "^REPL_PH_MM$")>;
1307 def : InstRW<[GenericDSPShort], (instregex "^REPL_QB_MM$")>;
1308 def : InstRW<[GenericDSPShort], (instregex "^SHILOV_MM$")>;
1309 def : InstRW<[GenericDSPShort], (instregex "^SHILO_MM$")>;
1310 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_PH_MM$")>;
1311 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_QB_MM$")>;
1312 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_PH_MM$")>;
1313 def : InstRW<[GenericDSPShort], (instregex "^SHLLV_S_W_MM$")>;
1314 def : InstRW<[GenericDSPShort], (instregex "^SHLL_PH_MM$")>;
1315 def : InstRW<[GenericDSPShort], (instregex "^SHLL_QB_MM$")>;
1316 def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_PH_MM$")>;
1317 def : InstRW<[GenericDSPShort], (instregex "^SHLL_S_W_MM$")>;
1318 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_PH_MM$")>;
1319 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_PH_MM$")>;
1320 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_W_MM$")>;
1321 def : InstRW<[GenericDSPShort], (instregex "^SHRA_PH_MM$")>;
1322 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_PH_MM$")>;
1323 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_W_MM$")>;
1324 def : InstRW<[GenericDSPShort], (instregex "^SHRLV_QB_MM$")>;
1325 def : InstRW<[GenericDSPShort], (instregex "^SHRL_QB_MM$")>;
1326 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_PH_MM$")>;
1327 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_PH_MM$")>;
1328 def : InstRW<[GenericDSPShort], (instregex "^SUBQ_S_W_MM$")>;
1329 def : InstRW<[GenericDSPShort], (instregex "^SUBU_QB_MM$")>;
1330 def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_QB_MM$")>;
1331 def : InstRW<[GenericDSPShort], (instregex "^WRDSP_MM$")>;
1332
1333
1334 // microMIPS DSP R2 - hasDSP, HasDSPR2, InMicroMips
1335 // ================================================
1336
1337 def : InstRW<[GenericDSPShort], (instregex "^ABSQ_S_QB_MMR2$")>;
1338 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_PH_MMR2$")>;
1339 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_PH_MMR2$")>;
1340 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_R_W_MMR2$")>;
1341 def : InstRW<[GenericDSPShort], (instregex "^ADDQH_W_MMR2$")>;
1342 def : InstRW<[GenericDSPShort], (instregex "^ADDUH_QB_MMR2$")>;
1343 def : InstRW<[GenericDSPShort], (instregex "^ADDUH_R_QB_MMR2$")>;
1344 def : InstRW<[GenericDSPShort], (instregex "^ADDU_PH_MMR2$")>;
1345 def : InstRW<[GenericDSPShort], (instregex "^ADDU_S_PH_MMR2$")>;
1346 def : InstRW<[GenericDSPShort], (instregex "^APPEND_MMR2$")>;
1347 def : InstRW<[GenericDSPShort], (instregex "^BALIGN_MMR2$")>;
1348 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_EQ_QB_MMR2$")>;
1349 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LE_QB_MMR2$")>;
1350 def : InstRW<[GenericDSPShort], (instregex "^CMPGDU_LT_QB_MMR2$")>;
1351 def : InstRW<[GenericDSPShort], (instregex "^DPA_W_PH_MMR2$")>;
1352 def : InstRW<[GenericDSPShort], (instregex "^DPAQX_SA_W_PH_MMR2$")>;
1353 def : InstRW<[GenericDSPShort], (instregex "^DPAQX_S_W_PH_MMR2$")>;
1354 def : InstRW<[GenericDSPShort], (instregex "^DPAX_W_PH_MMR2$")>;
1355 def : InstRW<[GenericDSPShort], (instregex "^DPS_W_PH_MMR2$")>;
1356 def : InstRW<[GenericDSPShort], (instregex "^DPSQX_S_W_PH_MMR2$")>;
1357 def : InstRW<[GenericDSPShort], (instregex "^DPSQX_SA_W_PH_MMR2$")>;
1358 def : InstRW<[GenericDSPShort], (instregex "^DPSX_W_PH_MMR2$")>;
1359 def : InstRW<[GenericDSPShort], (instregex "^MUL_PH_MMR2$")>;
1360 def : InstRW<[GenericDSPShort], (instregex "^MUL_S_PH_MMR2$")>;
1361 def : InstRW<[GenericDSPShort], (instregex "^MULQ_RS_W_MMR2$")>;
1362 def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_PH_MMR2$")>;
1363 def : InstRW<[GenericDSPShort], (instregex "^MULQ_S_W_MMR2$")>;
1364 def : InstRW<[GenericDSPShort], (instregex "^MULSA_W_PH_MMR2$")>;
1365 def : InstRW<[GenericDSPShort], (instregex "^PRECR_QB_PH_MMR2$")>;
1366 def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_PH_W_MMR2$")>;
1367 def : InstRW<[GenericDSPShort], (instregex "^PRECR_SRA_R_PH_W_MMR2$")>;
1368 def : InstRW<[GenericDSPShort], (instregex "^PREPEND_MMR2$")>;
1369 def : InstRW<[GenericDSPShort], (instregex "^SHRA_QB_MMR2$")>;
1370 def : InstRW<[GenericDSPShort], (instregex "^SHRA_R_QB_MMR2$")>;
1371 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_QB_MMR2$")>;
1372 def : InstRW<[GenericDSPShort], (instregex "^SHRAV_R_QB_MMR2$")>;
1373 def : InstRW<[GenericDSPShort], (instregex "^SHRL_PH_MMR2$")>;
1374 def : InstRW<[GenericDSPShort], (instregex "^SHRLV_PH_MMR2$")>;
1375 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_PH_MMR2$")>;
1376 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_PH_MMR2$")>;
1377 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_W_MMR2$")>;
1378 def : InstRW<[GenericDSPShort], (instregex "^SUBQH_R_W_MMR2$")>;
1379 def : InstRW<[GenericDSPShort], (instregex "^SUBU_PH_MMR2$")>;
1380 def : InstRW<[GenericDSPShort], (instregex "^SUBU_S_PH_MMR2$")>;
1381 def : InstRW<[GenericDSPShort], (instregex "^SUBUH_QB_MMR2$")>;
1382 def : InstRW<[GenericDSPShort], (instregex "^SUBUH_R_QB_MMR2$")>;
1383
1384 // microMIPS DSP R3 - hasDSP, hasDSPR2, hasDSPR3, InMicroMips
1385 // ==========================================================
1386
1387 def : InstRW<[GenericDSPShort], (instregex "^BPOSGE32C_MMR3$")>;
1388
1389 // MIPS MSA ASE - hasMSA
1390 // =====================
1391
1392 def GenericWriteMSAShortLogic : SchedWriteRes<[GenericIssueFPUS]>;
1393 def GenericWriteMSAShortInt : SchedWriteRes<[GenericIssueFPUS]> {
1394 let Latency = 2;
1395 }
1396 def GenericWriteMoveOtherUnitsToFPU : SchedWriteRes<[GenericIssueFPUS]>;
1397 def GenericWriteMSAOther3 : SchedWriteRes<[GenericIssueFPUS]> {
1398 let Latency = 3;
1399 }
1400 def GenericWriteMSALongInt : SchedWriteRes<[GenericIssueFPUS]> {
1401 let Latency = 5;
1402 }
1403 def GenericWriteFPUDivI : SchedWriteRes<[GenericFPQ]> {
1404   let Latency = 33;
1405   let ResourceCycles = [ 33 ];
1406 }
1407
1408 // FPUS is also used in moves from floating point and MSA registers to general
1409 // purpose registers.
1410 def GenericWriteMoveFPUSToOtherUnits : SchedWriteRes<[GenericIssueFPUS]> {
1411   let Latency = 0;
1412 }
1413
1414 // FPUL is also used in moves from floating point and MSA registers to general
1415 // purpose registers.
1416 def GenericWriteMoveFPULToOtherUnits : SchedWriteRes<[GenericIssueFPUL]>;
1417
1418
1419 // adds_a.[bhwd], adds_[asu].[bhwd], addvi?.[bhwd], asub_[us].[bhwd],
1420 // aver?_[us].[bhwd]
1421 def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADD_A_[BHWD]$")>;
1422 def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADDS_[ASU]_[BHWD]$")>;
1423
1424 // TODO: ADDVI_[BHW] might be 1 cycle latency rather than 2. Need to confirm it.
1425 // add.[bhwd], addvi.[bhwd], asub_[us].[bhwd], ave.[bhwd], aver.[bhwd]
1426 def : InstRW<[GenericWriteMSAShortInt], (instregex "^ADDVI?_[BHWD]$")>;
1427 def : InstRW<[GenericWriteMSAShortInt], (instregex "^ASUB_[US].[BHWD]$")>;
1428 def : InstRW<[GenericWriteMSAShortInt], (instregex "^AVER?_[US].[BHWD]$")>;
1429
1430 // and.v, andi.b, move.v, ldi.[bhwd], xor.v, nor.v, xori.b, nori.b, lsa
1431 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^MOVE_V$")>;
1432 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^LDI_[BHWD]$")>;
1433 def : InstRW<[GenericWriteMSAShortLogic], (instrs LSA)>;
1434 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(AND|OR|[XN]OR)_V$")>;
1435 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(AND|OR|[XN]OR)I_B$")>;
1436 def : InstRW<[GenericWriteMSAShortLogic],
1437              (instregex "^(AND|OR|[XN]OR)_V_[DHW]_PSEUDO$")>;
1438
1439 // vshf.[bhwd], binsl.[bhwd], binsr.[bhwd], insert.[bhwd], sld?.[bhwd],
1440 // bset.[bhwd], bclr.[bhwd], bneg.[bhwd], bsel_v, bseli_b
1441 def : InstRW<[GenericWriteMSAShortInt], (instregex "^VSHF_[BHWD]$")>;
1442 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BINSL|BINSLI)_[BHWD]$")>;
1443 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BINSR|BINSRI)_[BHWD]$")>;
1444 def : InstRW<[GenericWriteMSAShortInt], (instregex "^INSERT_[BHWD]$")>;
1445 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(SLD|SLDI)_[BHWD]$")>;
1446 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BSET|BSETI)_[BHWD]$")>;
1447 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BCLR|BCLRI)_[BHWD]$")>;
1448 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BNEG|BNEGI)_[BHWD]$")>;
1449 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(BSEL_V|BSELI_B)$")>;
1450 def : InstRW<[GenericWriteMSAShortInt], (instregex "^BMN*Z.*$")>;
1451 def : InstRW<[GenericWriteMSAShortInt],
1452              (instregex "^BSEL_(H|W|D|FW|FD)_PSEUDO$")>;
1453
1454 // pcnt.[bhwd], sat_s.[bhwd], sat_u.[bhwd]
1455 def : InstRW<[GenericWriteMSAOther3], (instregex "^PCNT_[BHWD]$")>;
1456 def : InstRW<[GenericWriteMSAOther3], (instregex "^SAT_(S|U)_[BHWD]$")>;
1457
1458 // bnz.[bhwdv], cfcmsa, ctcmsa
1459 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(BNZ|BZ)_[BHWDV]$")>;
1460 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^C(F|T)CMSA$")>;
1461
1462 // shf.[bhw], fill[bhwd], splat?.[bhwd]
1463 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SHF_[BHW]$")>;
1464 def : InstRW<[GenericWriteMSAShortInt], (instregex "^FILL_[BHWD]$")>;
1465 def : InstRW<[GenericWriteMSAShortInt], (instregex "^(SPLAT|SPLATI)_[BHWD]$")>;
1466
1467 // fexp2_w, fexp2_d
1468 def : InstRW<[GenericWriteFPUS], (instregex "^FEXP2_(W|D)$")>;
1469
1470 // compare, converts, round to int, floating point truncate.
1471 def : InstRW<[GenericWriteFPUS], (instregex "^(CLT|CLTI)_(S|U)_[BHWD]$")>;
1472 def : InstRW<[GenericWriteFPUS], (instregex "^(CLE|CLEI)_(S|U)_[BHWD]$")>;
1473 def : InstRW<[GenericWriteFPUS], (instregex "^(CEQ|CEQI)_[BHWD]$")>;
1474 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_UN_(S|D)$")>;
1475 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_UEQ_(S|D)$")>;
1476 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_EQ_(S|D)$")>;
1477 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_LT_(S|D)$")>;
1478 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_ULT_(S|D)$")>;
1479 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_LE_(S|D)$")>;
1480 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_ULE_(S|D)$")>;
1481 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_F_(D|S)$")>;
1482 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SAF_(D|S)$")>;
1483 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SEQ_(D|S)$")>;
1484 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SLE_(D|S)$")>;
1485 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SLT_(D|S)$")>;
1486 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SUEQ_(D|S)$")>;
1487 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SULE_(D|S)$")>;
1488 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SULT_(D|S)$")>;
1489 def : InstRW<[GenericWriteFPUS], (instregex "^CMP_SUN_(D|S)$")>;
1490 def : InstRW<[GenericWriteFPUS], (instregex "^FS(AF|EQ|LT|LE|NE|OR)_(W|D)$")>;
1491 def : InstRW<[GenericWriteFPUS], (instregex "^FSUEQ_(W|D)$")>;
1492 def : InstRW<[GenericWriteFPUS], (instregex "^FSULE_(W|D)$")>;
1493 def : InstRW<[GenericWriteFPUS], (instregex "^FSULT_(W|D)$")>;
1494 def : InstRW<[GenericWriteFPUS], (instregex "^FSUNE_(W|D)$")>;
1495 def : InstRW<[GenericWriteFPUS], (instregex "^FSUN_(W|D)$")>;
1496 def : InstRW<[GenericWriteFPUS], (instregex "^FCAF_(W|D)$")>;
1497 def : InstRW<[GenericWriteFPUS], (instregex "^FCEQ_(W|D)$")>;
1498 def : InstRW<[GenericWriteFPUS], (instregex "^FCLE_(W|D)$")>;
1499 def : InstRW<[GenericWriteFPUS], (instregex "^FCLT_(W|D)$")>;
1500 def : InstRW<[GenericWriteFPUS], (instregex "^FCNE_(W|D)$")>;
1501 def : InstRW<[GenericWriteFPUS], (instregex "^FCOR_(W|D)$")>;
1502 def : InstRW<[GenericWriteFPUS], (instregex "^FCUEQ_(W|D)$")>;
1503 def : InstRW<[GenericWriteFPUS], (instregex "^FCULE_(W|D)$")>;
1504 def : InstRW<[GenericWriteFPUS], (instregex "^FCULT_(W|D)$")>;
1505 def : InstRW<[GenericWriteFPUS], (instregex "^FCUNE_(W|D)$")>;
1506 def : InstRW<[GenericWriteFPUS], (instregex "^FCUN_(W|D)$")>;
1507 def : InstRW<[GenericWriteFPUS], (instregex "^FABS_(W|D)$")>;
1508 def : InstRW<[GenericWriteFPUS], (instregex "^FFINT_(U|S)_(W|D)$")>;
1509 def : InstRW<[GenericWriteFPUS], (instregex "^FFQL_(W|D)$")>;
1510 def : InstRW<[GenericWriteFPUS], (instregex "^FFQR_(W|D)$")>;
1511 def : InstRW<[GenericWriteFPUS], (instregex "^FTINT_(U|S)_(W|D)$")>;
1512 def : InstRW<[GenericWriteFPUS], (instregex "^FRINT_(W|D)$")>;
1513 def : InstRW<[GenericWriteFPUS], (instregex "^FTQ_(H|W)$")>;
1514 def : InstRW<[GenericWriteFPUS], (instregex "^FTRUNC_(U|S)_(W|D)$")>;
1515
1516 // fexdo.[hw], fexupl.[wd], fexupr.[wd]
1517 def : InstRW<[GenericWriteFPUS], (instregex "^FEXDO_(H|W)$")>;
1518 def : InstRW<[GenericWriteFPUS], (instregex "^FEXUPL_(W|D)$")>;
1519 def : InstRW<[GenericWriteFPUS], (instregex "^FEXUPR_(W|D)$")>;
1520
1521 // fclass.[wd], fmax.[wd], fmax_a.[wd], fmin.[wd], fmin_a.[wd], flog2.[wd]
1522 def : InstRW<[GenericWriteFPUS], (instregex "^FCLASS_(W|D)$")>;
1523 def : InstRW<[GenericWriteFPUS], (instregex "^FMAX_A_(W|D)$")>;
1524 def : InstRW<[GenericWriteFPUS], (instregex "^FMAX_(W|D)$")>;
1525 def : InstRW<[GenericWriteFPUS], (instregex "^FMIN_A_(W|D)$")>;
1526 def : InstRW<[GenericWriteFPUS], (instregex "^FMIN_(W|D)$")>;
1527 def : InstRW<[GenericWriteFPUS], (instregex "^FLOG2_(W|D)$")>;
1528
1529 // interleave right/left, interleave even/odd, insert
1530 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(ILVR|ILVL)_[BHWD]$")>;
1531 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(ILVEV|ILVOD)_[BHWD]$")>;
1532
1533 // subs_?.[bhwd], subsus_?.[bhwd], subsuu_?.[bhwd], subvi.[bhwd], subv.[bhwd],
1534 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBS_(S|U)_[BHWD]$")>;
1535 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBSUS_(S|U)_[BHWD]$")>;
1536 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBSUU_(S|U)_[BHWD]$")>;
1537 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBVI_[BHWD]$")>;
1538 def : InstRW<[GenericWriteMSAShortInt], (instregex "^SUBV_[BHWD]$")>;
1539
1540 // mod_[su].[bhwd], div_[su].[bhwd]
1541 def : InstRW<[GenericWriteFPUDivI], (instregex "^MOD_(S|U)_[BHWD]$")>;
1542 def : InstRW<[GenericWriteFPUDivI], (instregex "^DIV_(S|U)_[BHWD]$")>;
1543
1544 // hadd_[su].[bhwd], hsub_[su].[bhwd], max_[sua].[bhwd], min_[sua].[bhwd],
1545 // maxi_[su].[bhwd], mini_[su].[bhwd], sra?.[bhwd], srar?.[bhwd], srlr.[bhwd],
1546 // sll?.[bhwd], pckev.[bhwd], pckod.[bhwd], nloc.[bhwd], nlzc.[bhwd],
1547 // insve.[bhwd]
1548 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^HADD_(S|U)_[BHWD]$")>;
1549 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^HSUB_(S|U)_[BHWD]$")>;
1550 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_S_[BHWD]$")>;
1551 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_U_[BHWD]$")>;
1552 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(MAX|MIN)_A_[BHWD]$")>;
1553 def : InstRW<[GenericWriteMSAShortLogic],
1554              (instregex "^(MAXI|MINI)_(S|U)_[BHWD]$")>;
1555 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRA|SRAI)_[BHWD]$")>;
1556 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRL|SRLI)_[BHWD]$")>;
1557 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRAR|SRARI)_[BHWD]$")>;
1558 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SRLR|SRLRI)_[BHWD]$")>;
1559 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(SLL|SLLI)_[BHWD]$")>;
1560 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(PCKEV|PCKOD)_[BHWD]$")>;
1561 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^(NLOC|NLZC)_[BHWD]$")>;
1562 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^INSVE_[BHWD]$")>;
1563 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^INSERT_F(D|W)_PSEUDO$")>;
1564 def : InstRW<[GenericWriteMSAShortLogic], (instregex "^FILL_F(D|W)_PSEUDO$")>;
1565
1566 // dpadd_?.[bhwd], dpsub_?.[bhwd], dotp_?.[bhwd], msubv.[bhwd], maddv.[bhwd]
1567 // mulv.[bhwd].
1568 def : InstRW<[GenericWriteMSALongInt], (instregex "^DPADD_(S|U)_[HWD]$")>;
1569 def : InstRW<[GenericWriteMSALongInt], (instregex "^DPSUB_(S|U)_[HWD]$")>;
1570 def : InstRW<[GenericWriteMSALongInt], (instregex "^DOTP_(S|U)_[HWD]$")>;
1571 def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUBV_[BHWD]$")>;
1572 def : InstRW<[GenericWriteMSALongInt], (instregex "^MADDV_[BHWD]$")>;
1573 def : InstRW<[GenericWriteMSALongInt], (instregex "^MULV_[BHWD]$")>;
1574
1575 // madd?.q.[hw], msub?.q.[hw], mul?.q.[hw]
1576 def : InstRW<[GenericWriteMSALongInt], (instregex "^MADDR_Q_[HW]$")>;
1577 def : InstRW<[GenericWriteMSALongInt], (instregex "^MADD_Q_[HW]$")>;
1578 def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUBR_Q_[HW]$")>;
1579 def : InstRW<[GenericWriteMSALongInt], (instregex "^MSUB_Q_[HW]$")>;
1580 def : InstRW<[GenericWriteMSALongInt], (instregex "^MULR_Q_[HW]$")>;
1581 def : InstRW<[GenericWriteMSALongInt], (instregex "^MUL_Q_[HW]$")>;
1582
1583 // fadd.[dw], fmadd.[dw], fmul.[dw], frcp.[dw], frsqrt.[dw], fsqrt.[dw]
1584 // fsub.[dw], fdiv.[dw]
1585 def : InstRW<[GenericWriteFPUL], (instregex "^FADD_[DW]$")>;
1586 def : InstRW<[GenericWriteFPUL], (instregex "^FMADD_[DW]$")>;
1587 def : InstRW<[GenericWriteFPUL], (instregex "^FMSUB_[DW]$")>;
1588 def : InstRW<[GenericWriteFPUL], (instregex "^FMUL_[DW]$")>;
1589 def : InstRW<[GenericWriteFPUL], (instregex "^FRCP_[DW]$")>;
1590 def : InstRW<[GenericWriteFPUL], (instregex "^FRSQRT_[DW]$")>;
1591 def : InstRW<[GenericWriteFPUL], (instregex "^FSQRT_[DW]$")>;
1592 def : InstRW<[GenericWriteFPUL], (instregex "^FSUB_[DW]$")>;
1593 def : InstRW<[GenericWriteFPUL], (instregex "^FDIV_[DW]$")>;
1594
1595 // copy.[su]_[bhwd]
1596 def : InstRW<[GenericWriteFPUMoveGPRFPU], (instregex "^COPY_U_[BHW]$")>;
1597 def : InstRW<[GenericWriteFPUMoveGPRFPU], (instregex "^COPY_S_[BHWD]$")>;
1598
1599 def : InstRW<[GenericWriteFPUStore], (instregex "^ST_[BHWD]$")>;
1600 def : InstRW<[GenericWriteFPUStore], (instrs ST_F16)>;
1601 def : InstRW<[GenericWriteFPULoad], (instregex "^LD_[BHWD]$")>;
1602 def : InstRW<[GenericWriteFPULoad], (instrs LD_F16)>;
1603
1604 // Atomic instructions
1605
1606 // FIXME: Define `WriteAtomic` in the MipsSchedule.td and
1607 // attach it to the Atomic2OpsPostRA, AtomicCmpSwapPostRA, ...
1608 // classes. Then just define resources for the `WriteAtomic` in each
1609 // machine models.
1610 def GenericAtomic : ProcResource<1> { let BufferSize = 1; }
1611 def GenericWriteAtomic : SchedWriteRes<[GenericAtomic]> { let Latency = 2; }
1612
1613 def : InstRW<[GenericWriteAtomic],
1614     (instregex "^ATOMIC_SWAP_I(8|16|32|64)_POSTRA$")>;
1615 def : InstRW<[GenericWriteAtomic],
1616     (instregex "^ATOMIC_CMP_SWAP_I(8|16|32|64)_POSTRA$")>;
1617 def : InstRW<[GenericWriteAtomic],
1618     (instregex "^ATOMIC_LOAD_(ADD|SUB|AND|OR|XOR|NAND)_I(8|16|32|64)_POSTRA$")>;
1619 }