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