Provide an operand for microMIPS wait 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 MOVE_FM_MM16<bits<6> funct> {
45   bits<5> rs;
46   bits<5> rd;
47
48   bits<16> Inst;
49
50   let Inst{15-10} = funct;
51   let Inst{9-5}   = rd;
52   let Inst{4-0}   = rs;
53 }
54
55 class JALR_FM_MM16<bits<5> op> {
56   bits<5> rs;
57
58   bits<16> Inst;
59
60   let Inst{15-10} = 0x11;
61   let Inst{9-5}   = op;
62   let Inst{4-0}   = rs;
63 }
64
65 //===----------------------------------------------------------------------===//
66 // MicroMIPS 32-bit Instruction Formats
67 //===----------------------------------------------------------------------===//
68
69 class MMArch {
70   string Arch = "micromips";
71   list<dag> Pattern = [];
72 }
73
74 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
75   bits<5> rt;
76   bits<5> rs;
77   bits<5> rd;
78
79   bits<32> Inst;
80
81   let Inst{31-26} = op;
82   let Inst{25-21} = rt;
83   let Inst{20-16} = rs;
84   let Inst{15-11} = rd;
85   let Inst{10}    = 0;
86   let Inst{9-0}   = funct;
87 }
88
89 class ADDI_FM_MM<bits<6> op> : MMArch {
90   bits<5>  rs;
91   bits<5>  rt;
92   bits<16> imm16;
93
94   bits<32> Inst;
95
96   let Inst{31-26} = op;
97   let Inst{25-21} = rt;
98   let Inst{20-16} = rs;
99   let Inst{15-0}  = imm16;
100 }
101
102 class SLTI_FM_MM<bits<6> op> : MMArch {
103   bits<5> rt;
104   bits<5> rs;
105   bits<16> imm16;
106
107   bits<32> Inst;
108
109   let Inst{31-26} = op;
110   let Inst{25-21} = rt;
111   let Inst{20-16} = rs;
112   let Inst{15-0}  = imm16;
113 }
114
115 class LUI_FM_MM : MMArch {
116   bits<5> rt;
117   bits<16> imm16;
118
119   bits<32> Inst;
120
121   let Inst{31-26} = 0x10;
122   let Inst{25-21} = 0xd;
123   let Inst{20-16} = rt;
124   let Inst{15-0}  = imm16;
125 }
126
127 class MULT_FM_MM<bits<10> funct> : MMArch {
128   bits<5>  rs;
129   bits<5>  rt;
130
131   bits<32> Inst;
132
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;
138 }
139
140 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
141   bits<5> rd;
142   bits<5> rt;
143   bits<5> shamt;
144
145   bits<32> Inst;
146
147   let Inst{31-26} = 0;
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;
153 }
154
155 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
156   bits<5> rd;
157   bits<5> rt;
158   bits<5> rs;
159
160   bits<32> Inst;
161
162   let Inst{31-26} = 0;
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;
168 }
169
170 class LW_FM_MM<bits<6> op> : MMArch {
171   bits<5> rt;
172   bits<21> addr;
173
174   bits<32> Inst;
175
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};
180 }
181
182 class LWL_FM_MM<bits<4> funct> {
183   bits<5> rt;
184   bits<21> addr;
185
186   bits<32> Inst;
187
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};
193 }
194
195 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
196   bits<5> rd;
197   bits<5> rs;
198   bits<3> fcc;
199
200   bits<32> Inst;
201
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;
208 }
209
210 class MTLO_FM_MM<bits<10> funct> : MMArch {
211   bits<5> rs;
212
213   bits<32> Inst;
214
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;
220 }
221
222 class MFLO_FM_MM<bits<10> funct> : MMArch {
223   bits<5> rd;
224
225   bits<32> Inst;
226
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;
232 }
233
234 class CLO_FM_MM<bits<10> funct> : MMArch {
235   bits<5> rd;
236   bits<5> rs;
237
238   bits<32> Inst;
239
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;
245 }
246
247 class SEB_FM_MM<bits<10> funct> : MMArch {
248   bits<5> rd;
249   bits<5> rt;
250
251   bits<32> Inst;
252
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;
258 }
259
260 class EXT_FM_MM<bits<6> funct> : MMArch {
261   bits<5> rt;
262   bits<5> rs;
263   bits<5> pos;
264   bits<5> size;
265
266   bits<32> Inst;
267
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;
274 }
275
276 class J_FM_MM<bits<6> op> : MMArch {
277   bits<26> target;
278
279   bits<32> Inst;
280
281   let Inst{31-26} = op;
282   let Inst{25-0}  = target;
283 }
284
285 class JR_FM_MM<bits<8> funct> : MMArch {
286   bits<5> rs;
287
288   bits<32> Inst;
289
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;
295 }
296
297 class JALR_FM_MM<bits<10> funct> {
298   bits<5> rs;
299   bits<5> rd;
300
301   bits<32> Inst;
302
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;
308 }
309
310 class BEQ_FM_MM<bits<6> op> : MMArch {
311   bits<5>  rs;
312   bits<5>  rt;
313   bits<16> offset;
314
315   bits<32> Inst;
316
317   let Inst{31-26} = op;
318   let Inst{25-21} = rt;
319   let Inst{20-16} = rs;
320   let Inst{15-0}  = offset;
321 }
322
323 class BGEZ_FM_MM<bits<5> funct> : MMArch {
324   bits<5>  rs;
325   bits<16> offset;
326
327   bits<32> Inst;
328
329   let Inst{31-26} = 0x10;
330   let Inst{25-21} = funct;
331   let Inst{20-16} = rs;
332   let Inst{15-0}  = offset;
333 }
334
335 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
336   bits<5>  rs;
337   bits<16> offset;
338
339   bits<32> Inst;
340
341   let Inst{31-26} = 0x10;
342   let Inst{25-21} = funct;
343   let Inst{20-16} = rs;
344   let Inst{15-0}  = offset;
345 }
346
347 class SYNC_FM_MM : MMArch {
348   bits<5> stype;
349
350   bits<32> Inst;
351
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;
357 }
358
359 class BRK_FM_MM : MMArch {
360   bits<10> code_1;
361   bits<10> code_2;
362   bits<32> Inst;
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;
367 }
368
369 class SYS_FM_MM : MMArch {
370   bits<10> code_;
371   bits<32> Inst;
372   let Inst{31-26} = 0x0;
373   let Inst{25-16} = code_;
374   let Inst{15-6}  = 0x22d;
375   let Inst{5-0}   = 0x3c;
376 }
377
378 class WAIT_FM_MM {
379   bits<10> code_;
380   bits<32> Inst;
381
382   let Inst{31-26} = 0x00;
383   let Inst{25-16} = code_;
384   let Inst{15-6}  = 0x24d;
385   let Inst{5-0}   = 0x3c;
386 }
387
388 class ER_FM_MM<bits<10> funct> : MMArch {
389   bits<32> Inst;
390
391   let Inst{31-26} = 0x00;
392   let Inst{25-16} = 0x00;
393   let Inst{15-6}  = funct;
394   let Inst{5-0}   = 0x3c;
395 }
396
397 class EI_FM_MM<bits<10> funct> : MMArch {
398   bits<32> Inst;
399   bits<5> rt;
400
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;
406 }
407
408 class TEQ_FM_MM<bits<6> funct> : MMArch {
409   bits<5> rs;
410   bits<5> rt;
411   bits<4> code_;
412
413   bits<32> Inst;
414
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;
421 }
422
423 class TEQI_FM_MM<bits<5> funct> : MMArch {
424   bits<5> rs;
425   bits<16> imm16;
426
427   bits<32> Inst;
428
429   let Inst{31-26} = 0x10;
430   let Inst{25-21} = funct;
431   let Inst{20-16} = rs;
432   let Inst{15-0}  = imm16;
433 }
434
435 class LL_FM_MM<bits<4> funct> {
436   bits<5> rt;
437   bits<21> addr;
438
439   bits<32> Inst;
440
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};
446 }
447
448 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
449   bits<5> ft;
450   bits<5> fs;
451   bits<5> fd;
452
453   bits<32> Inst;
454
455   let Inst{31-26} = 0x15;
456   let Inst{25-21} = ft;
457   let Inst{20-16} = fs;
458   let Inst{15-11} = fd;
459   let Inst{10}    = 0;
460   let Inst{9-8}   = fmt;
461   let Inst{7-0}   = funct;
462
463   list<dag> Pattern = [];
464 }
465
466 class LWXC1_FM_MM<bits<9> funct> : MMArch {
467   bits<5> fd;
468   bits<5> base;
469   bits<5> index;
470
471   bits<32> Inst;
472
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;
479 }
480
481 class SWXC1_FM_MM<bits<9> funct> : MMArch {
482   bits<5> fs;
483   bits<5> base;
484   bits<5> index;
485
486   bits<32> Inst;
487
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;
494 }
495
496 class CEQS_FM_MM<bits<2> fmt> : MMArch {
497   bits<5> fs;
498   bits<5> ft;
499   bits<4> cond;
500
501   bits<32> Inst;
502
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
507   let Inst{12}    = 0;
508   let Inst{11-10} = fmt;
509   let Inst{9-6}   = cond;
510   let Inst{5-0}   = 0x3c;
511 }
512
513 class BC1F_FM_MM<bits<5> tf> : MMArch {
514   bits<16> offset;
515
516   bits<32> Inst;
517
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;
523 }
524
525 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
526   bits<5> fd;
527   bits<5> fs;
528
529   bits<32> Inst;
530
531   let Inst{31-26} = 0x15;
532   let Inst{25-21} = fd;
533   let Inst{20-16} = fs;
534   let Inst{15}    = 0;
535   let Inst{14}    = fmt;
536   let Inst{13-6}  = funct;
537   let Inst{5-0}   = 0x3b;
538 }
539
540 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
541   bits<5> fd;
542   bits<5> fs;
543
544   bits<32> Inst;
545
546   let Inst{31-26} = 0x15;
547   let Inst{25-21} = fd;
548   let Inst{20-16} = fs;
549   let Inst{15}    = 0;
550   let Inst{14-13} = fmt;
551   let Inst{12-6}  = funct;
552   let Inst{5-0}   = 0x3b;
553 }
554
555 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
556   bits<5> fd;
557   bits<5> fs;
558
559   bits<32> Inst;
560
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;
568 }
569
570 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
571   bits<5> fd;
572   bits<5> fs;
573   bits<5> rt;
574
575   bits<32> Inst;
576
577   let Inst{31-26} = 0x15;
578   let Inst{25-21} = rt;
579   let Inst{20-16} = fs;
580   let Inst{15-11} = fd;
581   let Inst{9-8}   = fmt;
582   let Inst{7-0}   = funct;
583 }
584
585 class MFC1_FM_MM<bits<8> funct> : MMArch {
586   bits<5> rt;
587   bits<5> fs;
588
589   bits<32> Inst;
590
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;
597 }
598
599 class MADDS_FM_MM<bits<6> funct>: MMArch {
600   bits<5> ft;
601   bits<5> fs;
602   bits<5> fd;
603   bits<5> fr;
604
605   bits<32> Inst;
606
607   let Inst{31-26} = 0x15;
608   let Inst{25-21} = ft;
609   let Inst{20-16} = fs;
610   let Inst{15-11} = fd;
611   let Inst{10-6}  = fr;
612   let Inst{5-0}   = funct;
613 }