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 ADDIUS5_FM_MM16 {
76 let Inst{15-10} = 0x13;
82 class ADDIUSP_FM_MM16 {
87 let Inst{15-10} = 0x13;
92 class MOVE_FM_MM16<bits<6> funct> {
98 let Inst{15-10} = funct;
103 class JALR_FM_MM16<bits<5> op> {
108 let Inst{15-10} = 0x11;
113 class MFHILO_FM_MM16<bits<5> funct> {
118 let Inst{15-10} = 0x11;
119 let Inst{9-5} = funct;
123 class JRADDIUSP_FM_MM16<bits<5> op> {
129 let Inst{15-10} = 0x11;
134 //===----------------------------------------------------------------------===//
135 // MicroMIPS 32-bit Instruction Formats
136 //===----------------------------------------------------------------------===//
139 string Arch = "micromips";
140 list<dag> Pattern = [];
143 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
150 let Inst{31-26} = op;
151 let Inst{25-21} = rt;
152 let Inst{20-16} = rs;
153 let Inst{15-11} = rd;
155 let Inst{9-0} = funct;
158 class ADDI_FM_MM<bits<6> op> : MMArch {
165 let Inst{31-26} = op;
166 let Inst{25-21} = rt;
167 let Inst{20-16} = rs;
168 let Inst{15-0} = imm16;
171 class SLTI_FM_MM<bits<6> op> : MMArch {
178 let Inst{31-26} = op;
179 let Inst{25-21} = rt;
180 let Inst{20-16} = rs;
181 let Inst{15-0} = imm16;
184 class LUI_FM_MM : MMArch {
190 let Inst{31-26} = 0x10;
191 let Inst{25-21} = 0xd;
192 let Inst{20-16} = rt;
193 let Inst{15-0} = imm16;
196 class MULT_FM_MM<bits<10> funct> : MMArch {
202 let Inst{31-26} = 0x00;
203 let Inst{25-21} = rt;
204 let Inst{20-16} = rs;
205 let Inst{15-6} = funct;
206 let Inst{5-0} = 0x3c;
209 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
217 let Inst{25-21} = rd;
218 let Inst{20-16} = rt;
219 let Inst{15-11} = shamt;
220 let Inst{10} = rotate;
221 let Inst{9-0} = funct;
224 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
232 let Inst{25-21} = rt;
233 let Inst{20-16} = rs;
234 let Inst{15-11} = rd;
235 let Inst{10} = rotate;
236 let Inst{9-0} = funct;
239 class LW_FM_MM<bits<6> op> : MMArch {
245 let Inst{31-26} = op;
246 let Inst{25-21} = rt;
247 let Inst{20-16} = addr{20-16};
248 let Inst{15-0} = addr{15-0};
251 class LWL_FM_MM<bits<4> funct> {
257 let Inst{31-26} = 0x18;
258 let Inst{25-21} = rt;
259 let Inst{20-16} = addr{20-16};
260 let Inst{15-12} = funct;
261 let Inst{11-0} = addr{11-0};
264 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
271 let Inst{31-26} = 0x15;
272 let Inst{25-21} = rd;
273 let Inst{20-16} = rs;
274 let Inst{15-13} = fcc;
275 let Inst{12-6} = func;
276 let Inst{5-0} = 0x3b;
279 class MTLO_FM_MM<bits<10> funct> : MMArch {
284 let Inst{31-26} = 0x00;
285 let Inst{25-21} = 0x00;
286 let Inst{20-16} = rs;
287 let Inst{15-6} = funct;
288 let Inst{5-0} = 0x3c;
291 class MFLO_FM_MM<bits<10> funct> : MMArch {
296 let Inst{31-26} = 0x00;
297 let Inst{25-21} = 0x00;
298 let Inst{20-16} = rd;
299 let Inst{15-6} = funct;
300 let Inst{5-0} = 0x3c;
303 class CLO_FM_MM<bits<10> funct> : MMArch {
309 let Inst{31-26} = 0x00;
310 let Inst{25-21} = rd;
311 let Inst{20-16} = rs;
312 let Inst{15-6} = funct;
313 let Inst{5-0} = 0x3c;
316 class SEB_FM_MM<bits<10> funct> : MMArch {
322 let Inst{31-26} = 0x00;
323 let Inst{25-21} = rd;
324 let Inst{20-16} = rt;
325 let Inst{15-6} = funct;
326 let Inst{5-0} = 0x3c;
329 class EXT_FM_MM<bits<6> funct> : MMArch {
337 let Inst{31-26} = 0x00;
338 let Inst{25-21} = rt;
339 let Inst{20-16} = rs;
340 let Inst{15-11} = size;
341 let Inst{10-6} = pos;
342 let Inst{5-0} = funct;
345 class J_FM_MM<bits<6> op> : MMArch {
350 let Inst{31-26} = op;
351 let Inst{25-0} = target;
354 class JR_FM_MM<bits<8> funct> : MMArch {
359 let Inst{31-21} = 0x00;
360 let Inst{20-16} = rs;
361 let Inst{15-14} = 0x0;
362 let Inst{13-6} = funct;
363 let Inst{5-0} = 0x3c;
366 class JALR_FM_MM<bits<10> funct> {
372 let Inst{31-26} = 0x00;
373 let Inst{25-21} = rd;
374 let Inst{20-16} = rs;
375 let Inst{15-6} = funct;
376 let Inst{5-0} = 0x3c;
379 class BEQ_FM_MM<bits<6> op> : MMArch {
386 let Inst{31-26} = op;
387 let Inst{25-21} = rt;
388 let Inst{20-16} = rs;
389 let Inst{15-0} = offset;
392 class BGEZ_FM_MM<bits<5> funct> : MMArch {
398 let Inst{31-26} = 0x10;
399 let Inst{25-21} = funct;
400 let Inst{20-16} = rs;
401 let Inst{15-0} = offset;
404 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
410 let Inst{31-26} = 0x10;
411 let Inst{25-21} = funct;
412 let Inst{20-16} = rs;
413 let Inst{15-0} = offset;
416 class SYNC_FM_MM : MMArch {
421 let Inst{31-26} = 0x00;
422 let Inst{25-21} = 0x0;
423 let Inst{20-16} = stype;
424 let Inst{15-6} = 0x1ad;
425 let Inst{5-0} = 0x3c;
428 class BRK_FM_MM : MMArch {
432 let Inst{31-26} = 0x0;
433 let Inst{25-16} = code_1;
434 let Inst{15-6} = code_2;
435 let Inst{5-0} = 0x07;
438 class SYS_FM_MM : MMArch {
441 let Inst{31-26} = 0x0;
442 let Inst{25-16} = code_;
443 let Inst{15-6} = 0x22d;
444 let Inst{5-0} = 0x3c;
451 let Inst{31-26} = 0x00;
452 let Inst{25-16} = code_;
453 let Inst{15-6} = 0x24d;
454 let Inst{5-0} = 0x3c;
457 class ER_FM_MM<bits<10> funct> : MMArch {
460 let Inst{31-26} = 0x00;
461 let Inst{25-16} = 0x00;
462 let Inst{15-6} = funct;
463 let Inst{5-0} = 0x3c;
466 class EI_FM_MM<bits<10> funct> : MMArch {
470 let Inst{31-26} = 0x00;
471 let Inst{25-21} = 0x00;
472 let Inst{20-16} = rt;
473 let Inst{15-6} = funct;
474 let Inst{5-0} = 0x3c;
477 class TEQ_FM_MM<bits<6> funct> : MMArch {
484 let Inst{31-26} = 0x00;
485 let Inst{25-21} = rt;
486 let Inst{20-16} = rs;
487 let Inst{15-12} = code_;
488 let Inst{11-6} = funct;
489 let Inst{5-0} = 0x3c;
492 class TEQI_FM_MM<bits<5> funct> : MMArch {
498 let Inst{31-26} = 0x10;
499 let Inst{25-21} = funct;
500 let Inst{20-16} = rs;
501 let Inst{15-0} = imm16;
504 class LL_FM_MM<bits<4> funct> {
510 let Inst{31-26} = 0x18;
511 let Inst{25-21} = rt;
512 let Inst{20-16} = addr{20-16};
513 let Inst{15-12} = funct;
514 let Inst{11-0} = addr{11-0};
517 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
524 let Inst{31-26} = 0x15;
525 let Inst{25-21} = ft;
526 let Inst{20-16} = fs;
527 let Inst{15-11} = fd;
530 let Inst{7-0} = funct;
532 list<dag> Pattern = [];
535 class LWXC1_FM_MM<bits<9> funct> : MMArch {
542 let Inst{31-26} = 0x15;
543 let Inst{25-21} = index;
544 let Inst{20-16} = base;
545 let Inst{15-11} = fd;
546 let Inst{10-9} = 0x0;
547 let Inst{8-0} = funct;
550 class SWXC1_FM_MM<bits<9> funct> : MMArch {
557 let Inst{31-26} = 0x15;
558 let Inst{25-21} = index;
559 let Inst{20-16} = base;
560 let Inst{15-11} = fs;
561 let Inst{10-9} = 0x0;
562 let Inst{8-0} = funct;
565 class CEQS_FM_MM<bits<2> fmt> : MMArch {
572 let Inst{31-26} = 0x15;
573 let Inst{25-21} = ft;
574 let Inst{20-16} = fs;
575 let Inst{15-13} = 0x0; // cc
577 let Inst{11-10} = fmt;
578 let Inst{9-6} = cond;
579 let Inst{5-0} = 0x3c;
582 class BC1F_FM_MM<bits<5> tf> : MMArch {
587 let Inst{31-26} = 0x10;
588 let Inst{25-21} = tf;
589 let Inst{20-18} = 0x0; // cc
590 let Inst{17-16} = 0x0;
591 let Inst{15-0} = offset;
594 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
600 let Inst{31-26} = 0x15;
601 let Inst{25-21} = fd;
602 let Inst{20-16} = fs;
605 let Inst{13-6} = funct;
606 let Inst{5-0} = 0x3b;
609 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
615 let Inst{31-26} = 0x15;
616 let Inst{25-21} = fd;
617 let Inst{20-16} = fs;
619 let Inst{14-13} = fmt;
620 let Inst{12-6} = funct;
621 let Inst{5-0} = 0x3b;
624 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
630 let Inst{31-26} = 0x15;
631 let Inst{25-21} = fd;
632 let Inst{20-16} = fs;
633 let Inst{15-13} = 0x0; //cc
634 let Inst{12-11} = 0x0;
635 let Inst{10-9} = fmt;
636 let Inst{8-0} = func;
639 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
646 let Inst{31-26} = 0x15;
647 let Inst{25-21} = rt;
648 let Inst{20-16} = fs;
649 let Inst{15-11} = fd;
651 let Inst{7-0} = funct;
654 class MFC1_FM_MM<bits<8> funct> : MMArch {
660 let Inst{31-26} = 0x15;
661 let Inst{25-21} = rt;
662 let Inst{20-16} = fs;
663 let Inst{15-14} = 0x0;
664 let Inst{13-6} = funct;
665 let Inst{5-0} = 0x3b;
668 class MADDS_FM_MM<bits<6> funct>: MMArch {
676 let Inst{31-26} = 0x15;
677 let Inst{25-21} = ft;
678 let Inst{20-16} = fs;
679 let Inst{15-11} = fd;
681 let Inst{5-0} = funct;
684 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
690 let Inst{31-26} = 0x10;
691 let Inst{25-21} = funct;
692 let Inst{20-16} = rs;
693 let Inst{15-0} = offset;
696 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
699 let Inst{31-26} = 0x0;
700 let Inst{25-16} = 0x0;
702 let Inst{5-0} = 0x3c;