1 //===----------------------------------------------------------------------===//
2 // MicroMIPS Base Classes
3 //===----------------------------------------------------------------------===//
6 // Base class for MicroMips instructions.
7 // This class does not depend on the instruction size.
9 class MicroMipsInstBase<dag outs, dag ins, string asmstr, list<dag> pattern,
10 InstrItinClass itin, Format f> : Instruction
12 let Namespace = "Mips";
13 let DecoderNamespace = "MicroMips";
15 let OutOperandList = outs;
16 let InOperandList = ins;
18 let AsmString = asmstr;
19 let Pattern = pattern;
22 let Predicates = [InMicroMips];
28 // Base class for MicroMIPS 16-bit instructions.
30 class MicroMipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern,
31 InstrItinClass itin, Format f> :
32 MicroMipsInstBase<outs, ins, asmstr, pattern, itin, f>
36 field bits<16> SoftFail = 0;
40 //===----------------------------------------------------------------------===//
41 // MicroMIPS 16-bit Instruction Formats
42 //===----------------------------------------------------------------------===//
44 class MOVE_FM_MM16<bits<6> funct> {
50 let Inst{15-10} = funct;
55 class JALR_FM_MM16<bits<5> op> {
60 let Inst{15-10} = 0x11;
65 class MFHILO_FM_MM16<bits<5> funct> {
70 let Inst{15-10} = 0x11;
71 let Inst{9-5} = funct;
75 //===----------------------------------------------------------------------===//
76 // MicroMIPS 32-bit Instruction Formats
77 //===----------------------------------------------------------------------===//
80 string Arch = "micromips";
81 list<dag> Pattern = [];
84 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
96 let Inst{9-0} = funct;
99 class ADDI_FM_MM<bits<6> op> : MMArch {
106 let Inst{31-26} = op;
107 let Inst{25-21} = rt;
108 let Inst{20-16} = rs;
109 let Inst{15-0} = imm16;
112 class SLTI_FM_MM<bits<6> op> : MMArch {
119 let Inst{31-26} = op;
120 let Inst{25-21} = rt;
121 let Inst{20-16} = rs;
122 let Inst{15-0} = imm16;
125 class LUI_FM_MM : MMArch {
131 let Inst{31-26} = 0x10;
132 let Inst{25-21} = 0xd;
133 let Inst{20-16} = rt;
134 let Inst{15-0} = imm16;
137 class MULT_FM_MM<bits<10> funct> : MMArch {
143 let Inst{31-26} = 0x00;
144 let Inst{25-21} = rt;
145 let Inst{20-16} = rs;
146 let Inst{15-6} = funct;
147 let Inst{5-0} = 0x3c;
150 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
158 let Inst{25-21} = rd;
159 let Inst{20-16} = rt;
160 let Inst{15-11} = shamt;
161 let Inst{10} = rotate;
162 let Inst{9-0} = funct;
165 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
173 let Inst{25-21} = rt;
174 let Inst{20-16} = rs;
175 let Inst{15-11} = rd;
176 let Inst{10} = rotate;
177 let Inst{9-0} = funct;
180 class LW_FM_MM<bits<6> op> : MMArch {
186 let Inst{31-26} = op;
187 let Inst{25-21} = rt;
188 let Inst{20-16} = addr{20-16};
189 let Inst{15-0} = addr{15-0};
192 class LWL_FM_MM<bits<4> funct> {
198 let Inst{31-26} = 0x18;
199 let Inst{25-21} = rt;
200 let Inst{20-16} = addr{20-16};
201 let Inst{15-12} = funct;
202 let Inst{11-0} = addr{11-0};
205 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
212 let Inst{31-26} = 0x15;
213 let Inst{25-21} = rd;
214 let Inst{20-16} = rs;
215 let Inst{15-13} = fcc;
216 let Inst{12-6} = func;
217 let Inst{5-0} = 0x3b;
220 class MTLO_FM_MM<bits<10> funct> : MMArch {
225 let Inst{31-26} = 0x00;
226 let Inst{25-21} = 0x00;
227 let Inst{20-16} = rs;
228 let Inst{15-6} = funct;
229 let Inst{5-0} = 0x3c;
232 class MFLO_FM_MM<bits<10> funct> : MMArch {
237 let Inst{31-26} = 0x00;
238 let Inst{25-21} = 0x00;
239 let Inst{20-16} = rd;
240 let Inst{15-6} = funct;
241 let Inst{5-0} = 0x3c;
244 class CLO_FM_MM<bits<10> funct> : MMArch {
250 let Inst{31-26} = 0x00;
251 let Inst{25-21} = rd;
252 let Inst{20-16} = rs;
253 let Inst{15-6} = funct;
254 let Inst{5-0} = 0x3c;
257 class SEB_FM_MM<bits<10> funct> : MMArch {
263 let Inst{31-26} = 0x00;
264 let Inst{25-21} = rd;
265 let Inst{20-16} = rt;
266 let Inst{15-6} = funct;
267 let Inst{5-0} = 0x3c;
270 class EXT_FM_MM<bits<6> funct> : MMArch {
278 let Inst{31-26} = 0x00;
279 let Inst{25-21} = rt;
280 let Inst{20-16} = rs;
281 let Inst{15-11} = size;
282 let Inst{10-6} = pos;
283 let Inst{5-0} = funct;
286 class J_FM_MM<bits<6> op> : MMArch {
291 let Inst{31-26} = op;
292 let Inst{25-0} = target;
295 class JR_FM_MM<bits<8> funct> : MMArch {
300 let Inst{31-21} = 0x00;
301 let Inst{20-16} = rs;
302 let Inst{15-14} = 0x0;
303 let Inst{13-6} = funct;
304 let Inst{5-0} = 0x3c;
307 class JALR_FM_MM<bits<10> funct> {
313 let Inst{31-26} = 0x00;
314 let Inst{25-21} = rd;
315 let Inst{20-16} = rs;
316 let Inst{15-6} = funct;
317 let Inst{5-0} = 0x3c;
320 class BEQ_FM_MM<bits<6> op> : MMArch {
327 let Inst{31-26} = op;
328 let Inst{25-21} = rt;
329 let Inst{20-16} = rs;
330 let Inst{15-0} = offset;
333 class BGEZ_FM_MM<bits<5> funct> : MMArch {
339 let Inst{31-26} = 0x10;
340 let Inst{25-21} = funct;
341 let Inst{20-16} = rs;
342 let Inst{15-0} = offset;
345 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
351 let Inst{31-26} = 0x10;
352 let Inst{25-21} = funct;
353 let Inst{20-16} = rs;
354 let Inst{15-0} = offset;
357 class SYNC_FM_MM : MMArch {
362 let Inst{31-26} = 0x00;
363 let Inst{25-21} = 0x0;
364 let Inst{20-16} = stype;
365 let Inst{15-6} = 0x1ad;
366 let Inst{5-0} = 0x3c;
369 class BRK_FM_MM : MMArch {
373 let Inst{31-26} = 0x0;
374 let Inst{25-16} = code_1;
375 let Inst{15-6} = code_2;
376 let Inst{5-0} = 0x07;
379 class SYS_FM_MM : MMArch {
382 let Inst{31-26} = 0x0;
383 let Inst{25-16} = code_;
384 let Inst{15-6} = 0x22d;
385 let Inst{5-0} = 0x3c;
392 let Inst{31-26} = 0x00;
393 let Inst{25-16} = code_;
394 let Inst{15-6} = 0x24d;
395 let Inst{5-0} = 0x3c;
398 class ER_FM_MM<bits<10> funct> : MMArch {
401 let Inst{31-26} = 0x00;
402 let Inst{25-16} = 0x00;
403 let Inst{15-6} = funct;
404 let Inst{5-0} = 0x3c;
407 class EI_FM_MM<bits<10> funct> : MMArch {
411 let Inst{31-26} = 0x00;
412 let Inst{25-21} = 0x00;
413 let Inst{20-16} = rt;
414 let Inst{15-6} = funct;
415 let Inst{5-0} = 0x3c;
418 class TEQ_FM_MM<bits<6> funct> : MMArch {
425 let Inst{31-26} = 0x00;
426 let Inst{25-21} = rt;
427 let Inst{20-16} = rs;
428 let Inst{15-12} = code_;
429 let Inst{11-6} = funct;
430 let Inst{5-0} = 0x3c;
433 class TEQI_FM_MM<bits<5> funct> : MMArch {
439 let Inst{31-26} = 0x10;
440 let Inst{25-21} = funct;
441 let Inst{20-16} = rs;
442 let Inst{15-0} = imm16;
445 class LL_FM_MM<bits<4> funct> {
451 let Inst{31-26} = 0x18;
452 let Inst{25-21} = rt;
453 let Inst{20-16} = addr{20-16};
454 let Inst{15-12} = funct;
455 let Inst{11-0} = addr{11-0};
458 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
465 let Inst{31-26} = 0x15;
466 let Inst{25-21} = ft;
467 let Inst{20-16} = fs;
468 let Inst{15-11} = fd;
471 let Inst{7-0} = funct;
473 list<dag> Pattern = [];
476 class LWXC1_FM_MM<bits<9> funct> : MMArch {
483 let Inst{31-26} = 0x15;
484 let Inst{25-21} = index;
485 let Inst{20-16} = base;
486 let Inst{15-11} = fd;
487 let Inst{10-9} = 0x0;
488 let Inst{8-0} = funct;
491 class SWXC1_FM_MM<bits<9> funct> : MMArch {
498 let Inst{31-26} = 0x15;
499 let Inst{25-21} = index;
500 let Inst{20-16} = base;
501 let Inst{15-11} = fs;
502 let Inst{10-9} = 0x0;
503 let Inst{8-0} = funct;
506 class CEQS_FM_MM<bits<2> fmt> : MMArch {
513 let Inst{31-26} = 0x15;
514 let Inst{25-21} = ft;
515 let Inst{20-16} = fs;
516 let Inst{15-13} = 0x0; // cc
518 let Inst{11-10} = fmt;
519 let Inst{9-6} = cond;
520 let Inst{5-0} = 0x3c;
523 class BC1F_FM_MM<bits<5> tf> : MMArch {
528 let Inst{31-26} = 0x10;
529 let Inst{25-21} = tf;
530 let Inst{20-18} = 0x0; // cc
531 let Inst{17-16} = 0x0;
532 let Inst{15-0} = offset;
535 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
541 let Inst{31-26} = 0x15;
542 let Inst{25-21} = fd;
543 let Inst{20-16} = fs;
546 let Inst{13-6} = funct;
547 let Inst{5-0} = 0x3b;
550 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
556 let Inst{31-26} = 0x15;
557 let Inst{25-21} = fd;
558 let Inst{20-16} = fs;
560 let Inst{14-13} = fmt;
561 let Inst{12-6} = funct;
562 let Inst{5-0} = 0x3b;
565 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
571 let Inst{31-26} = 0x15;
572 let Inst{25-21} = fd;
573 let Inst{20-16} = fs;
574 let Inst{15-13} = 0x0; //cc
575 let Inst{12-11} = 0x0;
576 let Inst{10-9} = fmt;
577 let Inst{8-0} = func;
580 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
587 let Inst{31-26} = 0x15;
588 let Inst{25-21} = rt;
589 let Inst{20-16} = fs;
590 let Inst{15-11} = fd;
592 let Inst{7-0} = funct;
595 class MFC1_FM_MM<bits<8> funct> : MMArch {
601 let Inst{31-26} = 0x15;
602 let Inst{25-21} = rt;
603 let Inst{20-16} = fs;
604 let Inst{15-14} = 0x0;
605 let Inst{13-6} = funct;
606 let Inst{5-0} = 0x3b;
609 class MADDS_FM_MM<bits<6> funct>: MMArch {
617 let Inst{31-26} = 0x15;
618 let Inst{25-21} = ft;
619 let Inst{20-16} = fs;
620 let Inst{15-11} = fd;
622 let Inst{5-0} = funct;