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 //===----------------------------------------------------------------------===//
66 // MicroMIPS 32-bit Instruction Formats
67 //===----------------------------------------------------------------------===//
70 string Arch = "micromips";
71 list<dag> Pattern = [];
74 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
86 let Inst{9-0} = funct;
89 class ADDI_FM_MM<bits<6> op> : MMArch {
99 let Inst{15-0} = imm16;
102 class SLTI_FM_MM<bits<6> op> : MMArch {
109 let Inst{31-26} = op;
110 let Inst{25-21} = rt;
111 let Inst{20-16} = rs;
112 let Inst{15-0} = imm16;
115 class LUI_FM_MM : MMArch {
121 let Inst{31-26} = 0x10;
122 let Inst{25-21} = 0xd;
123 let Inst{20-16} = rt;
124 let Inst{15-0} = imm16;
127 class MULT_FM_MM<bits<10> funct> : MMArch {
133 let Inst{31-26} = 0x00;
134 let Inst{25-21} = rt;
135 let Inst{20-16} = rs;
136 let Inst{15-6} = funct;
137 let Inst{5-0} = 0x3c;
140 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
148 let Inst{25-21} = rd;
149 let Inst{20-16} = rt;
150 let Inst{15-11} = shamt;
151 let Inst{10} = rotate;
152 let Inst{9-0} = funct;
155 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
163 let Inst{25-21} = rt;
164 let Inst{20-16} = rs;
165 let Inst{15-11} = rd;
166 let Inst{10} = rotate;
167 let Inst{9-0} = funct;
170 class LW_FM_MM<bits<6> op> : MMArch {
176 let Inst{31-26} = op;
177 let Inst{25-21} = rt;
178 let Inst{20-16} = addr{20-16};
179 let Inst{15-0} = addr{15-0};
182 class LWL_FM_MM<bits<4> funct> {
188 let Inst{31-26} = 0x18;
189 let Inst{25-21} = rt;
190 let Inst{20-16} = addr{20-16};
191 let Inst{15-12} = funct;
192 let Inst{11-0} = addr{11-0};
195 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
202 let Inst{31-26} = 0x15;
203 let Inst{25-21} = rd;
204 let Inst{20-16} = rs;
205 let Inst{15-13} = fcc;
206 let Inst{12-6} = func;
207 let Inst{5-0} = 0x3b;
210 class MTLO_FM_MM<bits<10> funct> : MMArch {
215 let Inst{31-26} = 0x00;
216 let Inst{25-21} = 0x00;
217 let Inst{20-16} = rs;
218 let Inst{15-6} = funct;
219 let Inst{5-0} = 0x3c;
222 class MFLO_FM_MM<bits<10> funct> : MMArch {
227 let Inst{31-26} = 0x00;
228 let Inst{25-21} = 0x00;
229 let Inst{20-16} = rd;
230 let Inst{15-6} = funct;
231 let Inst{5-0} = 0x3c;
234 class CLO_FM_MM<bits<10> funct> : MMArch {
240 let Inst{31-26} = 0x00;
241 let Inst{25-21} = rd;
242 let Inst{20-16} = rs;
243 let Inst{15-6} = funct;
244 let Inst{5-0} = 0x3c;
247 class SEB_FM_MM<bits<10> funct> : MMArch {
253 let Inst{31-26} = 0x00;
254 let Inst{25-21} = rd;
255 let Inst{20-16} = rt;
256 let Inst{15-6} = funct;
257 let Inst{5-0} = 0x3c;
260 class EXT_FM_MM<bits<6> funct> : MMArch {
268 let Inst{31-26} = 0x00;
269 let Inst{25-21} = rt;
270 let Inst{20-16} = rs;
271 let Inst{15-11} = size;
272 let Inst{10-6} = pos;
273 let Inst{5-0} = funct;
276 class J_FM_MM<bits<6> op> : MMArch {
281 let Inst{31-26} = op;
282 let Inst{25-0} = target;
285 class JR_FM_MM<bits<8> funct> : MMArch {
290 let Inst{31-21} = 0x00;
291 let Inst{20-16} = rs;
292 let Inst{15-14} = 0x0;
293 let Inst{13-6} = funct;
294 let Inst{5-0} = 0x3c;
297 class JALR_FM_MM<bits<10> funct> {
303 let Inst{31-26} = 0x00;
304 let Inst{25-21} = rd;
305 let Inst{20-16} = rs;
306 let Inst{15-6} = funct;
307 let Inst{5-0} = 0x3c;
310 class BEQ_FM_MM<bits<6> op> : MMArch {
317 let Inst{31-26} = op;
318 let Inst{25-21} = rt;
319 let Inst{20-16} = rs;
320 let Inst{15-0} = offset;
323 class BGEZ_FM_MM<bits<5> funct> : MMArch {
329 let Inst{31-26} = 0x10;
330 let Inst{25-21} = funct;
331 let Inst{20-16} = rs;
332 let Inst{15-0} = offset;
335 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
341 let Inst{31-26} = 0x10;
342 let Inst{25-21} = funct;
343 let Inst{20-16} = rs;
344 let Inst{15-0} = offset;
347 class SYNC_FM_MM : MMArch {
352 let Inst{31-26} = 0x00;
353 let Inst{25-21} = 0x0;
354 let Inst{20-16} = stype;
355 let Inst{15-6} = 0x1ad;
356 let Inst{5-0} = 0x3c;
359 class BRK_FM_MM : MMArch {
363 let Inst{31-26} = 0x0;
364 let Inst{25-16} = code_1;
365 let Inst{15-6} = code_2;
366 let Inst{5-0} = 0x07;
369 class SYS_FM_MM : MMArch {
372 let Inst{31-26} = 0x0;
373 let Inst{25-16} = code_;
374 let Inst{15-6} = 0x22d;
375 let Inst{5-0} = 0x3c;
382 let Inst{31-26} = 0x00;
383 let Inst{25-16} = code_;
384 let Inst{15-6} = 0x24d;
385 let Inst{5-0} = 0x3c;
388 class ER_FM_MM<bits<10> funct> : MMArch {
391 let Inst{31-26} = 0x00;
392 let Inst{25-16} = 0x00;
393 let Inst{15-6} = funct;
394 let Inst{5-0} = 0x3c;
397 class EI_FM_MM<bits<10> funct> : MMArch {
401 let Inst{31-26} = 0x00;
402 let Inst{25-21} = 0x00;
403 let Inst{20-16} = rt;
404 let Inst{15-6} = funct;
405 let Inst{5-0} = 0x3c;
408 class TEQ_FM_MM<bits<6> funct> : MMArch {
415 let Inst{31-26} = 0x00;
416 let Inst{25-21} = rt;
417 let Inst{20-16} = rs;
418 let Inst{15-12} = code_;
419 let Inst{11-6} = funct;
420 let Inst{5-0} = 0x3c;
423 class TEQI_FM_MM<bits<5> funct> : MMArch {
429 let Inst{31-26} = 0x10;
430 let Inst{25-21} = funct;
431 let Inst{20-16} = rs;
432 let Inst{15-0} = imm16;
435 class LL_FM_MM<bits<4> funct> {
441 let Inst{31-26} = 0x18;
442 let Inst{25-21} = rt;
443 let Inst{20-16} = addr{20-16};
444 let Inst{15-12} = funct;
445 let Inst{11-0} = addr{11-0};
448 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
455 let Inst{31-26} = 0x15;
456 let Inst{25-21} = ft;
457 let Inst{20-16} = fs;
458 let Inst{15-11} = fd;
461 let Inst{7-0} = funct;
463 list<dag> Pattern = [];
466 class LWXC1_FM_MM<bits<9> funct> : MMArch {
473 let Inst{31-26} = 0x15;
474 let Inst{25-21} = index;
475 let Inst{20-16} = base;
476 let Inst{15-11} = fd;
477 let Inst{10-9} = 0x0;
478 let Inst{8-0} = funct;
481 class SWXC1_FM_MM<bits<9> funct> : MMArch {
488 let Inst{31-26} = 0x15;
489 let Inst{25-21} = index;
490 let Inst{20-16} = base;
491 let Inst{15-11} = fs;
492 let Inst{10-9} = 0x0;
493 let Inst{8-0} = funct;
496 class CEQS_FM_MM<bits<2> fmt> : MMArch {
503 let Inst{31-26} = 0x15;
504 let Inst{25-21} = ft;
505 let Inst{20-16} = fs;
506 let Inst{15-13} = 0x0; // cc
508 let Inst{11-10} = fmt;
509 let Inst{9-6} = cond;
510 let Inst{5-0} = 0x3c;
513 class BC1F_FM_MM<bits<5> tf> : MMArch {
518 let Inst{31-26} = 0x10;
519 let Inst{25-21} = tf;
520 let Inst{20-18} = 0x0; // cc
521 let Inst{17-16} = 0x0;
522 let Inst{15-0} = offset;
525 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
531 let Inst{31-26} = 0x15;
532 let Inst{25-21} = fd;
533 let Inst{20-16} = fs;
536 let Inst{13-6} = funct;
537 let Inst{5-0} = 0x3b;
540 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
546 let Inst{31-26} = 0x15;
547 let Inst{25-21} = fd;
548 let Inst{20-16} = fs;
550 let Inst{14-13} = fmt;
551 let Inst{12-6} = funct;
552 let Inst{5-0} = 0x3b;
555 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
561 let Inst{31-26} = 0x15;
562 let Inst{25-21} = fd;
563 let Inst{20-16} = fs;
564 let Inst{15-13} = 0x0; //cc
565 let Inst{12-11} = 0x0;
566 let Inst{10-9} = fmt;
567 let Inst{8-0} = func;
570 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
577 let Inst{31-26} = 0x15;
578 let Inst{25-21} = rt;
579 let Inst{20-16} = fs;
580 let Inst{15-11} = fd;
582 let Inst{7-0} = funct;
585 class MFC1_FM_MM<bits<8> funct> : MMArch {
591 let Inst{31-26} = 0x15;
592 let Inst{25-21} = rt;
593 let Inst{20-16} = fs;
594 let Inst{15-14} = 0x0;
595 let Inst{13-6} = funct;
596 let Inst{5-0} = 0x3b;
599 class MADDS_FM_MM<bits<6> funct>: MMArch {
607 let Inst{31-26} = 0x15;
608 let Inst{25-21} = ft;
609 let Inst{20-16} = fs;
610 let Inst{15-11} = fd;
612 let Inst{5-0} = funct;