[mips][microMIPS] Implement TEQ, TGE, TGEU, TLT, TLTU and TNE instructions
[oota-llvm.git] / lib / Target / Mips / MicroMipsInstrFormats.td
1 //===----------------------------------------------------------------------===//
2 // MicroMIPS Base Classes
3 //===----------------------------------------------------------------------===//
4
5 //
6 // Base class for MicroMips instructions.
7 // This class does not depend on the instruction size.
8 //
9 class MicroMipsInstBase<dag outs, dag ins, string asmstr, list<dag> pattern,
10                         InstrItinClass itin, Format f> : Instruction
11 {
12   let Namespace = "Mips";
13   let DecoderNamespace = "MicroMips";
14
15   let OutOperandList = outs;
16   let InOperandList  = ins;
17
18   let AsmString   = asmstr;
19   let Pattern     = pattern;
20   let Itinerary   = itin;
21
22   let Predicates = [InMicroMips];
23
24   Format Form = f;
25 }
26
27 //
28 // Base class for MicroMIPS 16-bit instructions.
29 //
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>
33 {
34   let Size = 2;
35   field bits<16> Inst;
36   field bits<16> SoftFail = 0;
37   bits<6> Opcode = 0x0;
38 }
39
40 //===----------------------------------------------------------------------===//
41 // MicroMIPS 16-bit Instruction Formats
42 //===----------------------------------------------------------------------===//
43
44 class ARITH_FM_MM16<bit funct> {
45   bits<3> rd;
46   bits<3> rt;
47   bits<3> rs;
48
49   bits<16> Inst;
50
51   let Inst{15-10} = 0x01;
52   let Inst{9-7}   = rd;
53   let Inst{6-4}   = rt;
54   let Inst{3-1}   = rs;
55   let Inst{0}     = funct;
56 }
57
58 class ANDI_FM_MM16<bits<6> funct> {
59   bits<3> rd;
60   bits<3> rs;
61   bits<4> imm;
62
63   bits<16> Inst;
64
65   let Inst{15-10} = funct;
66   let Inst{9-7}   = rd;
67   let Inst{6-4}   = rs;
68   let Inst{3-0}   = imm;
69 }
70
71 class LOGIC_FM_MM16<bits<4> funct> {
72   bits<3> rt;
73   bits<3> rs;
74
75   bits<16> Inst;
76
77   let Inst{15-10} = 0x11;
78   let Inst{9-6}   = funct;
79   let Inst{5-3}   = rt;
80   let Inst{2-0}   = rs;
81 }
82
83 class SHIFT_FM_MM16<bits<1> funct> {
84   bits<3> rd;
85   bits<3> rt;
86   bits<3> shamt;
87
88   bits<16> Inst;
89
90   let Inst{15-10} = 0x09;
91   let Inst{9-7}   = rd;
92   let Inst{6-4}   = rt;
93   let Inst{3-1}   = shamt;
94   let Inst{0}     = funct;
95 }
96
97 class ADDIUR2_FM_MM16 {
98   bits<3> rd;
99   bits<3> rs;
100   bits<3> imm;
101
102   bits<16> Inst;
103
104   let Inst{15-10} = 0x1b;
105   let Inst{9-7}   = rd;
106   let Inst{6-4}   = rs;
107   let Inst{3-1}   = imm;
108   let Inst{0}     = 0;
109 }
110
111 class LOAD_STORE_FM_MM16<bits<6> op> {
112   bits<3> rt;
113   bits<7> addr;
114
115   bits<16> Inst;
116
117   let Inst{15-10} = op;
118   let Inst{9-7}   = rt;
119   let Inst{6-4}   = addr{6-4};
120   let Inst{3-0}   = addr{3-0};
121 }
122
123 class LOAD_STORE_SP_FM_MM16<bits<6> op> {
124   bits<5> rt;
125   bits<5> offset;
126
127   bits<16> Inst;
128
129   let Inst{15-10} = op;
130   let Inst{9-5}   = rt;
131   let Inst{4-0}   = offset;
132 }
133
134 class LOAD_GP_FM_MM16<bits<6> op> {
135   bits<3> rt;
136   bits<7> offset;
137
138   bits<16> Inst;
139
140   let Inst{15-10} = op;
141   let Inst{9-7} = rt;
142   let Inst{6-0} = offset;
143 }
144
145 class ADDIUS5_FM_MM16 {
146   bits<5> rd;
147   bits<4> imm;
148
149   bits<16> Inst;
150
151   let Inst{15-10} = 0x13;
152   let Inst{9-5}   = rd;
153   let Inst{4-1}   = imm;
154   let Inst{0}     = 0;
155 }
156
157 class ADDIUSP_FM_MM16 {
158   bits<9> imm;
159
160   bits<16> Inst;
161
162   let Inst{15-10} = 0x13;
163   let Inst{9-1}   = imm;
164   let Inst{0}     = 1;
165 }
166
167 class MOVE_FM_MM16<bits<6> funct> {
168   bits<5> rs;
169   bits<5> rd;
170
171   bits<16> Inst;
172
173   let Inst{15-10} = funct;
174   let Inst{9-5}   = rd;
175   let Inst{4-0}   = rs;
176 }
177
178 class LI_FM_MM16 {
179   bits<3> rd;
180   bits<7> imm;
181
182   bits<16> Inst;
183
184   let Inst{15-10} = 0x3b;
185   let Inst{9-7}   = rd;
186   let Inst{6-0}   = imm;
187 }
188
189 class JALR_FM_MM16<bits<5> op> {
190   bits<5> rs;
191
192   bits<16> Inst;
193
194   let Inst{15-10} = 0x11;
195   let Inst{9-5}   = op;
196   let Inst{4-0}   = rs;
197 }
198
199 class MFHILO_FM_MM16<bits<5> funct> {
200   bits<5> rd;
201
202   bits<16> Inst;
203
204   let Inst{15-10} = 0x11;
205   let Inst{9-5}   = funct;
206   let Inst{4-0}   = rd;
207 }
208
209 class JRADDIUSP_FM_MM16<bits<5> op> {
210   bits<5> rs;
211   bits<5> imm;
212
213   bits<16> Inst;
214
215   let Inst{15-10} = 0x11;
216   let Inst{9-5}   = op;
217   let Inst{4-0}   = imm;
218 }
219
220 class ADDIUR1SP_FM_MM16 {
221   bits<3> rd;
222   bits<6> imm;
223
224   bits<16> Inst;
225
226   let Inst{15-10} = 0x1b;
227   let Inst{9-7}   = rd;
228   let Inst{6-1}   = imm;
229   let Inst{0}     = 1;
230 }
231
232 class BRKSDBBP16_FM_MM<bits<6> op> {
233   bits<4> code_;
234   bits<16> Inst;
235
236   let Inst{15-10} = 0x11;
237   let Inst{9-4}   = op;
238   let Inst{3-0}   = code_;
239 }
240
241 class BEQNEZ_FM_MM16<bits<6> op> {
242   bits<3> rs;
243   bits<7> offset;
244
245   bits<16> Inst;
246
247   let Inst{15-10} = op;
248   let Inst{9-7}   = rs;
249   let Inst{6-0}   = offset;
250 }
251
252 class B16_FM {
253   bits<10> offset;
254
255   bits<16> Inst;
256
257   let Inst{15-10} = 0x33;
258   let Inst{9-0}   = offset;
259 }
260
261 class MOVEP_FM_MM16 {
262   bits<3> dst_regs;
263   bits<3> rt;
264   bits<3> rs;
265
266   bits<16> Inst;
267
268   let Inst{15-10} = 0x21;
269   let Inst{9-7}   = dst_regs;
270   let Inst{6-4}   = rt;
271   let Inst{3-1}   = rs;
272   let Inst{0}     = 0;
273 }
274
275 //===----------------------------------------------------------------------===//
276 // MicroMIPS 32-bit Instruction Formats
277 //===----------------------------------------------------------------------===//
278
279 class MMArch {
280   string Arch = "micromips";
281   list<dag> Pattern = [];
282 }
283
284 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
285   bits<5> rt;
286   bits<5> rs;
287   bits<5> rd;
288
289   bits<32> Inst;
290
291   let Inst{31-26} = op;
292   let Inst{25-21} = rt;
293   let Inst{20-16} = rs;
294   let Inst{15-11} = rd;
295   let Inst{10}    = 0;
296   let Inst{9-0}   = funct;
297 }
298
299 class ADDI_FM_MM<bits<6> op> : MMArch {
300   bits<5>  rs;
301   bits<5>  rt;
302   bits<16> imm16;
303
304   bits<32> Inst;
305
306   let Inst{31-26} = op;
307   let Inst{25-21} = rt;
308   let Inst{20-16} = rs;
309   let Inst{15-0}  = imm16;
310 }
311
312 class SLTI_FM_MM<bits<6> op> : MMArch {
313   bits<5> rt;
314   bits<5> rs;
315   bits<16> imm16;
316
317   bits<32> Inst;
318
319   let Inst{31-26} = op;
320   let Inst{25-21} = rt;
321   let Inst{20-16} = rs;
322   let Inst{15-0}  = imm16;
323 }
324
325 class LUI_FM_MM : MMArch {
326   bits<5> rt;
327   bits<16> imm16;
328
329   bits<32> Inst;
330
331   let Inst{31-26} = 0x10;
332   let Inst{25-21} = 0xd;
333   let Inst{20-16} = rt;
334   let Inst{15-0}  = imm16;
335 }
336
337 class MULT_FM_MM<bits<10> funct> : MMArch {
338   bits<5>  rs;
339   bits<5>  rt;
340
341   bits<32> Inst;
342
343   let Inst{31-26} = 0x00;
344   let Inst{25-21} = rt;
345   let Inst{20-16} = rs;
346   let Inst{15-6}  = funct;
347   let Inst{5-0}   = 0x3c;
348 }
349
350 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
351   bits<5> rd;
352   bits<5> rt;
353   bits<5> shamt;
354
355   bits<32> Inst;
356
357   let Inst{31-26} = 0;
358   let Inst{25-21} = rd;
359   let Inst{20-16} = rt;
360   let Inst{15-11} = shamt;
361   let Inst{10}    = rotate;
362   let Inst{9-0}   = funct;
363 }
364
365 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
366   bits<5> rd;
367   bits<5> rt;
368   bits<5> rs;
369
370   bits<32> Inst;
371
372   let Inst{31-26} = 0;
373   let Inst{25-21} = rt;
374   let Inst{20-16} = rs;
375   let Inst{15-11} = rd;
376   let Inst{10}    = rotate;
377   let Inst{9-0}   = funct;
378 }
379
380 class LW_FM_MM<bits<6> op> : MMArch {
381   bits<5> rt;
382   bits<21> addr;
383
384   bits<32> Inst;
385
386   let Inst{31-26} = op;
387   let Inst{25-21} = rt;
388   let Inst{20-16} = addr{20-16};
389   let Inst{15-0}  = addr{15-0};
390 }
391
392 class POOL32C_LHUE_FM_MM<bits<6> op, bits<4> fmt, bits<3> funct> : MMArch {
393   bits<5> rt;
394   bits<21> addr;
395   bits<5> base = addr{20-16};
396   bits<9> offset = addr{8-0};
397
398   bits<32> Inst;
399
400   let Inst{31-26} = op;
401   let Inst{25-21} = rt;
402   let Inst{20-16} = base;
403   let Inst{15-12} = fmt;
404   let Inst{11-9} = funct;
405   let Inst{8-0}  = offset;
406 }
407
408 class LWL_FM_MM<bits<4> funct> {
409   bits<5> rt;
410   bits<21> addr;
411
412   bits<32> Inst;
413
414   let Inst{31-26} = 0x18;
415   let Inst{25-21} = rt;
416   let Inst{20-16} = addr{20-16};
417   let Inst{15-12} = funct;
418   let Inst{11-0}  = addr{11-0};
419 }
420
421 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
422   bits<5> rd;
423   bits<5> rs;
424   bits<3> fcc;
425
426   bits<32> Inst;
427
428   let Inst{31-26} = 0x15;
429   let Inst{25-21} = rd;
430   let Inst{20-16} = rs;
431   let Inst{15-13} = fcc;
432   let Inst{12-6}  = func;
433   let Inst{5-0}   = 0x3b;
434 }
435
436 class MTLO_FM_MM<bits<10> funct> : MMArch {
437   bits<5> rs;
438
439   bits<32> Inst;
440
441   let Inst{31-26} = 0x00;
442   let Inst{25-21} = 0x00;
443   let Inst{20-16} = rs;
444   let Inst{15-6}  = funct;
445   let Inst{5-0}   = 0x3c;
446 }
447
448 class MFLO_FM_MM<bits<10> funct> : MMArch {
449   bits<5> rd;
450
451   bits<32> Inst;
452
453   let Inst{31-26} = 0x00;
454   let Inst{25-21} = 0x00;
455   let Inst{20-16} = rd;
456   let Inst{15-6}  = funct;
457   let Inst{5-0}   = 0x3c;
458 }
459
460 class CLO_FM_MM<bits<10> funct> : MMArch {
461   bits<5> rd;
462   bits<5> rs;
463
464   bits<32> Inst;
465
466   let Inst{31-26} = 0x00;
467   let Inst{25-21} = rd;
468   let Inst{20-16} = rs;
469   let Inst{15-6}  = funct;
470   let Inst{5-0}   = 0x3c;
471 }
472
473 class SEB_FM_MM<bits<10> funct> : MMArch {
474   bits<5> rd;
475   bits<5> rt;
476
477   bits<32> Inst;
478
479   let Inst{31-26} = 0x00;
480   let Inst{25-21} = rd;
481   let Inst{20-16} = rt;
482   let Inst{15-6}  = funct;
483   let Inst{5-0}   = 0x3c;
484 }
485
486 class EXT_FM_MM<bits<6> funct> : MMArch {
487   bits<5> rt;
488   bits<5> rs;
489   bits<5> pos;
490   bits<5> size;
491
492   bits<32> Inst;
493
494   let Inst{31-26} = 0x00;
495   let Inst{25-21} = rt;
496   let Inst{20-16} = rs;
497   let Inst{15-11} = size;
498   let Inst{10-6}  = pos;
499   let Inst{5-0}   = funct;
500 }
501
502 class J_FM_MM<bits<6> op> : MMArch {
503   bits<26> target;
504
505   bits<32> Inst;
506
507   let Inst{31-26} = op;
508   let Inst{25-0}  = target;
509 }
510
511 class JR_FM_MM<bits<8> funct> : MMArch {
512   bits<5> rs;
513
514   bits<32> Inst;
515
516   let Inst{31-21} = 0x00;
517   let Inst{20-16} = rs;
518   let Inst{15-14} = 0x0;
519   let Inst{13-6}  = funct;
520   let Inst{5-0}   = 0x3c;
521 }
522
523 class JALR_FM_MM<bits<10> funct> {
524   bits<5> rs;
525   bits<5> rd;
526
527   bits<32> Inst;
528
529   let Inst{31-26} = 0x00;
530   let Inst{25-21} = rd;
531   let Inst{20-16} = rs;
532   let Inst{15-6}  = funct;
533   let Inst{5-0}   = 0x3c;
534 }
535
536 class BEQ_FM_MM<bits<6> op> : MMArch {
537   bits<5>  rs;
538   bits<5>  rt;
539   bits<16> offset;
540
541   bits<32> Inst;
542
543   let Inst{31-26} = op;
544   let Inst{25-21} = rt;
545   let Inst{20-16} = rs;
546   let Inst{15-0}  = offset;
547 }
548
549 class BGEZ_FM_MM<bits<5> funct> : MMArch {
550   bits<5>  rs;
551   bits<16> offset;
552
553   bits<32> Inst;
554
555   let Inst{31-26} = 0x10;
556   let Inst{25-21} = funct;
557   let Inst{20-16} = rs;
558   let Inst{15-0}  = offset;
559 }
560
561 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
562   bits<5>  rs;
563   bits<16> offset;
564
565   bits<32> Inst;
566
567   let Inst{31-26} = 0x10;
568   let Inst{25-21} = funct;
569   let Inst{20-16} = rs;
570   let Inst{15-0}  = offset;
571 }
572
573 class SYNC_FM_MM : MMArch {
574   bits<5> stype;
575
576   bits<32> Inst;
577
578   let Inst{31-26} = 0x00;
579   let Inst{25-21} = 0x0;
580   let Inst{20-16} = stype;
581   let Inst{15-6}  = 0x1ad;
582   let Inst{5-0}   = 0x3c;
583 }
584
585 class BRK_FM_MM : MMArch {
586   bits<10> code_1;
587   bits<10> code_2;
588   bits<32> Inst;
589   let Inst{31-26} = 0x0;
590   let Inst{25-16} = code_1;
591   let Inst{15-6}  = code_2;
592   let Inst{5-0}   = 0x07;
593 }
594
595 class SYS_FM_MM : MMArch {
596   bits<10> code_;
597   bits<32> Inst;
598   let Inst{31-26} = 0x0;
599   let Inst{25-16} = code_;
600   let Inst{15-6}  = 0x22d;
601   let Inst{5-0}   = 0x3c;
602 }
603
604 class WAIT_FM_MM {
605   bits<10> code_;
606   bits<32> Inst;
607
608   let Inst{31-26} = 0x00;
609   let Inst{25-16} = code_;
610   let Inst{15-6}  = 0x24d;
611   let Inst{5-0}   = 0x3c;
612 }
613
614 class ER_FM_MM<bits<10> funct> : MMArch {
615   bits<32> Inst;
616
617   let Inst{31-26} = 0x00;
618   let Inst{25-16} = 0x00;
619   let Inst{15-6}  = funct;
620   let Inst{5-0}   = 0x3c;
621 }
622
623 class EI_FM_MM<bits<10> funct> : MMArch {
624   bits<32> Inst;
625   bits<5> rt;
626
627   let Inst{31-26} = 0x00;
628   let Inst{25-21} = 0x00;
629   let Inst{20-16} = rt;
630   let Inst{15-6}  = funct;
631   let Inst{5-0}   = 0x3c;
632 }
633
634 class TEQ_FM_MM<bits<6> funct> : MMArch {
635   bits<5> rs;
636   bits<5> rt;
637   bits<4> code_;
638
639   bits<32> Inst;
640
641   let Inst{31-26} = 0x00;
642   let Inst{25-21} = rt;
643   let Inst{20-16} = rs;
644   let Inst{15-12} = code_;
645   let Inst{11-6}  = funct;
646   let Inst{5-0}   = 0x3c;
647 }
648
649 class TEQI_FM_MM<bits<5> funct> : MMArch {
650   bits<5> rs;
651   bits<16> imm16;
652
653   bits<32> Inst;
654
655   let Inst{31-26} = 0x10;
656   let Inst{25-21} = funct;
657   let Inst{20-16} = rs;
658   let Inst{15-0}  = imm16;
659 }
660
661 class LL_FM_MM<bits<4> funct> {
662   bits<5> rt;
663   bits<21> addr;
664
665   bits<32> Inst;
666
667   let Inst{31-26} = 0x18;
668   let Inst{25-21} = rt;
669   let Inst{20-16} = addr{20-16};
670   let Inst{15-12} = funct;
671   let Inst{11-0}  = addr{11-0};
672 }
673
674 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
675   bits<5> ft;
676   bits<5> fs;
677   bits<5> fd;
678
679   bits<32> Inst;
680
681   let Inst{31-26} = 0x15;
682   let Inst{25-21} = ft;
683   let Inst{20-16} = fs;
684   let Inst{15-11} = fd;
685   let Inst{10}    = 0;
686   let Inst{9-8}   = fmt;
687   let Inst{7-0}   = funct;
688
689   list<dag> Pattern = [];
690 }
691
692 class LWXC1_FM_MM<bits<9> funct> : MMArch {
693   bits<5> fd;
694   bits<5> base;
695   bits<5> index;
696
697   bits<32> Inst;
698
699   let Inst{31-26} = 0x15;
700   let Inst{25-21} = index;
701   let Inst{20-16} = base;
702   let Inst{15-11} = fd;
703   let Inst{10-9}  = 0x0;
704   let Inst{8-0}   = funct;
705 }
706
707 class SWXC1_FM_MM<bits<9> funct> : MMArch {
708   bits<5> fs;
709   bits<5> base;
710   bits<5> index;
711
712   bits<32> Inst;
713
714   let Inst{31-26} = 0x15;
715   let Inst{25-21} = index;
716   let Inst{20-16} = base;
717   let Inst{15-11} = fs;
718   let Inst{10-9}  = 0x0;
719   let Inst{8-0}   = funct;
720 }
721
722 class CEQS_FM_MM<bits<2> fmt> : MMArch {
723   bits<5> fs;
724   bits<5> ft;
725   bits<4> cond;
726
727   bits<32> Inst;
728
729   let Inst{31-26} = 0x15;
730   let Inst{25-21} = ft;
731   let Inst{20-16} = fs;
732   let Inst{15-13} = 0x0;  // cc
733   let Inst{12}    = 0;
734   let Inst{11-10} = fmt;
735   let Inst{9-6}   = cond;
736   let Inst{5-0}   = 0x3c;
737 }
738
739 class BC1F_FM_MM<bits<5> tf> : MMArch {
740   bits<16> offset;
741
742   bits<32> Inst;
743
744   let Inst{31-26} = 0x10;
745   let Inst{25-21} = tf;
746   let Inst{20-18} = 0x0; // cc
747   let Inst{17-16} = 0x0;
748   let Inst{15-0}  = offset;
749 }
750
751 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
752   bits<5> fd;
753   bits<5> fs;
754
755   bits<32> Inst;
756
757   let Inst{31-26} = 0x15;
758   let Inst{25-21} = fd;
759   let Inst{20-16} = fs;
760   let Inst{15}    = 0;
761   let Inst{14}    = fmt;
762   let Inst{13-6}  = funct;
763   let Inst{5-0}   = 0x3b;
764 }
765
766 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
767   bits<5> fd;
768   bits<5> fs;
769
770   bits<32> Inst;
771
772   let Inst{31-26} = 0x15;
773   let Inst{25-21} = fd;
774   let Inst{20-16} = fs;
775   let Inst{15}    = 0;
776   let Inst{14-13} = fmt;
777   let Inst{12-6}  = funct;
778   let Inst{5-0}   = 0x3b;
779 }
780
781 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
782   bits<5> fd;
783   bits<5> fs;
784
785   bits<32> Inst;
786
787   let Inst{31-26} = 0x15;
788   let Inst{25-21} = fd;
789   let Inst{20-16} = fs;
790   let Inst{15-13} = 0x0; //cc
791   let Inst{12-11} = 0x0;
792   let Inst{10-9}  = fmt;
793   let Inst{8-0}   = func;
794 }
795
796 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
797   bits<5> fd;
798   bits<5> fs;
799   bits<5> rt;
800
801   bits<32> Inst;
802
803   let Inst{31-26} = 0x15;
804   let Inst{25-21} = rt;
805   let Inst{20-16} = fs;
806   let Inst{15-11} = fd;
807   let Inst{9-8}   = fmt;
808   let Inst{7-0}   = funct;
809 }
810
811 class MFC1_FM_MM<bits<8> funct> : MMArch {
812   bits<5> rt;
813   bits<5> fs;
814
815   bits<32> Inst;
816
817   let Inst{31-26} = 0x15;
818   let Inst{25-21} = rt;
819   let Inst{20-16} = fs;
820   let Inst{15-14} = 0x0;
821   let Inst{13-6}  = funct;
822   let Inst{5-0}   = 0x3b;
823 }
824
825 class MADDS_FM_MM<bits<6> funct>: MMArch {
826   bits<5> ft;
827   bits<5> fs;
828   bits<5> fd;
829   bits<5> fr;
830
831   bits<32> Inst;
832
833   let Inst{31-26} = 0x15;
834   let Inst{25-21} = ft;
835   let Inst{20-16} = fs;
836   let Inst{15-11} = fd;
837   let Inst{10-6}  = fr;
838   let Inst{5-0}   = funct;
839 }
840
841 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
842   bits<5>  rs;
843   bits<16> offset;
844
845   bits<32> Inst;
846
847   let Inst{31-26} = 0x10;
848   let Inst{25-21} = funct;
849   let Inst{20-16} = rs;
850   let Inst{15-0}  = offset;
851 }
852
853 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
854   bits<32> Inst;
855
856   let Inst{31-26} = 0x0;
857   let Inst{25-16} = 0x0;
858   let Inst{15-6}  = op;
859   let Inst{5-0}   = 0x3c;
860 }
861
862 class SDBBP_FM_MM : MMArch {
863   bits<10> code_;
864
865   bits<32> Inst;
866
867   let Inst{31-26} = 0x0;
868   let Inst{25-16} = code_;
869   let Inst{15-6}  = 0x36d;
870   let Inst{5-0}   = 0x3c;
871 }
872
873 class RDHWR_FM_MM : MMArch {
874   bits<5> rt;
875   bits<5> rd;
876
877   bits<32> Inst;
878
879   let Inst{31-26} = 0x0;
880   let Inst{25-21} = rt;
881   let Inst{20-16} = rd;
882   let Inst{15-6}  = 0x1ac;
883   let Inst{5-0}   = 0x3c;
884 }
885
886 class LWXS_FM_MM<bits<10> funct> {
887   bits<5> rd;
888   bits<5> base;
889   bits<5> index;
890
891   bits<32> Inst;
892
893   let Inst{31-26} = 0x0;
894   let Inst{25-21} = index;
895   let Inst{20-16} = base;
896   let Inst{15-11} = rd;
897   let Inst{10}    = 0;
898   let Inst{9-0}   = funct;
899 }
900
901 class LWM_FM_MM<bits<4> funct> : MMArch {
902   bits<5> rt;
903   bits<21> addr;
904
905   bits<32> Inst;
906
907   let Inst{31-26} = 0x8;
908   let Inst{25-21} = rt;
909   let Inst{20-16} = addr{20-16};
910   let Inst{15-12} = funct;
911   let Inst{11-0}  = addr{11-0};
912 }
913
914 class LWM_FM_MM16<bits<4> funct> : MMArch {
915   bits<2> rt;
916   bits<4> addr;
917
918   bits<16> Inst;
919
920   let Inst{15-10} = 0x11;
921   let Inst{9-6}   = funct;
922   let Inst{5-4}   = rt;
923   let Inst{3-0}   = addr;
924 }
925
926 class CACHE_PREF_FM_MM<bits<6> op, bits<4> funct> : MMArch {
927   bits<21> addr;
928   bits<5> hint;
929   bits<5> base = addr{20-16};
930   bits<12> offset = addr{11-0};
931
932   bits<32> Inst;
933
934   let Inst{31-26} = op;
935   let Inst{25-21} = hint;
936   let Inst{20-16} = base;
937   let Inst{15-12} = funct;
938   let Inst{11-0}  = offset;
939 }
940
941 class CACHE_PREFE_FM_MM<bits<6> op, bits<3> funct> : MMArch {
942   bits<21> addr;
943   bits<5> hint;
944   bits<5> base = addr{20-16};
945   bits<9> offset = addr{8-0};
946
947   bits<32> Inst;
948
949   let Inst{31-26} = op;
950   let Inst{25-21} = hint;
951   let Inst{20-16} = base;
952   let Inst{15-12} = 0xA;
953   let Inst{11-9} = funct;
954   let Inst{8-0}  = offset;
955 }
956
957 class POOL32F_PREFX_FM_MM<bits<6> op, bits<9> funct> : MMArch {
958   bits<5> index;
959   bits<5> base;
960   bits<5> hint;
961
962   bits<32> Inst;
963
964   let Inst{31-26} = op;
965   let Inst{25-21} = index;
966   let Inst{20-16} = base;
967   let Inst{15-11} = hint;
968   let Inst{10-9}  = 0x0;
969   let Inst{8-0}   = funct;
970 }
971
972 class BARRIER_FM_MM<bits<5> op> : MMArch {
973   bits<32> Inst;
974
975   let Inst{31-26} = 0x0;
976   let Inst{25-21} = 0x0;
977   let Inst{20-16} = 0x0;
978   let Inst{15-11} = op;
979   let Inst{10-6}  = 0x0;
980   let Inst{5-0}   = 0x0;
981 }
982
983 class ADDIUPC_FM_MM {
984   bits<3> rs;
985   bits<23> imm;
986
987   bits<32> Inst;
988
989   let Inst{31-26} = 0x1e;
990   let Inst{25-23} = rs;
991   let Inst{22-0} = imm;
992 }