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 ADDIUS5_FM_MM16 {
50 let Inst{15-10} = 0x13;
56 class MOVE_FM_MM16<bits<6> funct> {
62 let Inst{15-10} = funct;
67 class JALR_FM_MM16<bits<5> op> {
72 let Inst{15-10} = 0x11;
77 class MFHILO_FM_MM16<bits<5> funct> {
82 let Inst{15-10} = 0x11;
83 let Inst{9-5} = funct;
87 class JRADDIUSP_FM_MM16<bits<5> op> {
93 let Inst{15-10} = 0x11;
98 //===----------------------------------------------------------------------===//
99 // MicroMIPS 32-bit Instruction Formats
100 //===----------------------------------------------------------------------===//
103 string Arch = "micromips";
104 list<dag> Pattern = [];
107 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
114 let Inst{31-26} = op;
115 let Inst{25-21} = rt;
116 let Inst{20-16} = rs;
117 let Inst{15-11} = rd;
119 let Inst{9-0} = funct;
122 class ADDI_FM_MM<bits<6> op> : MMArch {
129 let Inst{31-26} = op;
130 let Inst{25-21} = rt;
131 let Inst{20-16} = rs;
132 let Inst{15-0} = imm16;
135 class SLTI_FM_MM<bits<6> op> : MMArch {
142 let Inst{31-26} = op;
143 let Inst{25-21} = rt;
144 let Inst{20-16} = rs;
145 let Inst{15-0} = imm16;
148 class LUI_FM_MM : MMArch {
154 let Inst{31-26} = 0x10;
155 let Inst{25-21} = 0xd;
156 let Inst{20-16} = rt;
157 let Inst{15-0} = imm16;
160 class MULT_FM_MM<bits<10> funct> : MMArch {
166 let Inst{31-26} = 0x00;
167 let Inst{25-21} = rt;
168 let Inst{20-16} = rs;
169 let Inst{15-6} = funct;
170 let Inst{5-0} = 0x3c;
173 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
181 let Inst{25-21} = rd;
182 let Inst{20-16} = rt;
183 let Inst{15-11} = shamt;
184 let Inst{10} = rotate;
185 let Inst{9-0} = funct;
188 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
196 let Inst{25-21} = rt;
197 let Inst{20-16} = rs;
198 let Inst{15-11} = rd;
199 let Inst{10} = rotate;
200 let Inst{9-0} = funct;
203 class LW_FM_MM<bits<6> op> : MMArch {
209 let Inst{31-26} = op;
210 let Inst{25-21} = rt;
211 let Inst{20-16} = addr{20-16};
212 let Inst{15-0} = addr{15-0};
215 class LWL_FM_MM<bits<4> funct> {
221 let Inst{31-26} = 0x18;
222 let Inst{25-21} = rt;
223 let Inst{20-16} = addr{20-16};
224 let Inst{15-12} = funct;
225 let Inst{11-0} = addr{11-0};
228 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
235 let Inst{31-26} = 0x15;
236 let Inst{25-21} = rd;
237 let Inst{20-16} = rs;
238 let Inst{15-13} = fcc;
239 let Inst{12-6} = func;
240 let Inst{5-0} = 0x3b;
243 class MTLO_FM_MM<bits<10> funct> : MMArch {
248 let Inst{31-26} = 0x00;
249 let Inst{25-21} = 0x00;
250 let Inst{20-16} = rs;
251 let Inst{15-6} = funct;
252 let Inst{5-0} = 0x3c;
255 class MFLO_FM_MM<bits<10> funct> : MMArch {
260 let Inst{31-26} = 0x00;
261 let Inst{25-21} = 0x00;
262 let Inst{20-16} = rd;
263 let Inst{15-6} = funct;
264 let Inst{5-0} = 0x3c;
267 class CLO_FM_MM<bits<10> funct> : MMArch {
273 let Inst{31-26} = 0x00;
274 let Inst{25-21} = rd;
275 let Inst{20-16} = rs;
276 let Inst{15-6} = funct;
277 let Inst{5-0} = 0x3c;
280 class SEB_FM_MM<bits<10> funct> : MMArch {
286 let Inst{31-26} = 0x00;
287 let Inst{25-21} = rd;
288 let Inst{20-16} = rt;
289 let Inst{15-6} = funct;
290 let Inst{5-0} = 0x3c;
293 class EXT_FM_MM<bits<6> funct> : MMArch {
301 let Inst{31-26} = 0x00;
302 let Inst{25-21} = rt;
303 let Inst{20-16} = rs;
304 let Inst{15-11} = size;
305 let Inst{10-6} = pos;
306 let Inst{5-0} = funct;
309 class J_FM_MM<bits<6> op> : MMArch {
314 let Inst{31-26} = op;
315 let Inst{25-0} = target;
318 class JR_FM_MM<bits<8> funct> : MMArch {
323 let Inst{31-21} = 0x00;
324 let Inst{20-16} = rs;
325 let Inst{15-14} = 0x0;
326 let Inst{13-6} = funct;
327 let Inst{5-0} = 0x3c;
330 class JALR_FM_MM<bits<10> funct> {
336 let Inst{31-26} = 0x00;
337 let Inst{25-21} = rd;
338 let Inst{20-16} = rs;
339 let Inst{15-6} = funct;
340 let Inst{5-0} = 0x3c;
343 class BEQ_FM_MM<bits<6> op> : MMArch {
350 let Inst{31-26} = op;
351 let Inst{25-21} = rt;
352 let Inst{20-16} = rs;
353 let Inst{15-0} = offset;
356 class BGEZ_FM_MM<bits<5> funct> : MMArch {
362 let Inst{31-26} = 0x10;
363 let Inst{25-21} = funct;
364 let Inst{20-16} = rs;
365 let Inst{15-0} = offset;
368 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
374 let Inst{31-26} = 0x10;
375 let Inst{25-21} = funct;
376 let Inst{20-16} = rs;
377 let Inst{15-0} = offset;
380 class SYNC_FM_MM : MMArch {
385 let Inst{31-26} = 0x00;
386 let Inst{25-21} = 0x0;
387 let Inst{20-16} = stype;
388 let Inst{15-6} = 0x1ad;
389 let Inst{5-0} = 0x3c;
392 class BRK_FM_MM : MMArch {
396 let Inst{31-26} = 0x0;
397 let Inst{25-16} = code_1;
398 let Inst{15-6} = code_2;
399 let Inst{5-0} = 0x07;
402 class SYS_FM_MM : MMArch {
405 let Inst{31-26} = 0x0;
406 let Inst{25-16} = code_;
407 let Inst{15-6} = 0x22d;
408 let Inst{5-0} = 0x3c;
415 let Inst{31-26} = 0x00;
416 let Inst{25-16} = code_;
417 let Inst{15-6} = 0x24d;
418 let Inst{5-0} = 0x3c;
421 class ER_FM_MM<bits<10> funct> : MMArch {
424 let Inst{31-26} = 0x00;
425 let Inst{25-16} = 0x00;
426 let Inst{15-6} = funct;
427 let Inst{5-0} = 0x3c;
430 class EI_FM_MM<bits<10> funct> : MMArch {
434 let Inst{31-26} = 0x00;
435 let Inst{25-21} = 0x00;
436 let Inst{20-16} = rt;
437 let Inst{15-6} = funct;
438 let Inst{5-0} = 0x3c;
441 class TEQ_FM_MM<bits<6> funct> : MMArch {
448 let Inst{31-26} = 0x00;
449 let Inst{25-21} = rt;
450 let Inst{20-16} = rs;
451 let Inst{15-12} = code_;
452 let Inst{11-6} = funct;
453 let Inst{5-0} = 0x3c;
456 class TEQI_FM_MM<bits<5> funct> : MMArch {
462 let Inst{31-26} = 0x10;
463 let Inst{25-21} = funct;
464 let Inst{20-16} = rs;
465 let Inst{15-0} = imm16;
468 class LL_FM_MM<bits<4> funct> {
474 let Inst{31-26} = 0x18;
475 let Inst{25-21} = rt;
476 let Inst{20-16} = addr{20-16};
477 let Inst{15-12} = funct;
478 let Inst{11-0} = addr{11-0};
481 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
488 let Inst{31-26} = 0x15;
489 let Inst{25-21} = ft;
490 let Inst{20-16} = fs;
491 let Inst{15-11} = fd;
494 let Inst{7-0} = funct;
496 list<dag> Pattern = [];
499 class LWXC1_FM_MM<bits<9> funct> : MMArch {
506 let Inst{31-26} = 0x15;
507 let Inst{25-21} = index;
508 let Inst{20-16} = base;
509 let Inst{15-11} = fd;
510 let Inst{10-9} = 0x0;
511 let Inst{8-0} = funct;
514 class SWXC1_FM_MM<bits<9> funct> : MMArch {
521 let Inst{31-26} = 0x15;
522 let Inst{25-21} = index;
523 let Inst{20-16} = base;
524 let Inst{15-11} = fs;
525 let Inst{10-9} = 0x0;
526 let Inst{8-0} = funct;
529 class CEQS_FM_MM<bits<2> fmt> : MMArch {
536 let Inst{31-26} = 0x15;
537 let Inst{25-21} = ft;
538 let Inst{20-16} = fs;
539 let Inst{15-13} = 0x0; // cc
541 let Inst{11-10} = fmt;
542 let Inst{9-6} = cond;
543 let Inst{5-0} = 0x3c;
546 class BC1F_FM_MM<bits<5> tf> : MMArch {
551 let Inst{31-26} = 0x10;
552 let Inst{25-21} = tf;
553 let Inst{20-18} = 0x0; // cc
554 let Inst{17-16} = 0x0;
555 let Inst{15-0} = offset;
558 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
564 let Inst{31-26} = 0x15;
565 let Inst{25-21} = fd;
566 let Inst{20-16} = fs;
569 let Inst{13-6} = funct;
570 let Inst{5-0} = 0x3b;
573 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
579 let Inst{31-26} = 0x15;
580 let Inst{25-21} = fd;
581 let Inst{20-16} = fs;
583 let Inst{14-13} = fmt;
584 let Inst{12-6} = funct;
585 let Inst{5-0} = 0x3b;
588 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
594 let Inst{31-26} = 0x15;
595 let Inst{25-21} = fd;
596 let Inst{20-16} = fs;
597 let Inst{15-13} = 0x0; //cc
598 let Inst{12-11} = 0x0;
599 let Inst{10-9} = fmt;
600 let Inst{8-0} = func;
603 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
610 let Inst{31-26} = 0x15;
611 let Inst{25-21} = rt;
612 let Inst{20-16} = fs;
613 let Inst{15-11} = fd;
615 let Inst{7-0} = funct;
618 class MFC1_FM_MM<bits<8> funct> : MMArch {
624 let Inst{31-26} = 0x15;
625 let Inst{25-21} = rt;
626 let Inst{20-16} = fs;
627 let Inst{15-14} = 0x0;
628 let Inst{13-6} = funct;
629 let Inst{5-0} = 0x3b;
632 class MADDS_FM_MM<bits<6> funct>: MMArch {
640 let Inst{31-26} = 0x15;
641 let Inst{25-21} = ft;
642 let Inst{20-16} = fs;
643 let Inst{15-11} = fd;
645 let Inst{5-0} = funct;
648 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
654 let Inst{31-26} = 0x10;
655 let Inst{25-21} = funct;
656 let Inst{20-16} = rs;
657 let Inst{15-0} = offset;
660 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
663 let Inst{31-26} = 0x0;
664 let Inst{25-16} = 0x0;
666 let Inst{5-0} = 0x3c;