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 LOGIC_FM_MM16<bits<4> funct> {
50 let Inst{15-10} = 0x11;
51 let Inst{9-6} = funct;
56 class ADDIUS5_FM_MM16 {
62 let Inst{15-10} = 0x13;
68 class ADDIUSP_FM_MM16 {
73 let Inst{15-10} = 0x13;
78 class MOVE_FM_MM16<bits<6> funct> {
84 let Inst{15-10} = funct;
89 class JALR_FM_MM16<bits<5> op> {
94 let Inst{15-10} = 0x11;
99 class MFHILO_FM_MM16<bits<5> funct> {
104 let Inst{15-10} = 0x11;
105 let Inst{9-5} = funct;
109 class JRADDIUSP_FM_MM16<bits<5> op> {
115 let Inst{15-10} = 0x11;
120 //===----------------------------------------------------------------------===//
121 // MicroMIPS 32-bit Instruction Formats
122 //===----------------------------------------------------------------------===//
125 string Arch = "micromips";
126 list<dag> Pattern = [];
129 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
136 let Inst{31-26} = op;
137 let Inst{25-21} = rt;
138 let Inst{20-16} = rs;
139 let Inst{15-11} = rd;
141 let Inst{9-0} = funct;
144 class ADDI_FM_MM<bits<6> op> : MMArch {
151 let Inst{31-26} = op;
152 let Inst{25-21} = rt;
153 let Inst{20-16} = rs;
154 let Inst{15-0} = imm16;
157 class SLTI_FM_MM<bits<6> op> : MMArch {
164 let Inst{31-26} = op;
165 let Inst{25-21} = rt;
166 let Inst{20-16} = rs;
167 let Inst{15-0} = imm16;
170 class LUI_FM_MM : MMArch {
176 let Inst{31-26} = 0x10;
177 let Inst{25-21} = 0xd;
178 let Inst{20-16} = rt;
179 let Inst{15-0} = imm16;
182 class MULT_FM_MM<bits<10> funct> : MMArch {
188 let Inst{31-26} = 0x00;
189 let Inst{25-21} = rt;
190 let Inst{20-16} = rs;
191 let Inst{15-6} = funct;
192 let Inst{5-0} = 0x3c;
195 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
203 let Inst{25-21} = rd;
204 let Inst{20-16} = rt;
205 let Inst{15-11} = shamt;
206 let Inst{10} = rotate;
207 let Inst{9-0} = funct;
210 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
218 let Inst{25-21} = rt;
219 let Inst{20-16} = rs;
220 let Inst{15-11} = rd;
221 let Inst{10} = rotate;
222 let Inst{9-0} = funct;
225 class LW_FM_MM<bits<6> op> : MMArch {
231 let Inst{31-26} = op;
232 let Inst{25-21} = rt;
233 let Inst{20-16} = addr{20-16};
234 let Inst{15-0} = addr{15-0};
237 class LWL_FM_MM<bits<4> funct> {
243 let Inst{31-26} = 0x18;
244 let Inst{25-21} = rt;
245 let Inst{20-16} = addr{20-16};
246 let Inst{15-12} = funct;
247 let Inst{11-0} = addr{11-0};
250 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
257 let Inst{31-26} = 0x15;
258 let Inst{25-21} = rd;
259 let Inst{20-16} = rs;
260 let Inst{15-13} = fcc;
261 let Inst{12-6} = func;
262 let Inst{5-0} = 0x3b;
265 class MTLO_FM_MM<bits<10> funct> : MMArch {
270 let Inst{31-26} = 0x00;
271 let Inst{25-21} = 0x00;
272 let Inst{20-16} = rs;
273 let Inst{15-6} = funct;
274 let Inst{5-0} = 0x3c;
277 class MFLO_FM_MM<bits<10> funct> : MMArch {
282 let Inst{31-26} = 0x00;
283 let Inst{25-21} = 0x00;
284 let Inst{20-16} = rd;
285 let Inst{15-6} = funct;
286 let Inst{5-0} = 0x3c;
289 class CLO_FM_MM<bits<10> funct> : MMArch {
295 let Inst{31-26} = 0x00;
296 let Inst{25-21} = rd;
297 let Inst{20-16} = rs;
298 let Inst{15-6} = funct;
299 let Inst{5-0} = 0x3c;
302 class SEB_FM_MM<bits<10> funct> : MMArch {
308 let Inst{31-26} = 0x00;
309 let Inst{25-21} = rd;
310 let Inst{20-16} = rt;
311 let Inst{15-6} = funct;
312 let Inst{5-0} = 0x3c;
315 class EXT_FM_MM<bits<6> funct> : MMArch {
323 let Inst{31-26} = 0x00;
324 let Inst{25-21} = rt;
325 let Inst{20-16} = rs;
326 let Inst{15-11} = size;
327 let Inst{10-6} = pos;
328 let Inst{5-0} = funct;
331 class J_FM_MM<bits<6> op> : MMArch {
336 let Inst{31-26} = op;
337 let Inst{25-0} = target;
340 class JR_FM_MM<bits<8> funct> : MMArch {
345 let Inst{31-21} = 0x00;
346 let Inst{20-16} = rs;
347 let Inst{15-14} = 0x0;
348 let Inst{13-6} = funct;
349 let Inst{5-0} = 0x3c;
352 class JALR_FM_MM<bits<10> funct> {
358 let Inst{31-26} = 0x00;
359 let Inst{25-21} = rd;
360 let Inst{20-16} = rs;
361 let Inst{15-6} = funct;
362 let Inst{5-0} = 0x3c;
365 class BEQ_FM_MM<bits<6> op> : MMArch {
372 let Inst{31-26} = op;
373 let Inst{25-21} = rt;
374 let Inst{20-16} = rs;
375 let Inst{15-0} = offset;
378 class BGEZ_FM_MM<bits<5> funct> : MMArch {
384 let Inst{31-26} = 0x10;
385 let Inst{25-21} = funct;
386 let Inst{20-16} = rs;
387 let Inst{15-0} = offset;
390 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
396 let Inst{31-26} = 0x10;
397 let Inst{25-21} = funct;
398 let Inst{20-16} = rs;
399 let Inst{15-0} = offset;
402 class SYNC_FM_MM : MMArch {
407 let Inst{31-26} = 0x00;
408 let Inst{25-21} = 0x0;
409 let Inst{20-16} = stype;
410 let Inst{15-6} = 0x1ad;
411 let Inst{5-0} = 0x3c;
414 class BRK_FM_MM : MMArch {
418 let Inst{31-26} = 0x0;
419 let Inst{25-16} = code_1;
420 let Inst{15-6} = code_2;
421 let Inst{5-0} = 0x07;
424 class SYS_FM_MM : MMArch {
427 let Inst{31-26} = 0x0;
428 let Inst{25-16} = code_;
429 let Inst{15-6} = 0x22d;
430 let Inst{5-0} = 0x3c;
437 let Inst{31-26} = 0x00;
438 let Inst{25-16} = code_;
439 let Inst{15-6} = 0x24d;
440 let Inst{5-0} = 0x3c;
443 class ER_FM_MM<bits<10> funct> : MMArch {
446 let Inst{31-26} = 0x00;
447 let Inst{25-16} = 0x00;
448 let Inst{15-6} = funct;
449 let Inst{5-0} = 0x3c;
452 class EI_FM_MM<bits<10> funct> : MMArch {
456 let Inst{31-26} = 0x00;
457 let Inst{25-21} = 0x00;
458 let Inst{20-16} = rt;
459 let Inst{15-6} = funct;
460 let Inst{5-0} = 0x3c;
463 class TEQ_FM_MM<bits<6> funct> : MMArch {
470 let Inst{31-26} = 0x00;
471 let Inst{25-21} = rt;
472 let Inst{20-16} = rs;
473 let Inst{15-12} = code_;
474 let Inst{11-6} = funct;
475 let Inst{5-0} = 0x3c;
478 class TEQI_FM_MM<bits<5> funct> : MMArch {
484 let Inst{31-26} = 0x10;
485 let Inst{25-21} = funct;
486 let Inst{20-16} = rs;
487 let Inst{15-0} = imm16;
490 class LL_FM_MM<bits<4> funct> {
496 let Inst{31-26} = 0x18;
497 let Inst{25-21} = rt;
498 let Inst{20-16} = addr{20-16};
499 let Inst{15-12} = funct;
500 let Inst{11-0} = addr{11-0};
503 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
510 let Inst{31-26} = 0x15;
511 let Inst{25-21} = ft;
512 let Inst{20-16} = fs;
513 let Inst{15-11} = fd;
516 let Inst{7-0} = funct;
518 list<dag> Pattern = [];
521 class LWXC1_FM_MM<bits<9> funct> : MMArch {
528 let Inst{31-26} = 0x15;
529 let Inst{25-21} = index;
530 let Inst{20-16} = base;
531 let Inst{15-11} = fd;
532 let Inst{10-9} = 0x0;
533 let Inst{8-0} = funct;
536 class SWXC1_FM_MM<bits<9> funct> : MMArch {
543 let Inst{31-26} = 0x15;
544 let Inst{25-21} = index;
545 let Inst{20-16} = base;
546 let Inst{15-11} = fs;
547 let Inst{10-9} = 0x0;
548 let Inst{8-0} = funct;
551 class CEQS_FM_MM<bits<2> fmt> : MMArch {
558 let Inst{31-26} = 0x15;
559 let Inst{25-21} = ft;
560 let Inst{20-16} = fs;
561 let Inst{15-13} = 0x0; // cc
563 let Inst{11-10} = fmt;
564 let Inst{9-6} = cond;
565 let Inst{5-0} = 0x3c;
568 class BC1F_FM_MM<bits<5> tf> : MMArch {
573 let Inst{31-26} = 0x10;
574 let Inst{25-21} = tf;
575 let Inst{20-18} = 0x0; // cc
576 let Inst{17-16} = 0x0;
577 let Inst{15-0} = offset;
580 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
586 let Inst{31-26} = 0x15;
587 let Inst{25-21} = fd;
588 let Inst{20-16} = fs;
591 let Inst{13-6} = funct;
592 let Inst{5-0} = 0x3b;
595 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
601 let Inst{31-26} = 0x15;
602 let Inst{25-21} = fd;
603 let Inst{20-16} = fs;
605 let Inst{14-13} = fmt;
606 let Inst{12-6} = funct;
607 let Inst{5-0} = 0x3b;
610 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
616 let Inst{31-26} = 0x15;
617 let Inst{25-21} = fd;
618 let Inst{20-16} = fs;
619 let Inst{15-13} = 0x0; //cc
620 let Inst{12-11} = 0x0;
621 let Inst{10-9} = fmt;
622 let Inst{8-0} = func;
625 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
632 let Inst{31-26} = 0x15;
633 let Inst{25-21} = rt;
634 let Inst{20-16} = fs;
635 let Inst{15-11} = fd;
637 let Inst{7-0} = funct;
640 class MFC1_FM_MM<bits<8> funct> : MMArch {
646 let Inst{31-26} = 0x15;
647 let Inst{25-21} = rt;
648 let Inst{20-16} = fs;
649 let Inst{15-14} = 0x0;
650 let Inst{13-6} = funct;
651 let Inst{5-0} = 0x3b;
654 class MADDS_FM_MM<bits<6> funct>: MMArch {
662 let Inst{31-26} = 0x15;
663 let Inst{25-21} = ft;
664 let Inst{20-16} = fs;
665 let Inst{15-11} = fd;
667 let Inst{5-0} = funct;
670 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
676 let Inst{31-26} = 0x10;
677 let Inst{25-21} = funct;
678 let Inst{20-16} = rs;
679 let Inst{15-0} = offset;
682 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
685 let Inst{31-26} = 0x0;
686 let Inst{25-16} = 0x0;
688 let Inst{5-0} = 0x3c;