1 //===- MipsDSPInstrFormats.td - Mips Instruction Formats ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 def Dsp2MicroMips : InstrMapping {
13 let FilterClass = "DspMMRel";
14 // Instructions with the same BaseOpcode and isNVStore values form a row.
15 let RowFields = ["BaseOpcode"];
16 // Instructions with the same predicate sense form a column.
17 let ColFields = ["Arch"];
18 // The key column is the unpredicated instructions.
20 // Value columns are PredSense=true and PredSense=false
21 let ValueCols = [["dsp"], ["mmdsp"]];
24 def HasDSP : Predicate<"Subtarget->hasDSP()">,
25 AssemblerPredicate<"FeatureDSP">;
26 def HasDSPR2 : Predicate<"Subtarget->hasDSPR2()">,
27 AssemblerPredicate<"FeatureDSPR2">;
28 def HasDSPR3 : Predicate<"Subtarget->hasDSPR3()">,
29 AssemblerPredicate<"FeatureDSPR3">;
32 list<Predicate> ASEPredicate = [HasDSPR2];
36 list<Predicate> ASEPredicate = [HasDSPR3];
40 class Field6<bits<6> val> {
44 def SPECIAL3_OPCODE : Field6<0b011111>;
45 def REGIMM_OPCODE : Field6<0b000001>;
47 class DSPInst<string opstr = "">
48 : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther> {
49 let ASEPredicate = [HasDSP];
50 string BaseOpcode = opstr;
54 class PseudoDSP<dag outs, dag ins, list<dag> pattern,
55 InstrItinClass itin = IIPseudo>
56 : MipsPseudo<outs, ins, pattern, itin> {
57 let ASEPredicate = [HasDSP];
60 class DSPInstAlias<string Asm, dag Result, bit Emit = 0b1>
61 : InstAlias<Asm, Result, Emit>, PredicateControl {
62 let ASEPredicate = [HasDSP];
65 // ADDU.QB sub-class format.
66 class ADDU_QB_FMT<bits<5> op> : DSPInst {
71 let Opcode = SPECIAL3_OPCODE.V;
77 let Inst{5-0} = 0b010000;
80 class RADDU_W_QB_FMT<bits<5> op> : DSPInst {
84 let Opcode = SPECIAL3_OPCODE.V;
90 let Inst{5-0} = 0b010000;
93 // CMPU.EQ.QB sub-class format.
94 class CMP_EQ_QB_R2_FMT<bits<5> op> : DSPInst {
98 let Opcode = SPECIAL3_OPCODE.V;
100 let Inst{25-21} = rs;
101 let Inst{20-16} = rt;
104 let Inst{5-0} = 0b010001;
107 class CMP_EQ_QB_R3_FMT<bits<5> op> : DSPInst {
112 let Opcode = SPECIAL3_OPCODE.V;
114 let Inst{25-21} = rs;
115 let Inst{20-16} = rt;
116 let Inst{15-11} = rd;
118 let Inst{5-0} = 0b010001;
121 class PRECR_SRA_PH_W_FMT<bits<5> op> : DSPInst {
126 let Opcode = SPECIAL3_OPCODE.V;
128 let Inst{25-21} = rs;
129 let Inst{20-16} = rt;
130 let Inst{15-11} = sa;
132 let Inst{5-0} = 0b010001;
135 // ABSQ_S.PH sub-class format.
136 class ABSQ_S_PH_R2_FMT<bits<5> op> : DSPInst {
140 let Opcode = SPECIAL3_OPCODE.V;
143 let Inst{20-16} = rt;
144 let Inst{15-11} = rd;
146 let Inst{5-0} = 0b010010;
150 class REPL_FMT<bits<5> op> : DSPInst {
154 let Opcode = SPECIAL3_OPCODE.V;
156 let Inst{25-16} = imm;
157 let Inst{15-11} = rd;
159 let Inst{5-0} = 0b010010;
162 // SHLL.QB sub-class format.
163 class SHLL_QB_FMT<bits<5> op> : DSPInst {
168 let Opcode = SPECIAL3_OPCODE.V;
170 let Inst{25-21} = rs_sa;
171 let Inst{20-16} = rt;
172 let Inst{15-11} = rd;
174 let Inst{5-0} = 0b010011;
177 // LX sub-class format.
178 class LX_FMT<bits<5> op> : DSPInst {
183 let Opcode = SPECIAL3_OPCODE.V;
185 let Inst{25-21} = base;
186 let Inst{20-16} = index;
187 let Inst{15-11} = rd;
189 let Inst{5-0} = 0b001010;
192 // ADDUH.QB sub-class format.
193 class ADDUH_QB_FMT<bits<5> op> : DSPInst {
198 let Opcode = SPECIAL3_OPCODE.V;
200 let Inst{25-21} = rs;
201 let Inst{20-16} = rt;
202 let Inst{15-11} = rd;
204 let Inst{5-0} = 0b011000;
207 // APPEND sub-class format.
208 class APPEND_FMT<bits<5> op> : DSPInst {
213 let Opcode = SPECIAL3_OPCODE.V;
215 let Inst{25-21} = rs;
216 let Inst{20-16} = rt;
217 let Inst{15-11} = sa;
219 let Inst{5-0} = 0b110001;
222 // DPA.W.PH sub-class format.
223 class DPA_W_PH_FMT<bits<5> op> : DSPInst {
228 let Opcode = SPECIAL3_OPCODE.V;
230 let Inst{25-21} = rs;
231 let Inst{20-16} = rt;
233 let Inst{12-11} = ac;
235 let Inst{5-0} = 0b110000;
238 // MULT sub-class format.
239 class MULT_FMT<bits<6> opcode, bits<6> funct> : DSPInst {
246 let Inst{25-21} = rs;
247 let Inst{20-16} = rt;
249 let Inst{12-11} = ac;
251 let Inst{5-0} = funct;
254 // MFHI sub-class format.
255 class MFHI_FMT<bits<6> funct> : DSPInst {
261 let Inst{22-21} = ac;
263 let Inst{15-11} = rd;
265 let Inst{5-0} = funct;
268 // MTHI sub-class format.
269 class MTHI_FMT<bits<6> funct> : DSPInst {
274 let Inst{25-21} = rs;
276 let Inst{12-11} = ac;
278 let Inst{5-0} = funct;
281 // EXTR.W sub-class format (type 1).
282 class EXTR_W_TY1_FMT<bits<5> op> : DSPInst {
287 let Opcode = SPECIAL3_OPCODE.V;
289 let Inst{25-21} = shift_rs;
290 let Inst{20-16} = rt;
292 let Inst{12-11} = ac;
294 let Inst{5-0} = 0b111000;
297 // SHILO sub-class format.
298 class SHILO_R1_FMT<bits<5> op> : DSPInst {
302 let Opcode = SPECIAL3_OPCODE.V;
304 let Inst{25-20} = shift;
306 let Inst{12-11} = ac;
308 let Inst{5-0} = 0b111000;
311 class SHILO_R2_FMT<bits<5> op> : DSPInst {
315 let Opcode = SPECIAL3_OPCODE.V;
317 let Inst{25-21} = rs;
319 let Inst{12-11} = ac;
321 let Inst{5-0} = 0b111000;
324 class RDDSP_FMT<bits<5> op> : DSPInst {
328 let Opcode = SPECIAL3_OPCODE.V;
330 let Inst{25-16} = mask;
331 let Inst{15-11} = rd;
333 let Inst{5-0} = 0b111000;
336 class WRDSP_FMT<bits<5> op> : DSPInst {
340 let Opcode = SPECIAL3_OPCODE.V;
342 let Inst{25-21} = rs;
343 let Inst{20-11} = mask;
345 let Inst{5-0} = 0b111000;
348 class BPOSGE32_FMT<bits<5> op> : DSPInst {
351 let Opcode = REGIMM_OPCODE.V;
354 let Inst{20-16} = op;
355 let Inst{15-0} = offset;
358 // INSV sub-class format.
359 class INSV_FMT<bits<6> op> : DSPInst {
363 let Opcode = SPECIAL3_OPCODE.V;
365 let Inst{25-21} = rs;
366 let Inst{20-16} = rt;