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 class Field6<bits<6> val> {
36 def SPECIAL3_OPCODE : Field6<0b011111>;
37 def REGIMM_OPCODE : Field6<0b000001>;
39 class DSPInst<string opstr = "">
40 : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther> {
41 let Predicates = [HasDSP];
42 string BaseOpcode = opstr;
46 class PseudoDSP<dag outs, dag ins, list<dag> pattern,
47 InstrItinClass itin = IIPseudo>:
48 MipsPseudo<outs, ins, pattern, itin> {
49 let Predicates = [HasDSP];
52 // ADDU.QB sub-class format.
53 class ADDU_QB_FMT<bits<5> op> : DSPInst {
58 let Opcode = SPECIAL3_OPCODE.V;
64 let Inst{5-0} = 0b010000;
67 class RADDU_W_QB_FMT<bits<5> op> : DSPInst {
71 let Opcode = SPECIAL3_OPCODE.V;
77 let Inst{5-0} = 0b010000;
80 // CMPU.EQ.QB sub-class format.
81 class CMP_EQ_QB_R2_FMT<bits<5> op> : DSPInst {
85 let Opcode = SPECIAL3_OPCODE.V;
91 let Inst{5-0} = 0b010001;
94 class CMP_EQ_QB_R3_FMT<bits<5> op> : DSPInst {
99 let Opcode = SPECIAL3_OPCODE.V;
101 let Inst{25-21} = rs;
102 let Inst{20-16} = rt;
103 let Inst{15-11} = rd;
105 let Inst{5-0} = 0b010001;
108 class PRECR_SRA_PH_W_FMT<bits<5> op> : DSPInst {
113 let Opcode = SPECIAL3_OPCODE.V;
115 let Inst{25-21} = rs;
116 let Inst{20-16} = rt;
117 let Inst{15-11} = sa;
119 let Inst{5-0} = 0b010001;
122 // ABSQ_S.PH sub-class format.
123 class ABSQ_S_PH_R2_FMT<bits<5> op> : DSPInst {
127 let Opcode = SPECIAL3_OPCODE.V;
130 let Inst{20-16} = rt;
131 let Inst{15-11} = rd;
133 let Inst{5-0} = 0b010010;
137 class REPL_FMT<bits<5> op> : DSPInst {
141 let Opcode = SPECIAL3_OPCODE.V;
143 let Inst{25-16} = imm;
144 let Inst{15-11} = rd;
146 let Inst{5-0} = 0b010010;
149 // SHLL.QB sub-class format.
150 class SHLL_QB_FMT<bits<5> op> : DSPInst {
155 let Opcode = SPECIAL3_OPCODE.V;
157 let Inst{25-21} = rs_sa;
158 let Inst{20-16} = rt;
159 let Inst{15-11} = rd;
161 let Inst{5-0} = 0b010011;
164 // LX sub-class format.
165 class LX_FMT<bits<5> op> : DSPInst {
170 let Opcode = SPECIAL3_OPCODE.V;
172 let Inst{25-21} = base;
173 let Inst{20-16} = index;
174 let Inst{15-11} = rd;
176 let Inst{5-0} = 0b001010;
179 // ADDUH.QB sub-class format.
180 class ADDUH_QB_FMT<bits<5> op> : DSPInst {
185 let Opcode = SPECIAL3_OPCODE.V;
187 let Inst{25-21} = rs;
188 let Inst{20-16} = rt;
189 let Inst{15-11} = rd;
191 let Inst{5-0} = 0b011000;
194 // APPEND sub-class format.
195 class APPEND_FMT<bits<5> op> : DSPInst {
200 let Opcode = SPECIAL3_OPCODE.V;
202 let Inst{25-21} = rs;
203 let Inst{20-16} = rt;
204 let Inst{15-11} = sa;
206 let Inst{5-0} = 0b110001;
209 // DPA.W.PH sub-class format.
210 class DPA_W_PH_FMT<bits<5> op> : DSPInst {
215 let Opcode = SPECIAL3_OPCODE.V;
217 let Inst{25-21} = rs;
218 let Inst{20-16} = rt;
220 let Inst{12-11} = ac;
222 let Inst{5-0} = 0b110000;
225 // MULT sub-class format.
226 class MULT_FMT<bits<6> opcode, bits<6> funct> : DSPInst {
233 let Inst{25-21} = rs;
234 let Inst{20-16} = rt;
236 let Inst{12-11} = ac;
238 let Inst{5-0} = funct;
241 // MFHI sub-class format.
242 class MFHI_FMT<bits<6> funct> : DSPInst {
248 let Inst{22-21} = ac;
250 let Inst{15-11} = rd;
252 let Inst{5-0} = funct;
255 // MTHI sub-class format.
256 class MTHI_FMT<bits<6> funct> : DSPInst {
261 let Inst{25-21} = rs;
263 let Inst{12-11} = ac;
265 let Inst{5-0} = funct;
268 // EXTR.W sub-class format (type 1).
269 class EXTR_W_TY1_FMT<bits<5> op> : DSPInst {
274 let Opcode = SPECIAL3_OPCODE.V;
276 let Inst{25-21} = shift_rs;
277 let Inst{20-16} = rt;
279 let Inst{12-11} = ac;
281 let Inst{5-0} = 0b111000;
284 // SHILO sub-class format.
285 class SHILO_R1_FMT<bits<5> op> : DSPInst {
289 let Opcode = SPECIAL3_OPCODE.V;
291 let Inst{25-20} = shift;
293 let Inst{12-11} = ac;
295 let Inst{5-0} = 0b111000;
298 class SHILO_R2_FMT<bits<5> op> : DSPInst {
302 let Opcode = SPECIAL3_OPCODE.V;
304 let Inst{25-21} = rs;
306 let Inst{12-11} = ac;
308 let Inst{5-0} = 0b111000;
311 class RDDSP_FMT<bits<5> op> : DSPInst {
315 let Opcode = SPECIAL3_OPCODE.V;
317 let Inst{25-16} = mask;
318 let Inst{15-11} = rd;
320 let Inst{5-0} = 0b111000;
323 class WRDSP_FMT<bits<5> op> : DSPInst {
327 let Opcode = SPECIAL3_OPCODE.V;
329 let Inst{25-21} = rs;
330 let Inst{20-11} = mask;
332 let Inst{5-0} = 0b111000;
335 class BPOSGE32_FMT<bits<5> op> : DSPInst {
338 let Opcode = REGIMM_OPCODE.V;
341 let Inst{20-16} = op;
342 let Inst{15-0} = offset;
345 // INSV sub-class format.
346 class INSV_FMT<bits<6> op> : DSPInst {
350 let Opcode = SPECIAL3_OPCODE.V;
352 let Inst{25-21} = rs;
353 let Inst{20-16} = rt;