1 //===- MipsMSAInstrFormats.td - Mips Instruction Formats ---*- tablegen -*-===//
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
7 //===----------------------------------------------------------------------===//
9 class MSAInst : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther>,
11 let EncodingPredicates = [HasStdEnc];
12 let Inst{31-26} = 0b011110;
15 class MSACBranch : MSAInst {
16 let Inst{31-26} = 0b010001;
19 class MSASpecial : MSAInst {
20 let Inst{31-26} = 0b000000;
23 class MSAPseudo<dag outs, dag ins, list<dag> pattern,
24 InstrItinClass itin = IIPseudo>:
25 MipsPseudo<outs, ins, pattern, itin> {
26 let EncodingPredicates = [HasStdEnc];
27 let ASEPredicate = [HasMSA];
30 class MSA_BIT_B_FMT<bits<3> major, bits<6> minor>: MSAInst {
35 let Inst{25-23} = major;
36 let Inst{22-19} = 0b1110;
40 let Inst{5-0} = minor;
43 class MSA_BIT_H_FMT<bits<3> major, bits<6> minor>: MSAInst {
48 let Inst{25-23} = major;
49 let Inst{22-20} = 0b110;
53 let Inst{5-0} = minor;
56 class MSA_BIT_W_FMT<bits<3> major, bits<6> minor>: MSAInst {
61 let Inst{25-23} = major;
62 let Inst{22-21} = 0b10;
66 let Inst{5-0} = minor;
69 class MSA_BIT_D_FMT<bits<3> major, bits<6> minor>: MSAInst {
74 let Inst{25-23} = major;
79 let Inst{5-0} = minor;
82 class MSA_2R_FILL_FMT<bits<8> major, bits<2> df, bits<6> minor>: MSAInst {
86 let Inst{25-18} = major;
90 let Inst{5-0} = minor;
93 class MSA_2R_FILL_D_FMT<bits<8> major, bits<2> df, bits<6> minor>: MSAInst {
97 let Inst{25-18} = major;
101 let Inst{5-0} = minor;
104 class MSA_2R_FMT<bits<8> major, bits<2> df, bits<6> minor>: MSAInst {
108 let Inst{25-18} = major;
109 let Inst{17-16} = df;
110 let Inst{15-11} = ws;
112 let Inst{5-0} = minor;
115 class MSA_2RF_FMT<bits<9> major, bits<1> df, bits<6> minor>: MSAInst {
119 let Inst{25-17} = major;
121 let Inst{15-11} = ws;
123 let Inst{5-0} = minor;
126 class MSA_3R_FMT<bits<3> major, bits<2> df, bits<6> minor>: MSAInst {
131 let Inst{25-23} = major;
132 let Inst{22-21} = df;
133 let Inst{20-16} = wt;
134 let Inst{15-11} = ws;
136 let Inst{5-0} = minor;
139 class MSA_3RF_FMT<bits<4> major, bits<1> df, bits<6> minor>: MSAInst {
144 let Inst{25-22} = major;
146 let Inst{20-16} = wt;
147 let Inst{15-11} = ws;
149 let Inst{5-0} = minor;
152 class MSA_3R_INDEX_FMT<bits<3> major, bits<2> df, bits<6> minor>: MSAInst {
157 let Inst{25-23} = major;
158 let Inst{22-21} = df;
159 let Inst{20-16} = rt;
160 let Inst{15-11} = ws;
162 let Inst{5-0} = minor;
165 class MSA_ELM_FMT<bits<10> major, bits<6> minor>: MSAInst {
169 let Inst{25-16} = major;
170 let Inst{15-11} = ws;
172 let Inst{5-0} = minor;
175 class MSA_ELM_CFCMSA_FMT<bits<10> major, bits<6> minor>: MSAInst {
179 let Inst{25-16} = major;
180 let Inst{15-11} = cs;
182 let Inst{5-0} = minor;
185 class MSA_ELM_CTCMSA_FMT<bits<10> major, bits<6> minor>: MSAInst {
189 let Inst{25-16} = major;
190 let Inst{15-11} = rs;
192 let Inst{5-0} = minor;
195 class MSA_ELM_B_FMT<bits<4> major, bits<6> minor>: MSAInst {
200 let Inst{25-22} = major;
201 let Inst{21-20} = 0b00;
202 let Inst{19-16} = n{3-0};
203 let Inst{15-11} = ws;
205 let Inst{5-0} = minor;
208 class MSA_ELM_H_FMT<bits<4> major, bits<6> minor>: MSAInst {
213 let Inst{25-22} = major;
214 let Inst{21-19} = 0b100;
215 let Inst{18-16} = n{2-0};
216 let Inst{15-11} = ws;
218 let Inst{5-0} = minor;
221 class MSA_ELM_W_FMT<bits<4> major, bits<6> minor>: MSAInst {
226 let Inst{25-22} = major;
227 let Inst{21-18} = 0b1100;
228 let Inst{17-16} = n{1-0};
229 let Inst{15-11} = ws;
231 let Inst{5-0} = minor;
234 class MSA_ELM_D_FMT<bits<4> major, bits<6> minor>: MSAInst {
239 let Inst{25-22} = major;
240 let Inst{21-17} = 0b11100;
242 let Inst{15-11} = ws;
244 let Inst{5-0} = minor;
247 class MSA_ELM_COPY_B_FMT<bits<4> major, bits<6> minor>: MSAInst {
252 let Inst{25-22} = major;
253 let Inst{21-20} = 0b00;
254 let Inst{19-16} = n{3-0};
255 let Inst{15-11} = ws;
257 let Inst{5-0} = minor;
260 class MSA_ELM_COPY_H_FMT<bits<4> major, bits<6> minor>: MSAInst {
265 let Inst{25-22} = major;
266 let Inst{21-19} = 0b100;
267 let Inst{18-16} = n{2-0};
268 let Inst{15-11} = ws;
270 let Inst{5-0} = minor;
273 class MSA_ELM_COPY_W_FMT<bits<4> major, bits<6> minor>: MSAInst {
278 let Inst{25-22} = major;
279 let Inst{21-18} = 0b1100;
280 let Inst{17-16} = n{1-0};
281 let Inst{15-11} = ws;
283 let Inst{5-0} = minor;
286 class MSA_ELM_COPY_D_FMT<bits<4> major, bits<6> minor>: MSAInst {
291 let Inst{25-22} = major;
292 let Inst{21-17} = 0b11100;
294 let Inst{15-11} = ws;
296 let Inst{5-0} = minor;
299 class MSA_ELM_INSERT_B_FMT<bits<4> major, bits<6> minor>: MSAInst {
304 let Inst{25-22} = major;
305 let Inst{21-20} = 0b00;
306 let Inst{19-16} = n{3-0};
307 let Inst{15-11} = rs;
309 let Inst{5-0} = minor;
312 class MSA_ELM_INSERT_H_FMT<bits<4> major, bits<6> minor>: MSAInst {
317 let Inst{25-22} = major;
318 let Inst{21-19} = 0b100;
319 let Inst{18-16} = n{2-0};
320 let Inst{15-11} = rs;
322 let Inst{5-0} = minor;
325 class MSA_ELM_INSERT_W_FMT<bits<4> major, bits<6> minor>: MSAInst {
330 let Inst{25-22} = major;
331 let Inst{21-18} = 0b1100;
332 let Inst{17-16} = n{1-0};
333 let Inst{15-11} = rs;
335 let Inst{5-0} = minor;
338 class MSA_ELM_INSERT_D_FMT<bits<4> major, bits<6> minor>: MSAInst {
343 let Inst{25-22} = major;
344 let Inst{21-17} = 0b11100;
346 let Inst{15-11} = rs;
348 let Inst{5-0} = minor;
351 class MSA_I5_FMT<bits<3> major, bits<2> df, bits<6> minor>: MSAInst {
356 let Inst{25-23} = major;
357 let Inst{22-21} = df;
358 let Inst{20-16} = imm;
359 let Inst{15-11} = ws;
361 let Inst{5-0} = minor;
364 class MSA_I8_FMT<bits<2> major, bits<6> minor>: MSAInst {
369 let Inst{25-24} = major;
370 let Inst{23-16} = u8;
371 let Inst{15-11} = ws;
373 let Inst{5-0} = minor;
376 class MSA_I10_FMT<bits<3> major, bits<2> df, bits<6> minor>: MSAInst {
380 let Inst{25-23} = major;
381 let Inst{22-21} = df;
382 let Inst{20-11} = s10;
384 let Inst{5-0} = minor;
387 class MSA_MI10_FMT<bits<2> df, bits<4> minor>: MSAInst {
391 let Inst{25-16} = addr{9-0};
392 let Inst{15-11} = addr{20-16};
394 let Inst{5-2} = minor;
398 class MSA_VEC_FMT<bits<5> major, bits<6> minor>: MSAInst {
403 let Inst{25-21} = major;
404 let Inst{20-16} = wt;
405 let Inst{15-11} = ws;
407 let Inst{5-0} = minor;
410 class MSA_CBRANCH_FMT<bits<3> major, bits<2> df>: MSACBranch {
414 let Inst{25-23} = major;
415 let Inst{22-21} = df;
416 let Inst{20-16} = wt;
417 let Inst{15-0} = offset;
420 class MSA_CBRANCH_V_FMT<bits<5> major>: MSACBranch {
424 let Inst{25-21} = major;
425 let Inst{20-16} = wt;
426 let Inst{15-0} = offset;
429 class SPECIAL_LSA_FMT<bits<6> minor>: MSASpecial {
435 let Inst{25-21} = rs;
436 let Inst{20-16} = rt;
437 let Inst{15-11} = rd;
438 let Inst{10-8} = 0b000;
440 let Inst{5-0} = minor;
443 class SPECIAL_DLSA_FMT<bits<6> minor>: MSASpecial {
449 let Inst{25-21} = rs;
450 let Inst{20-16} = rt;
451 let Inst{15-11} = rd;
452 let Inst{10-8} = 0b000;
454 let Inst{5-0} = minor;