blob: b20b2599db51464d3b738b47dd647bc002e548ea [file] [log] [blame]
Misha Brukmancd4f51b2004-08-02 16:54:54 +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
13class Format<bits<5> val> {
Misha Brukman189f3dc2004-10-14 05:55:37 +000014 bits<5> Value = val;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000015}
16
17def Pseudo: Format<0>;
18def Gpr : Format<1>;
19def Gpr0 : Format<2>;
20def Simm16 : Format<3>;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000021def PCRelimm24 : Format<5>;
22def Imm24 : Format<6>;
23def Imm5 : Format<7>;
24def PCRelimm14 : Format<8>;
25def Imm14 : Format<9>;
26def Imm2 : Format<10>;
27def Crf : Format<11>;
28def Imm3 : Format<12>;
29def Imm1 : Format<13>;
30def Fpr : Format<14>;
31def Imm4 : Format<15>;
32def Imm8 : Format<16>;
33def Disimm16 : Format<17>;
34def Disimm14 : Format<18>;
35def Spr : Format<19>;
36def Sgr : Format<20>;
37def Imm15 : Format<21>;
38def Vpr : Format<22>;
Nate Begeman765cb5f2004-08-13 02:19:26 +000039def Imm6 : Format<23>;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000040
Misha Brukman6b21bde2004-08-02 21:56:35 +000041//===----------------------------------------------------------------------===//
42//
43// PowerPC instruction formats
Misha Brukmancd4f51b2004-08-02 16:54:54 +000044
Nate Begeman4bfceb12004-09-04 05:00:00 +000045class I<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
46 : Instruction {
Misha Brukman6b21bde2004-08-02 21:56:35 +000047 field bits<32> Inst;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000048
Misha Brukman6b21bde2004-08-02 21:56:35 +000049 bits<3> ArgCount;
50 bits<5> Arg0Type;
51 bits<5> Arg1Type;
52 bits<5> Arg2Type;
53 bits<5> Arg3Type;
54 bits<5> Arg4Type;
55 bit PPC64 = ppc64;
56 bit VMX = vmx;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000057
Nate Begeman4bfceb12004-09-04 05:00:00 +000058 let Name = "";
Misha Brukmandad438b2004-08-10 22:47:03 +000059 let Namespace = "PPC";
Misha Brukman5295e1d2004-08-09 17:24:04 +000060 let Inst{0-5} = opcode;
Nate Begeman4bfceb12004-09-04 05:00:00 +000061 let OperandList = OL;
62 let AsmString = asmstr;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000063}
64
Misha Brukman5295e1d2004-08-09 17:24:04 +000065// 1.7.1 I-Form
Nate Begeman61738782004-09-02 08:13:00 +000066class IForm<bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +000067 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +000068 bits<24> LI;
Misha Brukman6b21bde2004-08-02 21:56:35 +000069
Misha Brukman5295e1d2004-08-09 17:24:04 +000070 let ArgCount = 1;
71 let Arg0Type = Imm24.Value;
72 let Arg1Type = 0;
73 let Arg2Type = 0;
Misha Brukman6b21bde2004-08-02 21:56:35 +000074 let Arg3Type = 0;
75 let Arg4Type = 0;
76
Misha Brukman5295e1d2004-08-09 17:24:04 +000077 let Inst{6-29} = LI;
78 let Inst{30} = aa;
79 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +000080}
81
Misha Brukman5295e1d2004-08-09 17:24:04 +000082// 1.7.2 B-Form
Nate Begeman4bfceb12004-09-04 05:00:00 +000083class BForm<bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx,
84 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +000085 bits<5> BO;
86 bits<5> BI;
87 bits<14> BD;
Misha Brukman5295e1d2004-08-09 17:24:04 +000088
89 let ArgCount = 3;
90 let Arg0Type = Imm5.Value;
91 let Arg1Type = Imm5.Value;
92 let Arg2Type = PCRelimm14.Value;
93 let Arg3Type = 0;
94 let Arg4Type = 0;
95
96 let Inst{6-10} = BO;
97 let Inst{11-15} = BI;
98 let Inst{16-29} = BD;
99 let Inst{30} = aa;
100 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000101}
102
Nate Begeman4bfceb12004-09-04 05:00:00 +0000103class BForm_ext<bits<6> opcode, bit aa, bit lk, bits<5> bo, bits<5> bi,
104 bit ppc64, bit vmx, dag OL, string asmstr>
105 : BForm<opcode, aa, lk, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000106 let ArgCount = 2;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000107 let Arg2Type = Imm5.Value;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000108 let Arg1Type = PCRelimm14.Value;
109 let Arg2Type = 0;
110 let BO = bo;
111 let BI = bi;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000112}
113
Misha Brukman5295e1d2004-08-09 17:24:04 +0000114// 1.7.4 D-Form
Nate Begeman4bfceb12004-09-04 05:00:00 +0000115class DForm_base<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
116 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000117 bits<5> A;
118 bits<5> B;
119 bits<16> C;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000120
121 let ArgCount = 3;
122 let Arg0Type = Gpr.Value;
123 let Arg1Type = Gpr.Value;
124 let Arg2Type = Simm16.Value;
125 let Arg3Type = 0;
126 let Arg4Type = 0;
127
128 let Inst{6-10} = A;
129 let Inst{11-15} = B;
130 let Inst{16-31} = C;
131}
132
Nate Begeman4bfceb12004-09-04 05:00:00 +0000133class DForm_1<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
Misha Brukman15b0fb52004-10-23 06:08:38 +0000134 : I<opcode, ppc64, vmx, OL, asmstr> {
135 bits<5> A;
136 bits<16> C;
137 bits<5> B;
138
139 let ArgCount = 3;
140 let Arg0Type = Gpr.Value;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000141 let Arg1Type = Disimm16.Value;
Nate Begeman4bfceb12004-09-04 05:00:00 +0000142 let Arg2Type = Gpr.Value;
Misha Brukman15b0fb52004-10-23 06:08:38 +0000143 let Arg3Type = 0;
144 let Arg4Type = 0;
145
146 let Inst{6-10} = A;
147 let Inst{11-15} = B;
148 let Inst{16-31} = C;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000149}
150
Nate Begeman4bfceb12004-09-04 05:00:00 +0000151class DForm_2<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
152 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000153
Nate Begeman4bfceb12004-09-04 05:00:00 +0000154class DForm_2_r0<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
155 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000156 bits<5> A;
157 bits<16> B;
Nate Begeman4bfceb12004-09-04 05:00:00 +0000158
159 let ArgCount = 2;
160 let Arg0Type = Gpr.Value;
161 let Arg1Type = Simm16.Value;
162 let Arg2Type = 0;
163 let Arg3Type = 0;
164 let Arg4Type = 0;
165
166 let Inst{6-10} = A;
167 let Inst{11-15} = 0;
168 let Inst{16-31} = B;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000169}
170
171// Currently we make the use/def reg distinction in ISel, not tablegen
Nate Begeman4bfceb12004-09-04 05:00:00 +0000172class DForm_3<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
173 : DForm_1<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000174
Nate Begeman4bfceb12004-09-04 05:00:00 +0000175class DForm_4<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
176 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
177
178class DForm_4_zero<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
179 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000180 let ArgCount = 0;
181 let Arg0Type = 0;
182 let Arg1Type = 0;
183 let Arg2Type = 0;
184 let A = 0;
185 let B = 0;
186 let C = 0;
187}
188
Nate Begeman4bfceb12004-09-04 05:00:00 +0000189class DForm_5<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
190 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000191 bits<3> BF;
192 bits<1> L;
193 bits<5> RA;
194 bits<16> I;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000195
196 let ArgCount = 4;
197 let Arg0Type = Imm3.Value;
198 let Arg1Type = Imm1.Value;
199 let Arg2Type = Gpr.Value;
200 let Arg3Type = Simm16.Value;
201 let Arg4Type = 0;
202
203 let Inst{6-8} = BF;
204 let Inst{9} = 0;
205 let Inst{10} = L;
206 let Inst{11-15} = RA;
207 let Inst{16-31} = I;
208}
209
Nate Begeman4bfceb12004-09-04 05:00:00 +0000210class DForm_5_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
211 : DForm_5<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000212 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000213 let ArgCount = 3;
214 let Arg0Type = Imm3.Value;
215 let Arg1Type = Gpr.Value;
216 let Arg2Type = Simm16.Value;
217 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000218}
219
Nate Begeman4bfceb12004-09-04 05:00:00 +0000220class DForm_6<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
221 : DForm_5<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000222
Nate Begeman4bfceb12004-09-04 05:00:00 +0000223class DForm_6_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000224 : DForm_6<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000225 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000226 let ArgCount = 3;
227 let Arg0Type = Imm3.Value;
228 let Arg1Type = Gpr.Value;
229 let Arg2Type = Simm16.Value;
230 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000231}
232
Nate Begeman4bfceb12004-09-04 05:00:00 +0000233class DForm_8<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
234 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000235 let Arg0Type = Fpr.Value;
236}
237
Nate Begeman4bfceb12004-09-04 05:00:00 +0000238class DForm_9<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
239 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000240 let Arg0Type = Fpr.Value;
241}
242
Misha Brukman28beda92004-08-11 15:54:36 +0000243// 1.7.5 DS-Form
Nate Begeman4bfceb12004-09-04 05:00:00 +0000244class DSForm_1<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
245 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000246 bits<5> RST;
247 bits<14> DS;
248 bits<5> RA;
Misha Brukman28beda92004-08-11 15:54:36 +0000249
250 let ArgCount = 3;
251 let Arg0Type = Gpr.Value;
252 let Arg1Type = Disimm14.Value;
253 let Arg2Type = Gpr.Value;
254 let Arg3Type = 0;
255 let Arg4Type = 0;
256
257 let Inst{6-10} = RST;
258 let Inst{11-15} = RA;
259 let Inst{16-29} = DS;
260 let Inst{30-31} = xo;
261}
262
Nate Begeman4bfceb12004-09-04 05:00:00 +0000263class DSForm_2<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
264 dag OL, string asmstr>
265 : DSForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman28beda92004-08-11 15:54:36 +0000266
Misha Brukman5295e1d2004-08-09 17:24:04 +0000267// 1.7.6 X-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000268class XForm_base_r3xo<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000269 dag OL, string asmstr>
270 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000271 bits<5> RST;
272 bits<5> A;
273 bits<5> B;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000274
275 let ArgCount = 3;
276 let Arg0Type = Gpr.Value;
277 let Arg1Type = Gpr.Value;
278 let Arg2Type = Gpr.Value;
279 let Arg3Type = 0;
280 let Arg4Type = 0;
281
Misha Brukman28beda92004-08-11 15:54:36 +0000282 let Inst{6-10} = RST;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000283 let Inst{11-15} = A;
284 let Inst{16-20} = B;
285 let Inst{21-30} = xo;
286 let Inst{31} = rc;
287}
288
Nate Begeman765cb5f2004-08-13 02:19:26 +0000289
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000290class XForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
291 dag OL, string asmstr>
292 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000293
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000294class XForm_5<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
295 dag OL, string asmstr>
296 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000297 let ArgCount = 1;
298 let Arg1Type = 0;
299 let Arg2Type = 0;
300 let A = 0;
301 let B = 0;
302}
303
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000304class XForm_6<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
305 dag OL, string asmstr>
306 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000307
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000308class XForm_8<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
309 dag OL, string asmstr>
310 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000311
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000312class XForm_10<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
313 dag OL, string asmstr>
314 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000315 let Arg2Type = Imm5.Value;
316}
317
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000318class XForm_11<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
319 dag OL, string asmstr>
320 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000321 let ArgCount = 2;
322 let Arg2Type = 0;
323 let B = 0;
324}
325
Nate Begeman61738782004-09-02 08:13:00 +0000326class XForm_16<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000327 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000328 bits<3> BF;
329 bits<1> L;
330 bits<5> RA;
331 bits<5> RB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000332
333 let ArgCount = 4;
334 let Arg0Type = Imm3.Value;
335 let Arg1Type = Imm1.Value;
336 let Arg2Type = Gpr.Value;
337 let Arg3Type = Gpr.Value;
338 let Arg4Type = 0;
339
340 let Inst{6-8} = BF;
341 let Inst{9} = 0;
342 let Inst{10} = L;
343 let Inst{11-15} = RA;
344 let Inst{16-20} = RB;
345 let Inst{21-30} = xo;
346 let Inst{31} = 0;
347}
348
Nate Begeman61738782004-09-02 08:13:00 +0000349class XForm_16_ext<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
350 dag OL, string asmstr>
351 : XForm_16<opcode, xo, ppc64, vmx, OL, asmstr> {
352 let ArgCount = 3;
353 let Arg1Type = Gpr.Value;
354 let Arg2Type = Gpr.Value;
355 let Arg3Type = 0;
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000356 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000357}
358
Nate Begemana113d742004-08-31 02:28:08 +0000359class XForm_17<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000360 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000361 bits<3> BF;
362 bits<5> FRA;
363 bits<5> FRB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000364
365 let ArgCount = 3;
366 let Arg0Type = Imm3.Value;
367 let Arg1Type = Fpr.Value;
368 let Arg2Type = Fpr.Value;
369 let Arg3Type = 0;
370 let Arg4Type = 0;
371
372 let Inst{6-8} = BF;
373 let Inst{9-10} = 0;
374 let Inst{11-15} = FRA;
375 let Inst{16-20} = FRB;
376 let Inst{21-30} = xo;
377 let Inst{31} = 0;
378}
379
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000380class XForm_25<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
381 dag OL, string asmstr>
382 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000383 let Arg0Type = Fpr.Value;
384 let Arg1Type = Gpr0.Value;
385}
386
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000387class XForm_26<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
388 dag OL, string asmstr>
389 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000390 let ArgCount = 2;
391 let Arg0Type = Fpr.Value;
392 let Arg1Type = Fpr.Value;
393 let Arg2Type = 0;
394 let A = 0;
395}
396
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000397class XForm_28<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
398 dag OL, string asmstr>
399 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000400 let Arg0Type = Fpr.Value;
401 let Arg1Type = Gpr0.Value;
402}
403
404// 1.7.7 XL-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000405class XLForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
406 dag OL, string asmstr>
407 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000408 let Arg0Type = Imm5.Value;
409 let Arg1Type = Imm5.Value;
410 let Arg2Type = Imm5.Value;
411}
412
Nate Begeman61738782004-09-02 08:13:00 +0000413class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000414 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000415 bits<5> BO;
416 bits<5> BI;
417 bits<2> BH;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000418
419 let ArgCount = 3;
420 let Arg0Type = Imm5.Value;
421 let Arg1Type = Imm5.Value;
422 let Arg2Type = Imm2.Value;
423 let Arg3Type = 0;
424 let Arg4Type = 0;
425
426 let Inst{6-10} = BO;
427 let Inst{11-15} = BI;
428 let Inst{16-18} = 0;
429 let Inst{19-20} = BH;
430 let Inst{21-30} = xo;
431 let Inst{31} = lk;
432}
433
Nate Begeman61738782004-09-02 08:13:00 +0000434class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,
435 bits<5> bi, bit lk, bit ppc64, bit vmx,
436 dag OL, string asmstr>
437 : XLForm_2<opcode, xo, lk, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000438 let ArgCount = 0;
439 let Arg0Type = 0;
440 let Arg1Type = 0;
441 let Arg2Type = 0;
442 let BO = bo;
443 let BI = bi;
444 let BH = 0;
445}
446
447// 1.7.8 XFX-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000448class XFXForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000449 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000450 bits<5> ST;
451 bits<10> SPR;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000452
453 let ArgCount = 2;
454 let Arg0Type = Imm5.Value;
455 let Arg1Type = Gpr.Value;
456 let Arg2Type = 0;
457 let Arg3Type = 0;
458 let Arg4Type = 0;
459
460 let Inst{6-10} = ST;
461 let Inst{11-20} = SPR;
462 let Inst{21-30} = xo;
463 let Inst{31} = 0;
464}
465
Nate Begeman143cf942004-08-30 02:28:06 +0000466class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, bit ppc64,
467 bit vmx, dag OL, string asmstr>
468 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000469 let ArgCount = 1;
470 let Arg0Type = Gpr.Value;
471 let Arg1Type = 0;
472 let SPR = spr;
473}
474
Nate Begeman143cf942004-08-30 02:28:06 +0000475class XFXForm_7<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
476 dag OL, string asmstr>
477 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000478
Nate Begeman143cf942004-08-30 02:28:06 +0000479class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
480 bit ppc64, bit vmx, dag OL, string asmstr>
481 : XFXForm_7<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000482 let ArgCount = 1;
483 let Arg0Type = Gpr.Value;
484 let Arg1Type = 0;
485 let SPR = spr;
486}
487
Nate Begeman765cb5f2004-08-13 02:19:26 +0000488// 1.7.10 XS-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000489class XSForm_1<bits<6> opcode, bits<9> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000490 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000491 bits<5> RS;
492 bits<5> A;
493 bits<6> SH;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000494
495 let ArgCount = 3;
496 let Arg0Type = Gpr.Value;
497 let Arg1Type = Gpr.Value;
498 let Arg2Type = Imm6.Value;
499 let Arg3Type = 0;
500 let Arg4Type = 0;
501
502 let Inst{6-10} = RS;
503 let Inst{11-15} = A;
504 let Inst{16-20} = SH{1-5};
505 let Inst{21-29} = xo;
506 let Inst{30} = SH{0};
507 let Inst{31} = rc;
508}
509
Misha Brukman5295e1d2004-08-09 17:24:04 +0000510// 1.7.11 XO-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000511class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000512 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000513 bits<5> RT;
514 bits<5> RA;
515 bits<5> RB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000516
517 let ArgCount = 3;
518 let Arg0Type = Gpr.Value;
519 let Arg1Type = Gpr.Value;
520 let Arg2Type = Gpr.Value;
521 let Arg3Type = 0;
522 let Arg4Type = 0;
523
524 let Inst{6-10} = RT;
525 let Inst{11-15} = RA;
526 let Inst{16-20} = RB;
527 let Inst{21} = oe;
528 let Inst{22-30} = xo;
529 let Inst{31} = rc;
530}
531
Nate Begeman143cf942004-08-30 02:28:06 +0000532class XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
533 dag OL, string asmstr>
534 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000535 let Inst{11-15} = RB;
536 let Inst{16-20} = RA;
537}
538
Nate Begeman143cf942004-08-30 02:28:06 +0000539class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
540 dag OL, string asmstr>
541 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
542 let ArgCount = 2;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000543 let RB = 0;
544}
545
546// 1.7.12 A-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000547class AForm_1<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000548 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000549 let ArgCount = 4;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000550 bits<5> FRT;
551 bits<5> FRA;
552 bits<5> FRB;
553 bits<5> FRC;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000554
555 let Arg0Type = Fpr.Value;
556 let Arg1Type = Fpr.Value;
557 let Arg2Type = Fpr.Value;
558 let Arg3Type = Fpr.Value;
559 let Arg4Type = 0;
560
561 let Inst{6-10} = FRT;
562 let Inst{11-15} = FRA;
563 let Inst{16-20} = FRB;
564 let Inst{21-25} = FRC;
565 let Inst{26-30} = xo;
566 let Inst{31} = rc;
567}
568
Nate Begeman6cdbd222004-08-29 22:45:13 +0000569class AForm_2<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
570 string asmstr>
571 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000572 let ArgCount = 3;
573 let Arg3Type = 0;
574 let FRC = 0;
575}
576
Nate Begeman6cdbd222004-08-29 22:45:13 +0000577class AForm_3<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
578 string asmstr>
579 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000580 let ArgCount = 3;
581 let Arg3Type = 0;
582 let FRB = 0;
583}
584
Misha Brukman5295e1d2004-08-09 17:24:04 +0000585// 1.7.13 M-Form
Nate Begemana113d742004-08-31 02:28:08 +0000586class MForm_1<bits<6> opcode, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000587 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000588 let ArgCount = 5;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000589 bits<5> RA;
Chris Lattner5f4b0e12004-11-23 19:23:32 +0000590 bits<5> RS;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000591 bits<5> RB;
592 bits<5> MB;
593 bits<5> ME;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000594
595 let Arg0Type = Gpr.Value;
596 let Arg1Type = Gpr.Value;
597 let Arg2Type = Gpr.Value;
598 let Arg3Type = Imm5.Value;
599 let Arg4Type = Imm5.Value;
600
601 let Inst{6-10} = RS;
602 let Inst{11-15} = RA;
603 let Inst{16-20} = RB;
604 let Inst{21-25} = MB;
605 let Inst{26-30} = ME;
606 let Inst{31} = rc;
607}
608
Nate Begemana113d742004-08-31 02:28:08 +0000609class MForm_2<bits<6> opcode, bit rc, bit ppc64, bit vmx,
610 dag OL, string asmstr>
611 : MForm_1<opcode, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000612 let Arg2Type = Imm5.Value;
613}
614
Nate Begeman765cb5f2004-08-13 02:19:26 +0000615// 1.7.14 MD-Form
Nate Begemana113d742004-08-31 02:28:08 +0000616class MDForm_1<bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000617 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000618 let ArgCount = 4;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000619 bits<5> RS;
620 bits<5> RA;
621 bits<6> SH;
622 bits<6> MBE;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000623
624 let Arg0Type = Gpr.Value;
625 let Arg1Type = Gpr.Value;
626 let Arg2Type = Imm6.Value;
627 let Arg3Type = Imm6.Value;
628 let Arg4Type = 0;
629
630 let Inst{6-10} = RS;
631 let Inst{11-15} = RA;
632 let Inst{16-20} = SH{1-5};
633 let Inst{21-26} = MBE;
634 let Inst{27-29} = xo;
635 let Inst{30} = SH{0};
636 let Inst{31} = rc;
637}
638
Misha Brukman6b21bde2004-08-02 21:56:35 +0000639//===----------------------------------------------------------------------===//
640
Nate Begeman4bfceb12004-09-04 05:00:00 +0000641class Pseudo<dag OL, string asmstr> : I<0, 0, 0, OL, asmstr> {
Nate Begeman61738782004-09-02 08:13:00 +0000642 let ArgCount = 0;
643 let PPC64 = 0;
644 let VMX = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000645
Nate Begeman61738782004-09-02 08:13:00 +0000646 let Arg0Type = Pseudo.Value;
647 let Arg1Type = Pseudo.Value;
648 let Arg2Type = Pseudo.Value;
649 let Arg3Type = Pseudo.Value;
650 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000651
Nate Begeman61738782004-09-02 08:13:00 +0000652 let Inst{31-0} = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000653}