blob: b5d24fdb8b1d757909a3db6afde22c3550d14eda [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> {
14 bits<5> Value = val;
15}
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
Misha Brukmandad438b2004-08-10 22:47:03 +000045class I<string name, bits<6> opcode, bit ppc64, bit vmx> : Instruction {
Misha Brukman6b21bde2004-08-02 21:56:35 +000046 field bits<32> Inst;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000047
Misha Brukman6b21bde2004-08-02 21:56:35 +000048 bits<3> ArgCount;
49 bits<5> Arg0Type;
50 bits<5> Arg1Type;
51 bits<5> Arg2Type;
52 bits<5> Arg3Type;
53 bits<5> Arg4Type;
54 bit PPC64 = ppc64;
55 bit VMX = vmx;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000056
Misha Brukman6b21bde2004-08-02 21:56:35 +000057 let Name = name;
Misha Brukmandad438b2004-08-10 22:47:03 +000058 let Namespace = "PPC";
Misha Brukman5295e1d2004-08-09 17:24:04 +000059 let Inst{0-5} = opcode;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000060}
61
Misha Brukman5295e1d2004-08-09 17:24:04 +000062// 1.7.1 I-Form
Nate Begeman61738782004-09-02 08:13:00 +000063class IForm<bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx,
64 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +000065 field bits<24> LI;
Misha Brukman6b21bde2004-08-02 21:56:35 +000066
Misha Brukman5295e1d2004-08-09 17:24:04 +000067 let ArgCount = 1;
68 let Arg0Type = Imm24.Value;
69 let Arg1Type = 0;
70 let Arg2Type = 0;
Misha Brukman6b21bde2004-08-02 21:56:35 +000071 let Arg3Type = 0;
72 let Arg4Type = 0;
73
Misha Brukman5295e1d2004-08-09 17:24:04 +000074 let Inst{6-29} = LI;
75 let Inst{30} = aa;
76 let Inst{31} = lk;
Nate Begeman61738782004-09-02 08:13:00 +000077 let OperandList = OL;
78 let AsmString = asmstr;
Misha Brukman6b21bde2004-08-02 21:56:35 +000079}
80
Misha Brukman5295e1d2004-08-09 17:24:04 +000081// 1.7.2 B-Form
82class BForm<string name, bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +000083 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +000084 field bits<5> BO;
85 field bits<5> BI;
86 field bits<14> BD;
87
88 let ArgCount = 3;
89 let Arg0Type = Imm5.Value;
90 let Arg1Type = Imm5.Value;
91 let Arg2Type = PCRelimm14.Value;
92 let Arg3Type = 0;
93 let Arg4Type = 0;
94
95 let Inst{6-10} = BO;
96 let Inst{11-15} = BI;
97 let Inst{16-29} = BD;
98 let Inst{30} = aa;
99 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000100}
101
Misha Brukman5295e1d2004-08-09 17:24:04 +0000102class BForm_ext<string name, bits<6> opcode, bit aa, bit lk, bits<5> bo,
103 bits<5> bi, bit ppc64, bit vmx>
104 : BForm<name, opcode, aa, lk, ppc64, vmx> {
105 let ArgCount = 2;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000106 let Arg2Type = Imm5.Value;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000107 let Arg1Type = PCRelimm14.Value;
108 let Arg2Type = 0;
109 let BO = bo;
110 let BI = bi;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000111}
112
Misha Brukman5295e1d2004-08-09 17:24:04 +0000113// 1.7.4 D-Form
Misha Brukman6b21bde2004-08-02 21:56:35 +0000114class DForm_base<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000115 : I<name, opcode, ppc64, vmx> {
Misha Brukman6b21bde2004-08-02 21:56:35 +0000116 field bits<5> A;
117 field bits<5> B;
118 field bits<16> C;
119
120 let ArgCount = 3;
121 let Arg0Type = Gpr.Value;
122 let Arg1Type = Gpr.Value;
123 let Arg2Type = Simm16.Value;
124 let Arg3Type = 0;
125 let Arg4Type = 0;
126
127 let Inst{6-10} = A;
128 let Inst{11-15} = B;
129 let Inst{16-31} = C;
130}
131
132class DForm_1<string name, bits<6> opcode, bit ppc64, bit vmx>
133 : DForm_base<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000134 let Arg1Type = Disimm16.Value;
135 let Arg2Type = Gpr0.Value;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000136}
137
138class DForm_2<string name, bits<6> opcode, bit ppc64, bit vmx>
139 : DForm_base<name, opcode, ppc64, vmx>;
140
141class DForm_2_r0<string name, bits<6> opcode, bit ppc64, bit vmx>
142 : DForm_base<name, opcode, ppc64, vmx> {
143 let Arg1Type = Gpr0.Value;
144}
145
146// Currently we make the use/def reg distinction in ISel, not tablegen
147class DForm_3<string name, bits<6> opcode, bit ppc64, bit vmx>
148 : DForm_1<name, opcode, ppc64, vmx>;
149
Chris Lattner8a796852004-08-15 05:20:16 +0000150class DForm_4<bits<6> opcode, bit ppc64, bit vmx,
151 dag OL, string asmstr> : DForm_base<"", opcode, ppc64, vmx> {
152 let OperandList = OL;
153 let AsmString = asmstr;
Misha Brukman09d87b42004-08-10 18:07:55 +0000154}
Misha Brukman6b21bde2004-08-02 21:56:35 +0000155
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000156class DForm_4_zero<string name, bits<6> opcode, bit ppc64, bit vmx,
157 dag OL, string asmstr> : DForm_1<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000158 let ArgCount = 0;
159 let Arg0Type = 0;
160 let Arg1Type = 0;
161 let Arg2Type = 0;
162 let A = 0;
163 let B = 0;
164 let C = 0;
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000165 let OperandList = OL;
166 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000167}
168
169class DForm_5<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000170 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000171 field bits<3> BF;
172 field bits<1> L;
173 field bits<5> RA;
174 field bits<16> I;
175
176 let ArgCount = 4;
177 let Arg0Type = Imm3.Value;
178 let Arg1Type = Imm1.Value;
179 let Arg2Type = Gpr.Value;
180 let Arg3Type = Simm16.Value;
181 let Arg4Type = 0;
182
183 let Inst{6-8} = BF;
184 let Inst{9} = 0;
185 let Inst{10} = L;
186 let Inst{11-15} = RA;
187 let Inst{16-31} = I;
188}
189
190class DForm_5_ext<string name, bits<6> opcode, bit ppc64, bit vmx>
191 : DForm_5<name, opcode, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000192 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000193 let ArgCount = 3;
194 let Arg0Type = Imm3.Value;
195 let Arg1Type = Gpr.Value;
196 let Arg2Type = Simm16.Value;
197 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000198}
199
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000200class DForm_6<bits<6> opcode, bit ppc64, bit vmx,
201 dag OL, string asmstr>
202 : DForm_5<"", opcode, ppc64, vmx> {
203 let OperandList = OL;
204 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000205}
206
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000207class DForm_6_ext<bits<6> opcode, bit ppc64, bit vmx,
208 dag OL, string asmstr>
209 : DForm_6<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000210 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000211 let ArgCount = 3;
212 let Arg0Type = Imm3.Value;
213 let Arg1Type = Gpr.Value;
214 let Arg2Type = Simm16.Value;
215 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000216}
217
Misha Brukman6b21bde2004-08-02 21:56:35 +0000218class DForm_7<string name, bits<6> opcode, bit ppc64, bit vmx>
219 : DForm_base<name, opcode, ppc64, vmx> {
220 let Arg1Type = Imm5.Value;
221}
222
Misha Brukman5295e1d2004-08-09 17:24:04 +0000223class DForm_8<string name, bits<6> opcode, bit ppc64, bit vmx>
224 : DForm_1<name, opcode, ppc64, vmx> {
225 let Arg0Type = Fpr.Value;
226}
227
228class DForm_9<string name, bits<6> opcode, bit ppc64, bit vmx>
229 : DForm_1<name, opcode, ppc64, vmx> {
230 let Arg0Type = Fpr.Value;
231}
232
Misha Brukman28beda92004-08-11 15:54:36 +0000233// 1.7.5 DS-Form
234class DSForm_1<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
235 : I<name, opcode, ppc64, vmx> {
236 field bits<5> RST;
237 field bits<14> DS;
238 field bits<5> RA;
239
240 let ArgCount = 3;
241 let Arg0Type = Gpr.Value;
242 let Arg1Type = Disimm14.Value;
243 let Arg2Type = Gpr.Value;
244 let Arg3Type = 0;
245 let Arg4Type = 0;
246
247 let Inst{6-10} = RST;
248 let Inst{11-15} = RA;
249 let Inst{16-29} = DS;
250 let Inst{30-31} = xo;
251}
252
253class DSForm_2<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
254 : DSForm_1<name, opcode, xo, ppc64, vmx>;
255
Misha Brukman5295e1d2004-08-09 17:24:04 +0000256// 1.7.6 X-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000257class XForm_base_r3xo<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
258 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman28beda92004-08-11 15:54:36 +0000259 field bits<5> RST;
260 field bits<5> A;
261 field bits<5> B;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000262
263 let ArgCount = 3;
264 let Arg0Type = Gpr.Value;
265 let Arg1Type = Gpr.Value;
266 let Arg2Type = Gpr.Value;
267 let Arg3Type = 0;
268 let Arg4Type = 0;
269
Misha Brukman28beda92004-08-11 15:54:36 +0000270 let Inst{6-10} = RST;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000271 let Inst{11-15} = A;
272 let Inst{16-20} = B;
273 let Inst{21-30} = xo;
274 let Inst{31} = rc;
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000275 let OperandList = OL;
276 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000277}
278
Nate Begeman765cb5f2004-08-13 02:19:26 +0000279
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000280class XForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
281 dag OL, string asmstr>
282 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000283
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000284class XForm_5<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
285 dag OL, string asmstr>
286 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000287 let ArgCount = 1;
288 let Arg1Type = 0;
289 let Arg2Type = 0;
290 let A = 0;
291 let B = 0;
292}
293
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000294class XForm_6<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
295 dag OL, string asmstr>
296 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000297
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000298class XForm_8<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
299 dag OL, string asmstr>
300 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000301
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000302class XForm_10<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
303 dag OL, string asmstr>
304 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000305 let Arg2Type = Imm5.Value;
306}
307
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000308class XForm_11<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
309 dag OL, string asmstr>
310 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000311 let ArgCount = 2;
312 let Arg2Type = 0;
313 let B = 0;
314}
315
Nate Begeman61738782004-09-02 08:13:00 +0000316class XForm_16<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
317 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000318 field bits<3> BF;
319 field bits<1> L;
320 field bits<5> RA;
321 field bits<5> RB;
322
323 let ArgCount = 4;
324 let Arg0Type = Imm3.Value;
325 let Arg1Type = Imm1.Value;
326 let Arg2Type = Gpr.Value;
327 let Arg3Type = Gpr.Value;
328 let Arg4Type = 0;
329
330 let Inst{6-8} = BF;
331 let Inst{9} = 0;
332 let Inst{10} = L;
333 let Inst{11-15} = RA;
334 let Inst{16-20} = RB;
335 let Inst{21-30} = xo;
336 let Inst{31} = 0;
Nate Begeman61738782004-09-02 08:13:00 +0000337 let OperandList = OL;
338 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000339}
340
Nate Begeman61738782004-09-02 08:13:00 +0000341class XForm_16_ext<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
342 dag OL, string asmstr>
343 : XForm_16<opcode, xo, ppc64, vmx, OL, asmstr> {
344 let ArgCount = 3;
345 let Arg1Type = Gpr.Value;
346 let Arg2Type = Gpr.Value;
347 let Arg3Type = 0;
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000348 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000349}
350
Nate Begemana113d742004-08-31 02:28:08 +0000351class XForm_17<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
352 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000353 field bits<3> BF;
354 field bits<5> FRA;
355 field bits<5> FRB;
356
357 let ArgCount = 3;
358 let Arg0Type = Imm3.Value;
359 let Arg1Type = Fpr.Value;
360 let Arg2Type = Fpr.Value;
361 let Arg3Type = 0;
362 let Arg4Type = 0;
363
364 let Inst{6-8} = BF;
365 let Inst{9-10} = 0;
366 let Inst{11-15} = FRA;
367 let Inst{16-20} = FRB;
368 let Inst{21-30} = xo;
369 let Inst{31} = 0;
Nate Begemana113d742004-08-31 02:28:08 +0000370 let OperandList = OL;
371 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000372}
373
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000374class XForm_25<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
375 dag OL, string asmstr>
376 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000377 let Arg0Type = Fpr.Value;
378 let Arg1Type = Gpr0.Value;
379}
380
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000381class XForm_26<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
382 dag OL, string asmstr>
383 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000384 let ArgCount = 2;
385 let Arg0Type = Fpr.Value;
386 let Arg1Type = Fpr.Value;
387 let Arg2Type = 0;
388 let A = 0;
389}
390
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000391class XForm_28<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
392 dag OL, string asmstr>
393 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000394 let Arg0Type = Fpr.Value;
395 let Arg1Type = Gpr0.Value;
396}
397
398// 1.7.7 XL-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000399class XLForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
400 dag OL, string asmstr>
401 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000402 let Arg0Type = Imm5.Value;
403 let Arg1Type = Imm5.Value;
404 let Arg2Type = Imm5.Value;
405}
406
Nate Begeman61738782004-09-02 08:13:00 +0000407class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, bit ppc64, bit vmx,
408 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000409 field bits<5> BO;
410 field bits<5> BI;
411 field bits<2> BH;
412
413 let ArgCount = 3;
414 let Arg0Type = Imm5.Value;
415 let Arg1Type = Imm5.Value;
416 let Arg2Type = Imm2.Value;
417 let Arg3Type = 0;
418 let Arg4Type = 0;
419
420 let Inst{6-10} = BO;
421 let Inst{11-15} = BI;
422 let Inst{16-18} = 0;
423 let Inst{19-20} = BH;
424 let Inst{21-30} = xo;
425 let Inst{31} = lk;
Nate Begeman61738782004-09-02 08:13:00 +0000426 let OperandList = OL;
427 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000428}
429
Nate Begeman61738782004-09-02 08:13:00 +0000430class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,
431 bits<5> bi, bit lk, bit ppc64, bit vmx,
432 dag OL, string asmstr>
433 : XLForm_2<opcode, xo, lk, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000434 let ArgCount = 0;
435 let Arg0Type = 0;
436 let Arg1Type = 0;
437 let Arg2Type = 0;
438 let BO = bo;
439 let BI = bi;
440 let BH = 0;
441}
442
443// 1.7.8 XFX-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000444class XFXForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
445 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000446 field bits<5> ST;
447 field bits<10> SPR;
448
449 let ArgCount = 2;
450 let Arg0Type = Imm5.Value;
451 let Arg1Type = Gpr.Value;
452 let Arg2Type = 0;
453 let Arg3Type = 0;
454 let Arg4Type = 0;
455
456 let Inst{6-10} = ST;
457 let Inst{11-20} = SPR;
458 let Inst{21-30} = xo;
459 let Inst{31} = 0;
Nate Begeman143cf942004-08-30 02:28:06 +0000460 let OperandList = OL;
461 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000462}
463
Nate Begeman143cf942004-08-30 02:28:06 +0000464class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, bit ppc64,
465 bit vmx, dag OL, string asmstr>
466 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000467 let ArgCount = 1;
468 let Arg0Type = Gpr.Value;
469 let Arg1Type = 0;
470 let SPR = spr;
471}
472
Nate Begeman143cf942004-08-30 02:28:06 +0000473class XFXForm_7<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
474 dag OL, string asmstr>
475 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000476
Nate Begeman143cf942004-08-30 02:28:06 +0000477class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
478 bit ppc64, bit vmx, dag OL, string asmstr>
479 : XFXForm_7<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000480 let ArgCount = 1;
481 let Arg0Type = Gpr.Value;
482 let Arg1Type = 0;
483 let SPR = spr;
484}
485
Nate Begeman765cb5f2004-08-13 02:19:26 +0000486// 1.7.10 XS-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000487class XSForm_1<bits<6> opcode, bits<9> xo, bit rc, bit ppc64, bit vmx,
488 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000489 field bits<5> RS;
490 field bits<5> A;
491 field bits<6> SH;
492
493 let ArgCount = 3;
494 let Arg0Type = Gpr.Value;
495 let Arg1Type = Gpr.Value;
496 let Arg2Type = Imm6.Value;
497 let Arg3Type = 0;
498 let Arg4Type = 0;
499
500 let Inst{6-10} = RS;
501 let Inst{11-15} = A;
502 let Inst{16-20} = SH{1-5};
503 let Inst{21-29} = xo;
504 let Inst{30} = SH{0};
505 let Inst{31} = rc;
Nate Begeman143cf942004-08-30 02:28:06 +0000506 let OperandList = OL;
507 let AsmString = asmstr;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000508}
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,
512 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000513 field bits<5> RT;
514 field bits<5> RA;
515 field bits<5> RB;
516
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;
Nate Begeman143cf942004-08-30 02:28:06 +0000530 let OperandList = OL;
531 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000532}
533
Nate Begeman143cf942004-08-30 02:28:06 +0000534class XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
535 dag OL, string asmstr>
536 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000537 let Inst{11-15} = RB;
538 let Inst{16-20} = RA;
539}
540
Nate Begeman143cf942004-08-30 02:28:06 +0000541class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
542 dag OL, string asmstr>
543 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
544 let ArgCount = 2;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000545 let RB = 0;
546}
547
548// 1.7.12 A-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000549class AForm_1<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx,
550 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000551 let ArgCount = 4;
552 field bits<5> FRT;
553 field bits<5> FRA;
554 field bits<5> FRB;
555 field bits<5> FRC;
556
557 let Arg0Type = Fpr.Value;
558 let Arg1Type = Fpr.Value;
559 let Arg2Type = Fpr.Value;
560 let Arg3Type = Fpr.Value;
561 let Arg4Type = 0;
562
563 let Inst{6-10} = FRT;
564 let Inst{11-15} = FRA;
565 let Inst{16-20} = FRB;
566 let Inst{21-25} = FRC;
567 let Inst{26-30} = xo;
568 let Inst{31} = rc;
Nate Begeman6cdbd222004-08-29 22:45:13 +0000569 let OperandList = OL;
570 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000571}
572
Nate Begeman6cdbd222004-08-29 22:45:13 +0000573class AForm_2<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
574 string asmstr>
575 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000576 let ArgCount = 3;
577 let Arg3Type = 0;
578 let FRC = 0;
579}
580
Nate Begeman6cdbd222004-08-29 22:45:13 +0000581class AForm_3<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
582 string asmstr>
583 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000584 let ArgCount = 3;
585 let Arg3Type = 0;
586 let FRB = 0;
587}
588
Misha Brukman5295e1d2004-08-09 17:24:04 +0000589// 1.7.13 M-Form
Nate Begemana113d742004-08-31 02:28:08 +0000590class MForm_1<bits<6> opcode, bit rc, bit ppc64, bit vmx,
591 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000592 let ArgCount = 5;
593 field bits<5> RS;
594 field bits<5> RA;
595 field bits<5> RB;
596 field bits<5> MB;
597 field bits<5> ME;
598
599 let Arg0Type = Gpr.Value;
600 let Arg1Type = Gpr.Value;
601 let Arg2Type = Gpr.Value;
602 let Arg3Type = Imm5.Value;
603 let Arg4Type = Imm5.Value;
604
605 let Inst{6-10} = RS;
606 let Inst{11-15} = RA;
607 let Inst{16-20} = RB;
608 let Inst{21-25} = MB;
609 let Inst{26-30} = ME;
610 let Inst{31} = rc;
Nate Begemana113d742004-08-31 02:28:08 +0000611 let OperandList = OL;
612 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000613}
614
Nate Begemana113d742004-08-31 02:28:08 +0000615class MForm_2<bits<6> opcode, bit rc, bit ppc64, bit vmx,
616 dag OL, string asmstr>
617 : MForm_1<opcode, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000618 let Arg2Type = Imm5.Value;
619}
620
Nate Begeman765cb5f2004-08-13 02:19:26 +0000621// 1.7.14 MD-Form
Nate Begemana113d742004-08-31 02:28:08 +0000622class MDForm_1<bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx,
623 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000624 let ArgCount = 4;
625 field bits<5> RS;
626 field bits<5> RA;
627 field bits<6> SH;
628 field bits<6> MBE;
629
630 let Arg0Type = Gpr.Value;
631 let Arg1Type = Gpr.Value;
632 let Arg2Type = Imm6.Value;
633 let Arg3Type = Imm6.Value;
634 let Arg4Type = 0;
635
636 let Inst{6-10} = RS;
637 let Inst{11-15} = RA;
638 let Inst{16-20} = SH{1-5};
639 let Inst{21-26} = MBE;
640 let Inst{27-29} = xo;
641 let Inst{30} = SH{0};
642 let Inst{31} = rc;
Nate Begemana113d742004-08-31 02:28:08 +0000643 let OperandList = OL;
644 let AsmString = asmstr;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000645}
646
Misha Brukman6b21bde2004-08-02 21:56:35 +0000647//===----------------------------------------------------------------------===//
648
Nate Begeman61738782004-09-02 08:13:00 +0000649class Pseudo<dag OL, string asmstr> : I<"", 0, 0, 0> {
650 let ArgCount = 0;
651 let PPC64 = 0;
652 let VMX = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000653
Nate Begeman61738782004-09-02 08:13:00 +0000654 let Arg0Type = Pseudo.Value;
655 let Arg1Type = Pseudo.Value;
656 let Arg2Type = Pseudo.Value;
657 let Arg3Type = Pseudo.Value;
658 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000659
Nate Begeman61738782004-09-02 08:13:00 +0000660 let Inst{31-0} = 0;
661 let OperandList = OL;
662 let AsmString = asmstr;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000663}