[X86] Refactor the prologue emission to prepare for shrink-wrapping.
[oota-llvm.git] / lib / Target / Mips / MicroMips32r6InstrFormats.td
1 //=- MicroMips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- tablegen -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes microMIPS32r6 instruction formats.
11 //
12 //===----------------------------------------------------------------------===//
13
14 class MMR6Arch<string opstr> {
15   string Arch = "micromipsr6";
16   string BaseOpcode = opstr;
17 }
18
19 class POOL32A_BITSWAP_FM_MMR6<bits<6> funct> : MipsR6Inst {
20   bits<5> rd;
21   bits<5> rt;
22
23   bits<32> Inst;
24
25   let Inst{31-26} = 0b000000;
26   let Inst{25-21} = rt;
27   let Inst{20-16} = rd;
28   let Inst{15-12} = 0b0000;
29   let Inst{11-6} = funct;
30   let Inst{5-0} = 0b111100;
31 }
32
33 class CACHE_PREF_FM_MMR6<bits<6> opgroup, bits<4> funct> : MipsR6Inst {
34   bits<21> addr;
35   bits<5> hint;
36
37   bits<32> Inst;
38
39   let Inst{31-26} = opgroup;
40   let Inst{25-21} = hint;
41   let Inst{20-16} = addr{20-16};
42   let Inst{15-12} = funct;
43   let Inst{11-0}  = addr{11-0};
44 }
45
46 class ARITH_FM_MMR6<string instr_asm, bits<10> funct> : MMR6Arch<instr_asm> {
47   bits<5> rd;
48   bits<5> rt;
49   bits<5> rs;
50
51   bits<32> Inst;
52
53   let Inst{31-26} = 0;
54   let Inst{25-21} = rt;
55   let Inst{20-16} = rs;
56   let Inst{15-11} = rd;
57   let Inst{10}    = 0;
58   let Inst{9-0}   = funct;
59 }
60
61 class ADDI_FM_MMR6<string instr_asm, bits<6> op> : MMR6Arch<instr_asm> {
62   bits<5>  rt;
63   bits<5>  rs;
64   bits<16> imm16;
65
66   bits<32> Inst;
67
68   let Inst{31-26} = op;
69   let Inst{25-21} = rt;
70   let Inst{20-16} = rs;
71   let Inst{15-0}  = imm16;
72 }
73
74 class PCREL19_FM_MMR6<bits<2> funct> : MipsR6Inst {
75   bits<5> rt;
76   bits<19> imm;
77
78   bits<32> Inst;
79
80   let Inst{31-26} = 0b011110;
81   let Inst{25-21} = rt;
82   let Inst{20-19} = funct;
83   let Inst{18-0}  = imm;
84 }
85
86 class PCREL16_FM_MMR6<bits<5> funct> : MipsR6Inst {
87   bits<5> rt;
88   bits<16> imm;
89
90   bits<32> Inst;
91
92   let Inst{31-26} = 0b011110;
93   let Inst{25-21} = rt;
94   let Inst{20-16} = funct;
95   let Inst{15-0}  = imm;
96 }
97
98 class POOL32A_FM_MMR6<bits<10> funct> : MipsR6Inst {
99   bits<5> rd;
100   bits<5> rs;
101   bits<5> rt;
102
103   bits<32> Inst;
104
105   let Inst{31-26} = 0b000000;
106   let Inst{25-21} = rt;
107   let Inst{20-16} = rs;
108   let Inst{15-11} = rd;
109   let Inst{10}    = 0;
110   let Inst{9-0}   = funct;
111 }
112
113 class POOL32A_2R_FM_MMR6<bits<10> funct> : MipsR6Inst {
114   bits<5> rs;
115   bits<5> rt;
116
117   bits<32> Inst;
118
119   let Inst{31-26} = 0b000000;
120   let Inst{25-21} = rt;
121   let Inst{20-16} = rs;
122   let Inst{15-6}  = funct;
123   let Inst{5-0}   = 0b111100;
124 }
125
126 class SPECIAL_2R_FM_MMR6<bits<6> funct> : MipsR6Inst {
127   bits<5> rs;
128   bits<5> rt;
129
130   bits<32> Inst;
131
132   let Inst{31-26} = 0b000000;
133   let Inst{25-21} = rs;
134   let Inst{20-16} = 0b00000;
135   let Inst{15-11} = rt;
136   let Inst{10-6}  = 0b00001;
137   let Inst{5-0}   = funct;
138 }
139
140 class POOL32A_ALIGN_FM_MMR6<bits<6> funct> : MipsR6Inst {
141   bits<5> rd;
142   bits<5> rs;
143   bits<5> rt;
144   bits<2> bp;
145
146   bits<32> Inst;
147
148   let Inst{31-26} = 0b000000;
149   let Inst{25-21} = rs;
150   let Inst{20-16} = rt;
151   let Inst{15-11} = rd;
152   let Inst{10-9}  = bp;
153   let Inst{8-6}   = 0b000;
154   let Inst{5-0}   = funct;
155 }
156
157 class AUI_FM_MMR6 : MipsR6Inst {
158   bits<5> rs;
159   bits<5> rt;
160   bits<16> imm;
161
162   bits<32> Inst;
163
164   let Inst{31-26} = 0b000100;
165   let Inst{25-21} = rt;
166   let Inst{20-16} = rs;
167   let Inst{15-0} = imm;
168 }
169
170 class POOL32A_LSA_FM<bits<6> funct> : MipsR6Inst {
171   bits<5> rd;
172   bits<5> rs;
173   bits<5> rt;
174   bits<2> imm2;
175
176   bits<32> Inst;
177
178   let Inst{31-26} = 0b000000;
179   let Inst{25-21} = rt;
180   let Inst{20-16} = rs;
181   let Inst{15-11} = rd;
182   let Inst{10-9}  = imm2;
183   let Inst{8-6}   = 0b000;
184   let Inst{5-0}   = funct;
185 }