[mips][microMIPS] Implement LWGP instruction
[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 //===----------------------------------------------------------------------===//
262 // MicroMIPS 32-bit Instruction Formats
263 //===----------------------------------------------------------------------===//
264
265 class MMArch {
266   string Arch = "micromips";
267   list<dag> Pattern = [];
268 }
269
270 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
271   bits<5> rt;
272   bits<5> rs;
273   bits<5> rd;
274
275   bits<32> Inst;
276
277   let Inst{31-26} = op;
278   let Inst{25-21} = rt;
279   let Inst{20-16} = rs;
280   let Inst{15-11} = rd;
281   let Inst{10}    = 0;
282   let Inst{9-0}   = funct;
283 }
284
285 class ADDI_FM_MM<bits<6> op> : MMArch {
286   bits<5>  rs;
287   bits<5>  rt;
288   bits<16> imm16;
289
290   bits<32> Inst;
291
292   let Inst{31-26} = op;
293   let Inst{25-21} = rt;
294   let Inst{20-16} = rs;
295   let Inst{15-0}  = imm16;
296 }
297
298 class SLTI_FM_MM<bits<6> op> : MMArch {
299   bits<5> rt;
300   bits<5> rs;
301   bits<16> imm16;
302
303   bits<32> Inst;
304
305   let Inst{31-26} = op;
306   let Inst{25-21} = rt;
307   let Inst{20-16} = rs;
308   let Inst{15-0}  = imm16;
309 }
310
311 class LUI_FM_MM : MMArch {
312   bits<5> rt;
313   bits<16> imm16;
314
315   bits<32> Inst;
316
317   let Inst{31-26} = 0x10;
318   let Inst{25-21} = 0xd;
319   let Inst{20-16} = rt;
320   let Inst{15-0}  = imm16;
321 }
322
323 class MULT_FM_MM<bits<10> funct> : MMArch {
324   bits<5>  rs;
325   bits<5>  rt;
326
327   bits<32> Inst;
328
329   let Inst{31-26} = 0x00;
330   let Inst{25-21} = rt;
331   let Inst{20-16} = rs;
332   let Inst{15-6}  = funct;
333   let Inst{5-0}   = 0x3c;
334 }
335
336 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
337   bits<5> rd;
338   bits<5> rt;
339   bits<5> shamt;
340
341   bits<32> Inst;
342
343   let Inst{31-26} = 0;
344   let Inst{25-21} = rd;
345   let Inst{20-16} = rt;
346   let Inst{15-11} = shamt;
347   let Inst{10}    = rotate;
348   let Inst{9-0}   = funct;
349 }
350
351 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
352   bits<5> rd;
353   bits<5> rt;
354   bits<5> rs;
355
356   bits<32> Inst;
357
358   let Inst{31-26} = 0;
359   let Inst{25-21} = rt;
360   let Inst{20-16} = rs;
361   let Inst{15-11} = rd;
362   let Inst{10}    = rotate;
363   let Inst{9-0}   = funct;
364 }
365
366 class LW_FM_MM<bits<6> op> : MMArch {
367   bits<5> rt;
368   bits<21> addr;
369
370   bits<32> Inst;
371
372   let Inst{31-26} = op;
373   let Inst{25-21} = rt;
374   let Inst{20-16} = addr{20-16};
375   let Inst{15-0}  = addr{15-0};
376 }
377
378 class LWL_FM_MM<bits<4> funct> {
379   bits<5> rt;
380   bits<21> addr;
381
382   bits<32> Inst;
383
384   let Inst{31-26} = 0x18;
385   let Inst{25-21} = rt;
386   let Inst{20-16} = addr{20-16};
387   let Inst{15-12} = funct;
388   let Inst{11-0}  = addr{11-0};
389 }
390
391 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
392   bits<5> rd;
393   bits<5> rs;
394   bits<3> fcc;
395
396   bits<32> Inst;
397
398   let Inst{31-26} = 0x15;
399   let Inst{25-21} = rd;
400   let Inst{20-16} = rs;
401   let Inst{15-13} = fcc;
402   let Inst{12-6}  = func;
403   let Inst{5-0}   = 0x3b;
404 }
405
406 class MTLO_FM_MM<bits<10> funct> : MMArch {
407   bits<5> rs;
408
409   bits<32> Inst;
410
411   let Inst{31-26} = 0x00;
412   let Inst{25-21} = 0x00;
413   let Inst{20-16} = rs;
414   let Inst{15-6}  = funct;
415   let Inst{5-0}   = 0x3c;
416 }
417
418 class MFLO_FM_MM<bits<10> funct> : MMArch {
419   bits<5> rd;
420
421   bits<32> Inst;
422
423   let Inst{31-26} = 0x00;
424   let Inst{25-21} = 0x00;
425   let Inst{20-16} = rd;
426   let Inst{15-6}  = funct;
427   let Inst{5-0}   = 0x3c;
428 }
429
430 class CLO_FM_MM<bits<10> funct> : MMArch {
431   bits<5> rd;
432   bits<5> rs;
433
434   bits<32> Inst;
435
436   let Inst{31-26} = 0x00;
437   let Inst{25-21} = rd;
438   let Inst{20-16} = rs;
439   let Inst{15-6}  = funct;
440   let Inst{5-0}   = 0x3c;
441 }
442
443 class SEB_FM_MM<bits<10> funct> : MMArch {
444   bits<5> rd;
445   bits<5> rt;
446
447   bits<32> Inst;
448
449   let Inst{31-26} = 0x00;
450   let Inst{25-21} = rd;
451   let Inst{20-16} = rt;
452   let Inst{15-6}  = funct;
453   let Inst{5-0}   = 0x3c;
454 }
455
456 class EXT_FM_MM<bits<6> funct> : MMArch {
457   bits<5> rt;
458   bits<5> rs;
459   bits<5> pos;
460   bits<5> size;
461
462   bits<32> Inst;
463
464   let Inst{31-26} = 0x00;
465   let Inst{25-21} = rt;
466   let Inst{20-16} = rs;
467   let Inst{15-11} = size;
468   let Inst{10-6}  = pos;
469   let Inst{5-0}   = funct;
470 }
471
472 class J_FM_MM<bits<6> op> : MMArch {
473   bits<26> target;
474
475   bits<32> Inst;
476
477   let Inst{31-26} = op;
478   let Inst{25-0}  = target;
479 }
480
481 class JR_FM_MM<bits<8> funct> : MMArch {
482   bits<5> rs;
483
484   bits<32> Inst;
485
486   let Inst{31-21} = 0x00;
487   let Inst{20-16} = rs;
488   let Inst{15-14} = 0x0;
489   let Inst{13-6}  = funct;
490   let Inst{5-0}   = 0x3c;
491 }
492
493 class JALR_FM_MM<bits<10> funct> {
494   bits<5> rs;
495   bits<5> rd;
496
497   bits<32> Inst;
498
499   let Inst{31-26} = 0x00;
500   let Inst{25-21} = rd;
501   let Inst{20-16} = rs;
502   let Inst{15-6}  = funct;
503   let Inst{5-0}   = 0x3c;
504 }
505
506 class BEQ_FM_MM<bits<6> op> : MMArch {
507   bits<5>  rs;
508   bits<5>  rt;
509   bits<16> offset;
510
511   bits<32> Inst;
512
513   let Inst{31-26} = op;
514   let Inst{25-21} = rt;
515   let Inst{20-16} = rs;
516   let Inst{15-0}  = offset;
517 }
518
519 class BGEZ_FM_MM<bits<5> funct> : MMArch {
520   bits<5>  rs;
521   bits<16> offset;
522
523   bits<32> Inst;
524
525   let Inst{31-26} = 0x10;
526   let Inst{25-21} = funct;
527   let Inst{20-16} = rs;
528   let Inst{15-0}  = offset;
529 }
530
531 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
532   bits<5>  rs;
533   bits<16> offset;
534
535   bits<32> Inst;
536
537   let Inst{31-26} = 0x10;
538   let Inst{25-21} = funct;
539   let Inst{20-16} = rs;
540   let Inst{15-0}  = offset;
541 }
542
543 class SYNC_FM_MM : MMArch {
544   bits<5> stype;
545
546   bits<32> Inst;
547
548   let Inst{31-26} = 0x00;
549   let Inst{25-21} = 0x0;
550   let Inst{20-16} = stype;
551   let Inst{15-6}  = 0x1ad;
552   let Inst{5-0}   = 0x3c;
553 }
554
555 class BRK_FM_MM : MMArch {
556   bits<10> code_1;
557   bits<10> code_2;
558   bits<32> Inst;
559   let Inst{31-26} = 0x0;
560   let Inst{25-16} = code_1;
561   let Inst{15-6}  = code_2;
562   let Inst{5-0}   = 0x07;
563 }
564
565 class SYS_FM_MM : MMArch {
566   bits<10> code_;
567   bits<32> Inst;
568   let Inst{31-26} = 0x0;
569   let Inst{25-16} = code_;
570   let Inst{15-6}  = 0x22d;
571   let Inst{5-0}   = 0x3c;
572 }
573
574 class WAIT_FM_MM {
575   bits<10> code_;
576   bits<32> Inst;
577
578   let Inst{31-26} = 0x00;
579   let Inst{25-16} = code_;
580   let Inst{15-6}  = 0x24d;
581   let Inst{5-0}   = 0x3c;
582 }
583
584 class ER_FM_MM<bits<10> funct> : MMArch {
585   bits<32> Inst;
586
587   let Inst{31-26} = 0x00;
588   let Inst{25-16} = 0x00;
589   let Inst{15-6}  = funct;
590   let Inst{5-0}   = 0x3c;
591 }
592
593 class EI_FM_MM<bits<10> funct> : MMArch {
594   bits<32> Inst;
595   bits<5> rt;
596
597   let Inst{31-26} = 0x00;
598   let Inst{25-21} = 0x00;
599   let Inst{20-16} = rt;
600   let Inst{15-6}  = funct;
601   let Inst{5-0}   = 0x3c;
602 }
603
604 class TEQ_FM_MM<bits<6> funct> : MMArch {
605   bits<5> rs;
606   bits<5> rt;
607   bits<4> code_;
608
609   bits<32> Inst;
610
611   let Inst{31-26} = 0x00;
612   let Inst{25-21} = rt;
613   let Inst{20-16} = rs;
614   let Inst{15-12} = code_;
615   let Inst{11-6}  = funct;
616   let Inst{5-0}   = 0x3c;
617 }
618
619 class TEQI_FM_MM<bits<5> funct> : MMArch {
620   bits<5> rs;
621   bits<16> imm16;
622
623   bits<32> Inst;
624
625   let Inst{31-26} = 0x10;
626   let Inst{25-21} = funct;
627   let Inst{20-16} = rs;
628   let Inst{15-0}  = imm16;
629 }
630
631 class LL_FM_MM<bits<4> funct> {
632   bits<5> rt;
633   bits<21> addr;
634
635   bits<32> Inst;
636
637   let Inst{31-26} = 0x18;
638   let Inst{25-21} = rt;
639   let Inst{20-16} = addr{20-16};
640   let Inst{15-12} = funct;
641   let Inst{11-0}  = addr{11-0};
642 }
643
644 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
645   bits<5> ft;
646   bits<5> fs;
647   bits<5> fd;
648
649   bits<32> Inst;
650
651   let Inst{31-26} = 0x15;
652   let Inst{25-21} = ft;
653   let Inst{20-16} = fs;
654   let Inst{15-11} = fd;
655   let Inst{10}    = 0;
656   let Inst{9-8}   = fmt;
657   let Inst{7-0}   = funct;
658
659   list<dag> Pattern = [];
660 }
661
662 class LWXC1_FM_MM<bits<9> funct> : MMArch {
663   bits<5> fd;
664   bits<5> base;
665   bits<5> index;
666
667   bits<32> Inst;
668
669   let Inst{31-26} = 0x15;
670   let Inst{25-21} = index;
671   let Inst{20-16} = base;
672   let Inst{15-11} = fd;
673   let Inst{10-9}  = 0x0;
674   let Inst{8-0}   = funct;
675 }
676
677 class SWXC1_FM_MM<bits<9> funct> : MMArch {
678   bits<5> fs;
679   bits<5> base;
680   bits<5> index;
681
682   bits<32> Inst;
683
684   let Inst{31-26} = 0x15;
685   let Inst{25-21} = index;
686   let Inst{20-16} = base;
687   let Inst{15-11} = fs;
688   let Inst{10-9}  = 0x0;
689   let Inst{8-0}   = funct;
690 }
691
692 class CEQS_FM_MM<bits<2> fmt> : MMArch {
693   bits<5> fs;
694   bits<5> ft;
695   bits<4> cond;
696
697   bits<32> Inst;
698
699   let Inst{31-26} = 0x15;
700   let Inst{25-21} = ft;
701   let Inst{20-16} = fs;
702   let Inst{15-13} = 0x0;  // cc
703   let Inst{12}    = 0;
704   let Inst{11-10} = fmt;
705   let Inst{9-6}   = cond;
706   let Inst{5-0}   = 0x3c;
707 }
708
709 class BC1F_FM_MM<bits<5> tf> : MMArch {
710   bits<16> offset;
711
712   bits<32> Inst;
713
714   let Inst{31-26} = 0x10;
715   let Inst{25-21} = tf;
716   let Inst{20-18} = 0x0; // cc
717   let Inst{17-16} = 0x0;
718   let Inst{15-0}  = offset;
719 }
720
721 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
722   bits<5> fd;
723   bits<5> fs;
724
725   bits<32> Inst;
726
727   let Inst{31-26} = 0x15;
728   let Inst{25-21} = fd;
729   let Inst{20-16} = fs;
730   let Inst{15}    = 0;
731   let Inst{14}    = fmt;
732   let Inst{13-6}  = funct;
733   let Inst{5-0}   = 0x3b;
734 }
735
736 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
737   bits<5> fd;
738   bits<5> fs;
739
740   bits<32> Inst;
741
742   let Inst{31-26} = 0x15;
743   let Inst{25-21} = fd;
744   let Inst{20-16} = fs;
745   let Inst{15}    = 0;
746   let Inst{14-13} = fmt;
747   let Inst{12-6}  = funct;
748   let Inst{5-0}   = 0x3b;
749 }
750
751 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : 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-13} = 0x0; //cc
761   let Inst{12-11} = 0x0;
762   let Inst{10-9}  = fmt;
763   let Inst{8-0}   = func;
764 }
765
766 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
767   bits<5> fd;
768   bits<5> fs;
769   bits<5> rt;
770
771   bits<32> Inst;
772
773   let Inst{31-26} = 0x15;
774   let Inst{25-21} = rt;
775   let Inst{20-16} = fs;
776   let Inst{15-11} = fd;
777   let Inst{9-8}   = fmt;
778   let Inst{7-0}   = funct;
779 }
780
781 class MFC1_FM_MM<bits<8> funct> : MMArch {
782   bits<5> rt;
783   bits<5> fs;
784
785   bits<32> Inst;
786
787   let Inst{31-26} = 0x15;
788   let Inst{25-21} = rt;
789   let Inst{20-16} = fs;
790   let Inst{15-14} = 0x0;
791   let Inst{13-6}  = funct;
792   let Inst{5-0}   = 0x3b;
793 }
794
795 class MADDS_FM_MM<bits<6> funct>: MMArch {
796   bits<5> ft;
797   bits<5> fs;
798   bits<5> fd;
799   bits<5> fr;
800
801   bits<32> Inst;
802
803   let Inst{31-26} = 0x15;
804   let Inst{25-21} = ft;
805   let Inst{20-16} = fs;
806   let Inst{15-11} = fd;
807   let Inst{10-6}  = fr;
808   let Inst{5-0}   = funct;
809 }
810
811 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
812   bits<5>  rs;
813   bits<16> offset;
814
815   bits<32> Inst;
816
817   let Inst{31-26} = 0x10;
818   let Inst{25-21} = funct;
819   let Inst{20-16} = rs;
820   let Inst{15-0}  = offset;
821 }
822
823 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
824   bits<32> Inst;
825
826   let Inst{31-26} = 0x0;
827   let Inst{25-16} = 0x0;
828   let Inst{15-6}  = op;
829   let Inst{5-0}   = 0x3c;
830 }
831
832 class SDBBP_FM_MM : MMArch {
833   bits<10> code_;
834
835   bits<32> Inst;
836
837   let Inst{31-26} = 0x0;
838   let Inst{25-16} = code_;
839   let Inst{15-6}  = 0x36d;
840   let Inst{5-0}   = 0x3c;
841 }
842
843 class RDHWR_FM_MM : MMArch {
844   bits<5> rt;
845   bits<5> rd;
846
847   bits<32> Inst;
848
849   let Inst{31-26} = 0x0;
850   let Inst{25-21} = rt;
851   let Inst{20-16} = rd;
852   let Inst{15-6}  = 0x1ac;
853   let Inst{5-0}   = 0x3c;
854 }
855
856 class LWXS_FM_MM<bits<10> funct> {
857   bits<5> rd;
858   bits<5> base;
859   bits<5> index;
860
861   bits<32> Inst;
862
863   let Inst{31-26} = 0x0;
864   let Inst{25-21} = index;
865   let Inst{20-16} = base;
866   let Inst{15-11} = rd;
867   let Inst{10}    = 0;
868   let Inst{9-0}   = funct;
869 }
870
871 class LWM_FM_MM<bits<4> funct> : MMArch {
872   bits<5> rt;
873   bits<21> addr;
874
875   bits<32> Inst;
876
877   let Inst{31-26} = 0x8;
878   let Inst{25-21} = rt;
879   let Inst{20-16} = addr{20-16};
880   let Inst{15-12} = funct;
881   let Inst{11-0}  = addr{11-0};
882 }
883
884 class LWM_FM_MM16<bits<4> funct> : MMArch {
885   bits<2> rt;
886   bits<4> addr;
887
888   bits<16> Inst;
889
890   let Inst{15-10} = 0x11;
891   let Inst{9-6}   = funct;
892   let Inst{5-4}   = rt;
893   let Inst{3-0}   = addr;
894 }
895
896 class CACHE_PREF_FM_MM<bits<6> op, bits<4> funct> : MMArch {
897   bits<21> addr;
898   bits<5> hint;
899   bits<5> base = addr{20-16};
900   bits<12> offset = addr{11-0};
901
902   bits<32> Inst;
903
904   let Inst{31-26} = op;
905   let Inst{25-21} = hint;
906   let Inst{20-16} = base;
907   let Inst{15-12} = funct;
908   let Inst{11-0}  = offset;
909 }
910
911 class BARRIER_FM_MM<bits<5> op> : MMArch {
912   bits<32> Inst;
913
914   let Inst{31-26} = 0x0;
915   let Inst{25-21} = 0x0;
916   let Inst{20-16} = 0x0;
917   let Inst{15-11} = op;
918   let Inst{10-6}  = 0x0;
919   let Inst{5-0}   = 0x0;
920 }
921
922 class ADDIUPC_FM_MM {
923   bits<3> rs;
924   bits<23> imm;
925
926   bits<32> Inst;
927
928   let Inst{31-26} = 0x1e;
929   let Inst{25-23} = rs;
930   let Inst{22-0} = imm;
931 }