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 ARITH_FM_MM16<bit funct> {
51 let Inst{15-10} = 0x01;
58 class LOGIC_FM_MM16<bits<4> funct> {
64 let Inst{15-10} = 0x11;
65 let Inst{9-6} = funct;
70 class SHIFT_FM_MM16<bits<1> funct> {
77 let Inst{15-10} = 0x09;
80 let Inst{3-1} = shamt;
84 class ADDIUS5_FM_MM16 {
90 let Inst{15-10} = 0x13;
96 class ADDIUSP_FM_MM16 {
101 let Inst{15-10} = 0x13;
106 class MOVE_FM_MM16<bits<6> funct> {
112 let Inst{15-10} = funct;
123 let Inst{15-10} = 0x3b;
128 class JALR_FM_MM16<bits<5> op> {
133 let Inst{15-10} = 0x11;
138 class MFHILO_FM_MM16<bits<5> funct> {
143 let Inst{15-10} = 0x11;
144 let Inst{9-5} = funct;
148 class JRADDIUSP_FM_MM16<bits<5> op> {
154 let Inst{15-10} = 0x11;
159 //===----------------------------------------------------------------------===//
160 // MicroMIPS 32-bit Instruction Formats
161 //===----------------------------------------------------------------------===//
164 string Arch = "micromips";
165 list<dag> Pattern = [];
168 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
175 let Inst{31-26} = op;
176 let Inst{25-21} = rt;
177 let Inst{20-16} = rs;
178 let Inst{15-11} = rd;
180 let Inst{9-0} = funct;
183 class ADDI_FM_MM<bits<6> op> : MMArch {
190 let Inst{31-26} = op;
191 let Inst{25-21} = rt;
192 let Inst{20-16} = rs;
193 let Inst{15-0} = imm16;
196 class SLTI_FM_MM<bits<6> op> : MMArch {
203 let Inst{31-26} = op;
204 let Inst{25-21} = rt;
205 let Inst{20-16} = rs;
206 let Inst{15-0} = imm16;
209 class LUI_FM_MM : MMArch {
215 let Inst{31-26} = 0x10;
216 let Inst{25-21} = 0xd;
217 let Inst{20-16} = rt;
218 let Inst{15-0} = imm16;
221 class MULT_FM_MM<bits<10> funct> : MMArch {
227 let Inst{31-26} = 0x00;
228 let Inst{25-21} = rt;
229 let Inst{20-16} = rs;
230 let Inst{15-6} = funct;
231 let Inst{5-0} = 0x3c;
234 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
242 let Inst{25-21} = rd;
243 let Inst{20-16} = rt;
244 let Inst{15-11} = shamt;
245 let Inst{10} = rotate;
246 let Inst{9-0} = funct;
249 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
257 let Inst{25-21} = rt;
258 let Inst{20-16} = rs;
259 let Inst{15-11} = rd;
260 let Inst{10} = rotate;
261 let Inst{9-0} = funct;
264 class LW_FM_MM<bits<6> op> : MMArch {
270 let Inst{31-26} = op;
271 let Inst{25-21} = rt;
272 let Inst{20-16} = addr{20-16};
273 let Inst{15-0} = addr{15-0};
276 class LWL_FM_MM<bits<4> funct> {
282 let Inst{31-26} = 0x18;
283 let Inst{25-21} = rt;
284 let Inst{20-16} = addr{20-16};
285 let Inst{15-12} = funct;
286 let Inst{11-0} = addr{11-0};
289 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
296 let Inst{31-26} = 0x15;
297 let Inst{25-21} = rd;
298 let Inst{20-16} = rs;
299 let Inst{15-13} = fcc;
300 let Inst{12-6} = func;
301 let Inst{5-0} = 0x3b;
304 class MTLO_FM_MM<bits<10> funct> : MMArch {
309 let Inst{31-26} = 0x00;
310 let Inst{25-21} = 0x00;
311 let Inst{20-16} = rs;
312 let Inst{15-6} = funct;
313 let Inst{5-0} = 0x3c;
316 class MFLO_FM_MM<bits<10> funct> : MMArch {
321 let Inst{31-26} = 0x00;
322 let Inst{25-21} = 0x00;
323 let Inst{20-16} = rd;
324 let Inst{15-6} = funct;
325 let Inst{5-0} = 0x3c;
328 class CLO_FM_MM<bits<10> funct> : MMArch {
334 let Inst{31-26} = 0x00;
335 let Inst{25-21} = rd;
336 let Inst{20-16} = rs;
337 let Inst{15-6} = funct;
338 let Inst{5-0} = 0x3c;
341 class SEB_FM_MM<bits<10> funct> : MMArch {
347 let Inst{31-26} = 0x00;
348 let Inst{25-21} = rd;
349 let Inst{20-16} = rt;
350 let Inst{15-6} = funct;
351 let Inst{5-0} = 0x3c;
354 class EXT_FM_MM<bits<6> funct> : MMArch {
362 let Inst{31-26} = 0x00;
363 let Inst{25-21} = rt;
364 let Inst{20-16} = rs;
365 let Inst{15-11} = size;
366 let Inst{10-6} = pos;
367 let Inst{5-0} = funct;
370 class J_FM_MM<bits<6> op> : MMArch {
375 let Inst{31-26} = op;
376 let Inst{25-0} = target;
379 class JR_FM_MM<bits<8> funct> : MMArch {
384 let Inst{31-21} = 0x00;
385 let Inst{20-16} = rs;
386 let Inst{15-14} = 0x0;
387 let Inst{13-6} = funct;
388 let Inst{5-0} = 0x3c;
391 class JALR_FM_MM<bits<10> funct> {
397 let Inst{31-26} = 0x00;
398 let Inst{25-21} = rd;
399 let Inst{20-16} = rs;
400 let Inst{15-6} = funct;
401 let Inst{5-0} = 0x3c;
404 class BEQ_FM_MM<bits<6> op> : MMArch {
411 let Inst{31-26} = op;
412 let Inst{25-21} = rt;
413 let Inst{20-16} = rs;
414 let Inst{15-0} = offset;
417 class BGEZ_FM_MM<bits<5> funct> : MMArch {
423 let Inst{31-26} = 0x10;
424 let Inst{25-21} = funct;
425 let Inst{20-16} = rs;
426 let Inst{15-0} = offset;
429 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
435 let Inst{31-26} = 0x10;
436 let Inst{25-21} = funct;
437 let Inst{20-16} = rs;
438 let Inst{15-0} = offset;
441 class SYNC_FM_MM : MMArch {
446 let Inst{31-26} = 0x00;
447 let Inst{25-21} = 0x0;
448 let Inst{20-16} = stype;
449 let Inst{15-6} = 0x1ad;
450 let Inst{5-0} = 0x3c;
453 class BRK_FM_MM : MMArch {
457 let Inst{31-26} = 0x0;
458 let Inst{25-16} = code_1;
459 let Inst{15-6} = code_2;
460 let Inst{5-0} = 0x07;
463 class SYS_FM_MM : MMArch {
466 let Inst{31-26} = 0x0;
467 let Inst{25-16} = code_;
468 let Inst{15-6} = 0x22d;
469 let Inst{5-0} = 0x3c;
476 let Inst{31-26} = 0x00;
477 let Inst{25-16} = code_;
478 let Inst{15-6} = 0x24d;
479 let Inst{5-0} = 0x3c;
482 class ER_FM_MM<bits<10> funct> : MMArch {
485 let Inst{31-26} = 0x00;
486 let Inst{25-16} = 0x00;
487 let Inst{15-6} = funct;
488 let Inst{5-0} = 0x3c;
491 class EI_FM_MM<bits<10> funct> : MMArch {
495 let Inst{31-26} = 0x00;
496 let Inst{25-21} = 0x00;
497 let Inst{20-16} = rt;
498 let Inst{15-6} = funct;
499 let Inst{5-0} = 0x3c;
502 class TEQ_FM_MM<bits<6> funct> : MMArch {
509 let Inst{31-26} = 0x00;
510 let Inst{25-21} = rt;
511 let Inst{20-16} = rs;
512 let Inst{15-12} = code_;
513 let Inst{11-6} = funct;
514 let Inst{5-0} = 0x3c;
517 class TEQI_FM_MM<bits<5> funct> : MMArch {
523 let Inst{31-26} = 0x10;
524 let Inst{25-21} = funct;
525 let Inst{20-16} = rs;
526 let Inst{15-0} = imm16;
529 class LL_FM_MM<bits<4> funct> {
535 let Inst{31-26} = 0x18;
536 let Inst{25-21} = rt;
537 let Inst{20-16} = addr{20-16};
538 let Inst{15-12} = funct;
539 let Inst{11-0} = addr{11-0};
542 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
549 let Inst{31-26} = 0x15;
550 let Inst{25-21} = ft;
551 let Inst{20-16} = fs;
552 let Inst{15-11} = fd;
555 let Inst{7-0} = funct;
557 list<dag> Pattern = [];
560 class LWXC1_FM_MM<bits<9> funct> : MMArch {
567 let Inst{31-26} = 0x15;
568 let Inst{25-21} = index;
569 let Inst{20-16} = base;
570 let Inst{15-11} = fd;
571 let Inst{10-9} = 0x0;
572 let Inst{8-0} = funct;
575 class SWXC1_FM_MM<bits<9> funct> : MMArch {
582 let Inst{31-26} = 0x15;
583 let Inst{25-21} = index;
584 let Inst{20-16} = base;
585 let Inst{15-11} = fs;
586 let Inst{10-9} = 0x0;
587 let Inst{8-0} = funct;
590 class CEQS_FM_MM<bits<2> fmt> : MMArch {
597 let Inst{31-26} = 0x15;
598 let Inst{25-21} = ft;
599 let Inst{20-16} = fs;
600 let Inst{15-13} = 0x0; // cc
602 let Inst{11-10} = fmt;
603 let Inst{9-6} = cond;
604 let Inst{5-0} = 0x3c;
607 class BC1F_FM_MM<bits<5> tf> : MMArch {
612 let Inst{31-26} = 0x10;
613 let Inst{25-21} = tf;
614 let Inst{20-18} = 0x0; // cc
615 let Inst{17-16} = 0x0;
616 let Inst{15-0} = offset;
619 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
625 let Inst{31-26} = 0x15;
626 let Inst{25-21} = fd;
627 let Inst{20-16} = fs;
630 let Inst{13-6} = funct;
631 let Inst{5-0} = 0x3b;
634 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
640 let Inst{31-26} = 0x15;
641 let Inst{25-21} = fd;
642 let Inst{20-16} = fs;
644 let Inst{14-13} = fmt;
645 let Inst{12-6} = funct;
646 let Inst{5-0} = 0x3b;
649 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
655 let Inst{31-26} = 0x15;
656 let Inst{25-21} = fd;
657 let Inst{20-16} = fs;
658 let Inst{15-13} = 0x0; //cc
659 let Inst{12-11} = 0x0;
660 let Inst{10-9} = fmt;
661 let Inst{8-0} = func;
664 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
671 let Inst{31-26} = 0x15;
672 let Inst{25-21} = rt;
673 let Inst{20-16} = fs;
674 let Inst{15-11} = fd;
676 let Inst{7-0} = funct;
679 class MFC1_FM_MM<bits<8> funct> : MMArch {
685 let Inst{31-26} = 0x15;
686 let Inst{25-21} = rt;
687 let Inst{20-16} = fs;
688 let Inst{15-14} = 0x0;
689 let Inst{13-6} = funct;
690 let Inst{5-0} = 0x3b;
693 class MADDS_FM_MM<bits<6> funct>: MMArch {
701 let Inst{31-26} = 0x15;
702 let Inst{25-21} = ft;
703 let Inst{20-16} = fs;
704 let Inst{15-11} = fd;
706 let Inst{5-0} = funct;
709 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
715 let Inst{31-26} = 0x10;
716 let Inst{25-21} = funct;
717 let Inst{20-16} = rs;
718 let Inst{15-0} = offset;
721 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
724 let Inst{31-26} = 0x0;
725 let Inst{25-16} = 0x0;
727 let Inst{5-0} = 0x3c;