blob: 98e1e3526617522704e687e83cf3dd7c86a5d8ea [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- PowerPCInstrFormats.td - PowerPC Instruction Formats --*- tablegen -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// PowerPC instruction formats
13
Evan Chengb783fa32007-07-19 01:14:50 +000014class I<bits<6> opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin>
Dan Gohmanf17a25c2007-07-18 16:29:46 +000015 : Instruction {
16 field bits<32> Inst;
17
18 bit PPC64 = 0; // Default value, override with isPPC64
19
20 let Name = "";
21 let Namespace = "PPC";
22 let Inst{0-5} = opcode;
Evan Chengb783fa32007-07-19 01:14:50 +000023 let OutOperandList = OOL;
24 let InOperandList = IOL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025 let AsmString = asmstr;
26 let Itinerary = itin;
27
28 /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
29 /// these must be reflected there! See comments there for what these are.
30 bits<1> PPC970_First = 0;
31 bits<1> PPC970_Single = 0;
32 bits<1> PPC970_Cracked = 0;
33 bits<3> PPC970_Unit = 0;
34}
35
36class PPC970_DGroup_First { bits<1> PPC970_First = 1; }
37class PPC970_DGroup_Single { bits<1> PPC970_Single = 1; }
38class PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
39class PPC970_MicroCode;
40
41class PPC970_Unit_Pseudo { bits<3> PPC970_Unit = 0; }
42class PPC970_Unit_FXU { bits<3> PPC970_Unit = 1; }
43class PPC970_Unit_LSU { bits<3> PPC970_Unit = 2; }
44class PPC970_Unit_FPU { bits<3> PPC970_Unit = 3; }
45class PPC970_Unit_CRU { bits<3> PPC970_Unit = 4; }
46class PPC970_Unit_VALU { bits<3> PPC970_Unit = 5; }
47class PPC970_Unit_VPERM { bits<3> PPC970_Unit = 6; }
48class PPC970_Unit_BRU { bits<3> PPC970_Unit = 7; }
49
50
51// 1.7.1 I-Form
Evan Chengb783fa32007-07-19 01:14:50 +000052class IForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +000053 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +000054 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000055 let Pattern = pattern;
56 bits<24> LI;
57
58 let Inst{6-29} = LI;
59 let Inst{30} = aa;
60 let Inst{31} = lk;
61}
62
63// 1.7.2 B-Form
Evan Chengb783fa32007-07-19 01:14:50 +000064class BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr>
65 : I<opcode, OOL, IOL, asmstr, BrB> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000066 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
67 bits<3> CR;
68 bits<14> BD;
69
70 bits<5> BI;
71 let BI{0-1} = BIBO{5-6};
72 let BI{2-4} = CR{0-2};
73
74 let Inst{6-10} = BIBO{4-0};
75 let Inst{11-15} = BI;
76 let Inst{16-29} = BD;
77 let Inst{30} = aa;
78 let Inst{31} = lk;
79}
80
81
82// 1.7.4 D-Form
Evan Chengb783fa32007-07-19 01:14:50 +000083class DForm_base<bits<6> opcode, dag OOL, dag IOL, string asmstr,
84 InstrItinClass itin, list<dag> pattern>
85 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000086 bits<5> A;
87 bits<5> B;
88 bits<16> C;
89
90 let Pattern = pattern;
91
92 let Inst{6-10} = A;
93 let Inst{11-15} = B;
94 let Inst{16-31} = C;
95}
96
Evan Chengb783fa32007-07-19 01:14:50 +000097class DForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
98 InstrItinClass itin, list<dag> pattern>
99 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000100 bits<5> A;
101 bits<16> C;
102 bits<5> B;
103
104 let Pattern = pattern;
105
106 let Inst{6-10} = A;
107 let Inst{11-15} = B;
108 let Inst{16-31} = C;
109}
110
Evan Chengb783fa32007-07-19 01:14:50 +0000111class DForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
112 InstrItinClass itin, list<dag> pattern>
113 : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000114
Evan Chengb783fa32007-07-19 01:14:50 +0000115class DForm_2_r0<bits<6> opcode, dag OOL, dag IOL, string asmstr,
116 InstrItinClass itin, list<dag> pattern>
117 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000118 bits<5> A;
119 bits<16> B;
120
121 let Pattern = pattern;
122
123 let Inst{6-10} = A;
124 let Inst{11-15} = 0;
125 let Inst{16-31} = B;
126}
127
Evan Chengb783fa32007-07-19 01:14:50 +0000128class DForm_4<bits<6> opcode, dag OOL, dag IOL, string asmstr,
129 InstrItinClass itin, list<dag> pattern>
130 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000131 bits<5> B;
132 bits<5> A;
133 bits<16> C;
134
135 let Pattern = pattern;
136
137 let Inst{6-10} = A;
138 let Inst{11-15} = B;
139 let Inst{16-31} = C;
140}
141
Evan Chengb783fa32007-07-19 01:14:50 +0000142class DForm_4_zero<bits<6> opcode, dag OOL, dag IOL, string asmstr,
143 InstrItinClass itin, list<dag> pattern>
144 : DForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000145 let A = 0;
146 let B = 0;
147 let C = 0;
148}
149
Evan Chengb783fa32007-07-19 01:14:50 +0000150class DForm_5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
151 InstrItinClass itin>
152 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000153 bits<3> BF;
154 bits<1> L;
155 bits<5> RA;
156 bits<16> I;
157
158 let Inst{6-8} = BF;
159 let Inst{9} = 0;
160 let Inst{10} = L;
161 let Inst{11-15} = RA;
162 let Inst{16-31} = I;
163}
164
Evan Chengb783fa32007-07-19 01:14:50 +0000165class DForm_5_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
166 InstrItinClass itin>
167 : DForm_5<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000168 let L = PPC64;
169}
170
Evan Chengb783fa32007-07-19 01:14:50 +0000171class DForm_6<bits<6> opcode, dag OOL, dag IOL, string asmstr,
172 InstrItinClass itin>
173 : DForm_5<opcode, OOL, IOL, asmstr, itin>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000174
Evan Chengb783fa32007-07-19 01:14:50 +0000175class DForm_6_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
176 InstrItinClass itin>
177 : DForm_6<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000178 let L = PPC64;
179}
180
181
182// 1.7.5 DS-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000183class DSForm_1<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000184 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000185 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000186 bits<5> RST;
187 bits<14> DS;
188 bits<5> RA;
189
190 let Pattern = pattern;
191
192 let Inst{6-10} = RST;
193 let Inst{11-15} = RA;
194 let Inst{16-29} = DS;
195 let Inst{30-31} = xo;
196}
197
198// 1.7.6 X-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000199class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000200 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000201 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000202 bits<5> RST;
203 bits<5> A;
204 bits<5> B;
205
206 let Pattern = pattern;
207
208 bit RC = 0; // set by isDOT
209
210 let Inst{6-10} = RST;
211 let Inst{11-15} = A;
212 let Inst{16-20} = B;
213 let Inst{21-30} = xo;
214 let Inst{31} = RC;
215}
216
217// This is the same as XForm_base_r3xo, but the first two operands are swapped
218// when code is emitted.
219class XForm_base_r3xo_swapped
Evan Chengb783fa32007-07-19 01:14:50 +0000220 <bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000221 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000222 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000223 bits<5> A;
224 bits<5> RST;
225 bits<5> B;
226
227 bit RC = 0; // set by isDOT
228
229 let Inst{6-10} = RST;
230 let Inst{11-15} = A;
231 let Inst{16-20} = B;
232 let Inst{21-30} = xo;
233 let Inst{31} = RC;
234}
235
236
Evan Chengb783fa32007-07-19 01:14:50 +0000237class XForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000238 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000239 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000240
Evan Chengb783fa32007-07-19 01:14:50 +0000241class XForm_6<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000242 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000243 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000244 let Pattern = pattern;
245}
246
Evan Chengb783fa32007-07-19 01:14:50 +0000247class XForm_8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000248 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000249 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000250
Evan Chengb783fa32007-07-19 01:14:50 +0000251class XForm_10<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000252 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000253 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000254 let Pattern = pattern;
255}
256
Evan Chengb783fa32007-07-19 01:14:50 +0000257class XForm_11<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000258 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000259 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000260 let B = 0;
261 let Pattern = pattern;
262}
263
Evan Chengb783fa32007-07-19 01:14:50 +0000264class XForm_16<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000265 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000266 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000267 bits<3> BF;
268 bits<1> L;
269 bits<5> RA;
270 bits<5> RB;
271
272 let Inst{6-8} = BF;
273 let Inst{9} = 0;
274 let Inst{10} = L;
275 let Inst{11-15} = RA;
276 let Inst{16-20} = RB;
277 let Inst{21-30} = xo;
278 let Inst{31} = 0;
279}
280
Evan Chengb783fa32007-07-19 01:14:50 +0000281class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000282 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000283 : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000284 let L = PPC64;
285}
286
Evan Chengb783fa32007-07-19 01:14:50 +0000287class XForm_17<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000288 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000289 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000290 bits<3> BF;
291 bits<5> FRA;
292 bits<5> FRB;
293
294 let Inst{6-8} = BF;
295 let Inst{9-10} = 0;
296 let Inst{11-15} = FRA;
297 let Inst{16-20} = FRB;
298 let Inst{21-30} = xo;
299 let Inst{31} = 0;
300}
301
Evan Chengb783fa32007-07-19 01:14:50 +0000302class XForm_25<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000303 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000304 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000305}
306
Evan Chengb783fa32007-07-19 01:14:50 +0000307class XForm_26<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000308 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000309 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000310 let A = 0;
311}
312
Evan Chengb783fa32007-07-19 01:14:50 +0000313class XForm_28<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000314 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000315 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000316}
317
Dale Johannesen3d8578b2007-10-10 01:01:31 +0000318// This is used for MFFS, MTFSB0, MTFSB1. 42 is arbitrary; this series of
319// numbers presumably relates to some document, but I haven't found it.
320class XForm_42<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
321 InstrItinClass itin, list<dag> pattern>
322 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
323 let Pattern = pattern;
324
325 bit RC = 0; // set by isDOT
326
327 let Inst{6-10} = RST;
328 let Inst{11-20} = 0;
329 let Inst{21-30} = xo;
330 let Inst{31} = RC;
331}
332class XForm_43<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
333 InstrItinClass itin, list<dag> pattern>
334 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
335 let Pattern = pattern;
336 bits<5> FM;
337
338 bit RC = 0; // set by isDOT
339
340 let Inst{6-10} = FM;
341 let Inst{11-20} = 0;
342 let Inst{21-30} = xo;
343 let Inst{31} = RC;
344}
345
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000346// DCB_Form - Form X instruction, used for dcb* instructions.
Evan Chengb783fa32007-07-19 01:14:50 +0000347class DCB_Form<bits<10> xo, bits<5> immfield, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000348 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000349 : I<31, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000350 bits<5> A;
351 bits<5> B;
352
353 let Pattern = pattern;
354
355 let Inst{6-10} = immfield;
356 let Inst{11-15} = A;
357 let Inst{16-20} = B;
358 let Inst{21-30} = xo;
359 let Inst{31} = 0;
360}
361
362
363// DSS_Form - Form X instruction, used for altivec dss* instructions.
Evan Chengb783fa32007-07-19 01:14:50 +0000364class DSS_Form<bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000365 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000366 : I<31, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000367 bits<1> T;
368 bits<2> STRM;
369 bits<5> A;
370 bits<5> B;
371
372 let Pattern = pattern;
373
374 let Inst{6} = T;
375 let Inst{7-8} = 0;
376 let Inst{9-10} = STRM;
377 let Inst{11-15} = A;
378 let Inst{16-20} = B;
379 let Inst{21-30} = xo;
380 let Inst{31} = 0;
381}
382
383// 1.7.7 XL-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000384class XLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000385 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000386 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000387 bits<5> CRD;
388 bits<5> CRA;
389 bits<5> CRB;
390
391 let Pattern = pattern;
392
393 let Inst{6-10} = CRD;
394 let Inst{11-15} = CRA;
395 let Inst{16-20} = CRB;
396 let Inst{21-30} = xo;
397 let Inst{31} = 0;
398}
399
Evan Chengb783fa32007-07-19 01:14:50 +0000400class XLForm_1_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000401 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000402 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000403 bits<5> CRD;
404
405 let Pattern = pattern;
406
407 let Inst{6-10} = CRD;
408 let Inst{11-15} = CRD;
409 let Inst{16-20} = CRD;
410 let Inst{21-30} = xo;
411 let Inst{31} = 0;
412}
413
Evan Chengb783fa32007-07-19 01:14:50 +0000414class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000415 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000416 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000417 bits<5> BO;
418 bits<5> BI;
419 bits<2> BH;
420
421 let Pattern = pattern;
422
423 let Inst{6-10} = BO;
424 let Inst{11-15} = BI;
425 let Inst{16-18} = 0;
426 let Inst{19-20} = BH;
427 let Inst{21-30} = xo;
428 let Inst{31} = lk;
429}
430
431class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
Evan Chengb783fa32007-07-19 01:14:50 +0000432 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
433 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000434 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
435 bits<3> CR;
436
437 let BO = BIBO{2-6};
438 let BI{0-1} = BIBO{0-1};
439 let BI{2-4} = CR;
440 let BH = 0;
441}
442
443
444class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo, bits<5> bi, bit lk,
Evan Chengb783fa32007-07-19 01:14:50 +0000445 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
446 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000447 let BO = bo;
448 let BI = bi;
449 let BH = 0;
450}
451
Evan Chengb783fa32007-07-19 01:14:50 +0000452class XLForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000453 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000454 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000455 bits<3> BF;
456 bits<3> BFA;
457
458 let Inst{6-8} = BF;
459 let Inst{9-10} = 0;
460 let Inst{11-13} = BFA;
461 let Inst{14-15} = 0;
462 let Inst{16-20} = 0;
463 let Inst{21-30} = xo;
464 let Inst{31} = 0;
465}
466
467// 1.7.8 XFX-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000468class XFXForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000469 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000470 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000471 bits<5> RT;
472 bits<10> SPR;
473
474 let Inst{6-10} = RT;
475 let Inst{11} = SPR{4};
476 let Inst{12} = SPR{3};
477 let Inst{13} = SPR{2};
478 let Inst{14} = SPR{1};
479 let Inst{15} = SPR{0};
480 let Inst{16} = SPR{9};
481 let Inst{17} = SPR{8};
482 let Inst{18} = SPR{7};
483 let Inst{19} = SPR{6};
484 let Inst{20} = SPR{5};
485 let Inst{21-30} = xo;
486 let Inst{31} = 0;
487}
488
489class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
Evan Chengb783fa32007-07-19 01:14:50 +0000490 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
491 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000492 let SPR = spr;
493}
494
Evan Chengb783fa32007-07-19 01:14:50 +0000495class XFXForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000496 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000497 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000498 bits<5> RT;
499
500 let Inst{6-10} = RT;
501 let Inst{11-20} = 0;
502 let Inst{21-30} = xo;
503 let Inst{31} = 0;
504}
505
Evan Chengb783fa32007-07-19 01:14:50 +0000506class XFXForm_5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000507 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000508 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000509 bits<8> FXM;
510 bits<5> ST;
511
512 let Inst{6-10} = ST;
513 let Inst{11} = 0;
514 let Inst{12-19} = FXM;
515 let Inst{20} = 0;
516 let Inst{21-30} = xo;
517 let Inst{31} = 0;
518}
519
Evan Chengb783fa32007-07-19 01:14:50 +0000520class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000521 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000522 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000523 bits<5> ST;
524 bits<8> FXM;
525
526 let Inst{6-10} = ST;
527 let Inst{11} = 1;
528 let Inst{12-19} = FXM;
529 let Inst{20} = 0;
530 let Inst{21-30} = xo;
531 let Inst{31} = 0;
532}
533
Evan Chengb783fa32007-07-19 01:14:50 +0000534class XFXForm_7<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000535 InstrItinClass itin>
Evan Chengb783fa32007-07-19 01:14:50 +0000536 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000537
538class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
Evan Chengb783fa32007-07-19 01:14:50 +0000539 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
540 : XFXForm_7<opcode, xo, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000541 let SPR = spr;
542}
543
Dale Johannesen3d8578b2007-10-10 01:01:31 +0000544// XFL-Form - MTFSF
545// This is probably 1.7.9, but I don't have the reference that uses this
546// numbering scheme...
547class XFLForm<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
548 string cstr, InstrItinClass itin, list<dag>pattern>
549 : I<opcode, OOL, IOL, asmstr, itin> {
550 bits<8> FM;
551 bits<5> RT;
552
553 bit RC = 0; // set by isDOT
554 let Pattern = pattern;
555 let Constraints = cstr;
556
557 let Inst{6} = 0;
558 let Inst{7-14} = FM;
559 let Inst{15} = 0;
560 let Inst{16-20} = RT;
561 let Inst{21-30} = xo;
562 let Inst{31} = RC;
563}
564
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000565// 1.7.10 XS-Form - SRADI.
Evan Chengb783fa32007-07-19 01:14:50 +0000566class XSForm_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000567 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000568 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000569 bits<5> A;
570 bits<5> RS;
571 bits<6> SH;
572
573 bit RC = 0; // set by isDOT
574 let Pattern = pattern;
575
576 let Inst{6-10} = RS;
577 let Inst{11-15} = A;
578 let Inst{16-20} = SH{4,3,2,1,0};
579 let Inst{21-29} = xo;
580 let Inst{30} = SH{5};
581 let Inst{31} = RC;
582}
583
584// 1.7.11 XO-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000585class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000586 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000587 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000588 bits<5> RT;
589 bits<5> RA;
590 bits<5> RB;
591
592 let Pattern = pattern;
593
594 bit RC = 0; // set by isDOT
595
596 let Inst{6-10} = RT;
597 let Inst{11-15} = RA;
598 let Inst{16-20} = RB;
599 let Inst{21} = oe;
600 let Inst{22-30} = xo;
601 let Inst{31} = RC;
602}
603
604class XOForm_3<bits<6> opcode, bits<9> xo, bit oe,
Evan Chengb783fa32007-07-19 01:14:50 +0000605 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
606 : XOForm_1<opcode, xo, oe, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000607 let RB = 0;
608}
609
610// 1.7.12 A-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000611class AForm_1<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000612 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000613 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000614 bits<5> FRT;
615 bits<5> FRA;
616 bits<5> FRC;
617 bits<5> FRB;
618
619 let Pattern = pattern;
620
621 bit RC = 0; // set by isDOT
622
623 let Inst{6-10} = FRT;
624 let Inst{11-15} = FRA;
625 let Inst{16-20} = FRB;
626 let Inst{21-25} = FRC;
627 let Inst{26-30} = xo;
628 let Inst{31} = RC;
629}
630
Evan Chengb783fa32007-07-19 01:14:50 +0000631class AForm_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000632 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000633 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000634 let FRC = 0;
635}
636
Evan Chengb783fa32007-07-19 01:14:50 +0000637class AForm_3<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000638 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000639 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000640 let FRB = 0;
641}
642
643// 1.7.13 M-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000644class MForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000645 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000646 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000647 bits<5> RA;
648 bits<5> RS;
649 bits<5> RB;
650 bits<5> MB;
651 bits<5> ME;
652
653 let Pattern = pattern;
654
655 bit RC = 0; // set by isDOT
656
657 let Inst{6-10} = RS;
658 let Inst{11-15} = RA;
659 let Inst{16-20} = RB;
660 let Inst{21-25} = MB;
661 let Inst{26-30} = ME;
662 let Inst{31} = RC;
663}
664
Evan Chengb783fa32007-07-19 01:14:50 +0000665class MForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000666 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000667 : MForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000668}
669
670// 1.7.14 MD-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000671class MDForm_1<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000672 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000673 : I<opcode, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000674 bits<5> RA;
675 bits<5> RS;
676 bits<6> SH;
677 bits<6> MBE;
678
679 let Pattern = pattern;
680
681 bit RC = 0; // set by isDOT
682
683 let Inst{6-10} = RS;
684 let Inst{11-15} = RA;
685 let Inst{16-20} = SH{4,3,2,1,0};
686 let Inst{21-26} = MBE{4,3,2,1,0,5};
687 let Inst{27-29} = xo;
688 let Inst{30} = SH{5};
689 let Inst{31} = RC;
690}
691
692
693
694// E-1 VA-Form
695
696// VAForm_1 - DACB ordering.
Evan Chengb783fa32007-07-19 01:14:50 +0000697class VAForm_1<bits<6> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000698 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000699 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000700 bits<5> VD;
701 bits<5> VA;
702 bits<5> VC;
703 bits<5> VB;
704
705 let Pattern = pattern;
706
707 let Inst{6-10} = VD;
708 let Inst{11-15} = VA;
709 let Inst{16-20} = VB;
710 let Inst{21-25} = VC;
711 let Inst{26-31} = xo;
712}
713
714// VAForm_1a - DABC ordering.
Evan Chengb783fa32007-07-19 01:14:50 +0000715class VAForm_1a<bits<6> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000716 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000717 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000718 bits<5> VD;
719 bits<5> VA;
720 bits<5> VB;
721 bits<5> VC;
722
723 let Pattern = pattern;
724
725 let Inst{6-10} = VD;
726 let Inst{11-15} = VA;
727 let Inst{16-20} = VB;
728 let Inst{21-25} = VC;
729 let Inst{26-31} = xo;
730}
731
Evan Chengb783fa32007-07-19 01:14:50 +0000732class VAForm_2<bits<6> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000733 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000734 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000735 bits<5> VD;
736 bits<5> VA;
737 bits<5> VB;
738 bits<4> SH;
739
740 let Pattern = pattern;
741
742 let Inst{6-10} = VD;
743 let Inst{11-15} = VA;
744 let Inst{16-20} = VB;
745 let Inst{21} = 0;
746 let Inst{22-25} = SH;
747 let Inst{26-31} = xo;
748}
749
750// E-2 VX-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000751class VXForm_1<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000752 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000753 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000754 bits<5> VD;
755 bits<5> VA;
756 bits<5> VB;
757
758 let Pattern = pattern;
759
760 let Inst{6-10} = VD;
761 let Inst{11-15} = VA;
762 let Inst{16-20} = VB;
763 let Inst{21-31} = xo;
764}
765
Evan Chengb783fa32007-07-19 01:14:50 +0000766class VXForm_setzero<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000767 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000768 : VXForm_1<xo, OOL, IOL, asmstr, itin, pattern> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000769 let VA = VD;
770 let VB = VD;
771}
772
773
Evan Chengb783fa32007-07-19 01:14:50 +0000774class VXForm_2<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000775 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000776 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000777 bits<5> VD;
778 bits<5> VB;
779
780 let Pattern = pattern;
781
782 let Inst{6-10} = VD;
783 let Inst{11-15} = 0;
784 let Inst{16-20} = VB;
785 let Inst{21-31} = xo;
786}
787
Evan Chengb783fa32007-07-19 01:14:50 +0000788class VXForm_3<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000789 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000790 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000791 bits<5> VD;
792 bits<5> IMM;
793
794 let Pattern = pattern;
795
796 let Inst{6-10} = VD;
797 let Inst{11-15} = IMM;
798 let Inst{16-20} = 0;
799 let Inst{21-31} = xo;
800}
801
802/// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
Evan Chengb783fa32007-07-19 01:14:50 +0000803class VXForm_4<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000804 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000805 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000806 bits<5> VD;
807
808 let Pattern = pattern;
809
810 let Inst{6-10} = VD;
811 let Inst{11-15} = 0;
812 let Inst{16-20} = 0;
813 let Inst{21-31} = xo;
814}
815
816/// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
Evan Chengb783fa32007-07-19 01:14:50 +0000817class VXForm_5<bits<11> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000818 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000819 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000820 bits<5> VB;
821
822 let Pattern = pattern;
823
824 let Inst{6-10} = 0;
825 let Inst{11-15} = 0;
826 let Inst{16-20} = VB;
827 let Inst{21-31} = xo;
828}
829
830// E-4 VXR-Form
Evan Chengb783fa32007-07-19 01:14:50 +0000831class VXRForm_1<bits<10> xo, dag OOL, dag IOL, string asmstr,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000832 InstrItinClass itin, list<dag> pattern>
Evan Chengb783fa32007-07-19 01:14:50 +0000833 : I<4, OOL, IOL, asmstr, itin> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000834 bits<5> VD;
835 bits<5> VA;
836 bits<5> VB;
837 bit RC = 0;
838
839 let Pattern = pattern;
840
841 let Inst{6-10} = VD;
842 let Inst{11-15} = VA;
843 let Inst{16-20} = VB;
844 let Inst{21} = RC;
845 let Inst{22-31} = xo;
846}
847
848//===----------------------------------------------------------------------===//
Evan Chengb783fa32007-07-19 01:14:50 +0000849class Pseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
850 : I<0, OOL, IOL, asmstr, NoItinerary> {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000851 let PPC64 = 0;
852 let Pattern = pattern;
853 let Inst{31-0} = 0;
854}