blob: b0fe8da5efcd097d4df292a9dde39a654f221f9f [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
63class IForm<string name, bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +000064 : I<name, 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;
Misha Brukman6b21bde2004-08-02 21:56:35 +000077}
78
Misha Brukman5295e1d2004-08-09 17:24:04 +000079// 1.7.2 B-Form
80class BForm<string name, bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +000081 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +000082 field bits<5> BO;
83 field bits<5> BI;
84 field bits<14> BD;
85
86 let ArgCount = 3;
87 let Arg0Type = Imm5.Value;
88 let Arg1Type = Imm5.Value;
89 let Arg2Type = PCRelimm14.Value;
90 let Arg3Type = 0;
91 let Arg4Type = 0;
92
93 let Inst{6-10} = BO;
94 let Inst{11-15} = BI;
95 let Inst{16-29} = BD;
96 let Inst{30} = aa;
97 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +000098}
99
Misha Brukman5295e1d2004-08-09 17:24:04 +0000100class BForm_ext<string name, bits<6> opcode, bit aa, bit lk, bits<5> bo,
101 bits<5> bi, bit ppc64, bit vmx>
102 : BForm<name, opcode, aa, lk, ppc64, vmx> {
103 let ArgCount = 2;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000104 let Arg2Type = Imm5.Value;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000105 let Arg1Type = PCRelimm14.Value;
106 let Arg2Type = 0;
107 let BO = bo;
108 let BI = bi;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000109}
110
Misha Brukman5295e1d2004-08-09 17:24:04 +0000111// 1.7.4 D-Form
Misha Brukman6b21bde2004-08-02 21:56:35 +0000112class DForm_base<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000113 : I<name, opcode, ppc64, vmx> {
Misha Brukman6b21bde2004-08-02 21:56:35 +0000114 field bits<5> A;
115 field bits<5> B;
116 field bits<16> C;
117
118 let ArgCount = 3;
119 let Arg0Type = Gpr.Value;
120 let Arg1Type = Gpr.Value;
121 let Arg2Type = Simm16.Value;
122 let Arg3Type = 0;
123 let Arg4Type = 0;
124
125 let Inst{6-10} = A;
126 let Inst{11-15} = B;
127 let Inst{16-31} = C;
128}
129
130class DForm_1<string name, bits<6> opcode, bit ppc64, bit vmx>
131 : DForm_base<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000132 let Arg1Type = Disimm16.Value;
133 let Arg2Type = Gpr0.Value;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000134}
135
136class DForm_2<string name, bits<6> opcode, bit ppc64, bit vmx>
137 : DForm_base<name, opcode, ppc64, vmx>;
138
139class DForm_2_r0<string name, bits<6> opcode, bit ppc64, bit vmx>
140 : DForm_base<name, opcode, ppc64, vmx> {
141 let Arg1Type = Gpr0.Value;
142}
143
144// Currently we make the use/def reg distinction in ISel, not tablegen
145class DForm_3<string name, bits<6> opcode, bit ppc64, bit vmx>
146 : DForm_1<name, opcode, ppc64, vmx>;
147
Chris Lattner8a796852004-08-15 05:20:16 +0000148class DForm_4<bits<6> opcode, bit ppc64, bit vmx,
149 dag OL, string asmstr> : DForm_base<"", opcode, ppc64, vmx> {
150 let OperandList = OL;
151 let AsmString = asmstr;
Misha Brukman09d87b42004-08-10 18:07:55 +0000152}
Misha Brukman6b21bde2004-08-02 21:56:35 +0000153
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000154class DForm_4_zero<string name, bits<6> opcode, bit ppc64, bit vmx,
155 dag OL, string asmstr> : DForm_1<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000156 let ArgCount = 0;
157 let Arg0Type = 0;
158 let Arg1Type = 0;
159 let Arg2Type = 0;
160 let A = 0;
161 let B = 0;
162 let C = 0;
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000163 let OperandList = OL;
164 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000165}
166
167class DForm_5<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000168 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000169 field bits<3> BF;
170 field bits<1> L;
171 field bits<5> RA;
172 field bits<16> I;
173
174 let ArgCount = 4;
175 let Arg0Type = Imm3.Value;
176 let Arg1Type = Imm1.Value;
177 let Arg2Type = Gpr.Value;
178 let Arg3Type = Simm16.Value;
179 let Arg4Type = 0;
180
181 let Inst{6-8} = BF;
182 let Inst{9} = 0;
183 let Inst{10} = L;
184 let Inst{11-15} = RA;
185 let Inst{16-31} = I;
186}
187
188class DForm_5_ext<string name, bits<6> opcode, bit ppc64, bit vmx>
189 : DForm_5<name, opcode, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000190 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000191 let ArgCount = 3;
192 let Arg0Type = Imm3.Value;
193 let Arg1Type = Gpr.Value;
194 let Arg2Type = Simm16.Value;
195 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000196}
197
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000198class DForm_6<bits<6> opcode, bit ppc64, bit vmx,
199 dag OL, string asmstr>
200 : DForm_5<"", opcode, ppc64, vmx> {
201 let OperandList = OL;
202 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000203}
204
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000205class DForm_6_ext<bits<6> opcode, bit ppc64, bit vmx,
206 dag OL, string asmstr>
207 : DForm_6<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000208 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000209 let ArgCount = 3;
210 let Arg0Type = Imm3.Value;
211 let Arg1Type = Gpr.Value;
212 let Arg2Type = Simm16.Value;
213 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000214}
215
Misha Brukman6b21bde2004-08-02 21:56:35 +0000216class DForm_7<string name, bits<6> opcode, bit ppc64, bit vmx>
217 : DForm_base<name, opcode, ppc64, vmx> {
218 let Arg1Type = Imm5.Value;
219}
220
Misha Brukman5295e1d2004-08-09 17:24:04 +0000221class DForm_8<string name, bits<6> opcode, bit ppc64, bit vmx>
222 : DForm_1<name, opcode, ppc64, vmx> {
223 let Arg0Type = Fpr.Value;
224}
225
226class DForm_9<string name, bits<6> opcode, bit ppc64, bit vmx>
227 : DForm_1<name, opcode, ppc64, vmx> {
228 let Arg0Type = Fpr.Value;
229}
230
Misha Brukman28beda92004-08-11 15:54:36 +0000231// 1.7.5 DS-Form
232class DSForm_1<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
233 : I<name, opcode, ppc64, vmx> {
234 field bits<5> RST;
235 field bits<14> DS;
236 field bits<5> RA;
237
238 let ArgCount = 3;
239 let Arg0Type = Gpr.Value;
240 let Arg1Type = Disimm14.Value;
241 let Arg2Type = Gpr.Value;
242 let Arg3Type = 0;
243 let Arg4Type = 0;
244
245 let Inst{6-10} = RST;
246 let Inst{11-15} = RA;
247 let Inst{16-29} = DS;
248 let Inst{30-31} = xo;
249}
250
251class DSForm_2<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
252 : DSForm_1<name, opcode, xo, ppc64, vmx>;
253
Misha Brukman5295e1d2004-08-09 17:24:04 +0000254// 1.7.6 X-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000255class XForm_base_r3xo<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
256 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman28beda92004-08-11 15:54:36 +0000257 field bits<5> RST;
258 field bits<5> A;
259 field bits<5> B;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000260
261 let ArgCount = 3;
262 let Arg0Type = Gpr.Value;
263 let Arg1Type = Gpr.Value;
264 let Arg2Type = Gpr.Value;
265 let Arg3Type = 0;
266 let Arg4Type = 0;
267
Misha Brukman28beda92004-08-11 15:54:36 +0000268 let Inst{6-10} = RST;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000269 let Inst{11-15} = A;
270 let Inst{16-20} = B;
271 let Inst{21-30} = xo;
272 let Inst{31} = rc;
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000273 let OperandList = OL;
274 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000275}
276
Nate Begeman765cb5f2004-08-13 02:19:26 +0000277
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000278class XForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
279 dag OL, string asmstr>
280 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000281
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000282class XForm_5<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
283 dag OL, string asmstr>
284 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000285 let ArgCount = 1;
286 let Arg1Type = 0;
287 let Arg2Type = 0;
288 let A = 0;
289 let B = 0;
290}
291
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000292class XForm_6<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
293 dag OL, string asmstr>
294 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000295
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000296class XForm_8<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
297 dag OL, string asmstr>
298 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000299
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000300class XForm_10<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
301 dag OL, string asmstr>
302 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000303 let Arg2Type = Imm5.Value;
304}
305
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000306class XForm_11<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
307 dag OL, string asmstr>
308 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000309 let ArgCount = 2;
310 let Arg2Type = 0;
311 let B = 0;
312}
313
314class XForm_16<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000315 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000316 field bits<3> BF;
317 field bits<1> L;
318 field bits<5> RA;
319 field bits<5> RB;
320
321 let ArgCount = 4;
322 let Arg0Type = Imm3.Value;
323 let Arg1Type = Imm1.Value;
324 let Arg2Type = Gpr.Value;
325 let Arg3Type = Gpr.Value;
326 let Arg4Type = 0;
327
328 let Inst{6-8} = BF;
329 let Inst{9} = 0;
330 let Inst{10} = L;
331 let Inst{11-15} = RA;
332 let Inst{16-20} = RB;
333 let Inst{21-30} = xo;
334 let Inst{31} = 0;
335}
336
337class XForm_16_ext<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
338 : XForm_16<name, opcode, xo, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000339 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000340}
341
Nate Begemana113d742004-08-31 02:28:08 +0000342class XForm_17<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
343 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000344 field bits<3> BF;
345 field bits<5> FRA;
346 field bits<5> FRB;
347
348 let ArgCount = 3;
349 let Arg0Type = Imm3.Value;
350 let Arg1Type = Fpr.Value;
351 let Arg2Type = Fpr.Value;
352 let Arg3Type = 0;
353 let Arg4Type = 0;
354
355 let Inst{6-8} = BF;
356 let Inst{9-10} = 0;
357 let Inst{11-15} = FRA;
358 let Inst{16-20} = FRB;
359 let Inst{21-30} = xo;
360 let Inst{31} = 0;
Nate Begemana113d742004-08-31 02:28:08 +0000361 let OperandList = OL;
362 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000363}
364
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000365class XForm_25<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
366 dag OL, string asmstr>
367 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000368 let Arg0Type = Fpr.Value;
369 let Arg1Type = Gpr0.Value;
370}
371
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000372class XForm_26<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
373 dag OL, string asmstr>
374 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000375 let ArgCount = 2;
376 let Arg0Type = Fpr.Value;
377 let Arg1Type = Fpr.Value;
378 let Arg2Type = 0;
379 let A = 0;
380}
381
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000382class XForm_28<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
383 dag OL, string asmstr>
384 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000385 let Arg0Type = Fpr.Value;
386 let Arg1Type = Gpr0.Value;
387}
388
389// 1.7.7 XL-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000390class XLForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
391 dag OL, string asmstr>
392 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000393 let Arg0Type = Imm5.Value;
394 let Arg1Type = Imm5.Value;
395 let Arg2Type = Imm5.Value;
396}
397
398class XLForm_2<string name, bits<6> opcode, bits<10> xo, bit lk, bit ppc64,
Misha Brukmandad438b2004-08-10 22:47:03 +0000399 bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000400 field bits<5> BO;
401 field bits<5> BI;
402 field bits<2> BH;
403
404 let ArgCount = 3;
405 let Arg0Type = Imm5.Value;
406 let Arg1Type = Imm5.Value;
407 let Arg2Type = Imm2.Value;
408 let Arg3Type = 0;
409 let Arg4Type = 0;
410
411 let Inst{6-10} = BO;
412 let Inst{11-15} = BI;
413 let Inst{16-18} = 0;
414 let Inst{19-20} = BH;
415 let Inst{21-30} = xo;
416 let Inst{31} = lk;
417}
418
419class XLForm_2_ext<string name, bits<6> opcode, bits<10> xo, bits<5> bo,
420 bits<5> bi, bit lk, bit ppc64, bit vmx>
421 : XLForm_2<name, opcode, xo, lk, ppc64, vmx> {
422 let ArgCount = 0;
423 let Arg0Type = 0;
424 let Arg1Type = 0;
425 let Arg2Type = 0;
426 let BO = bo;
427 let BI = bi;
428 let BH = 0;
429}
430
431// 1.7.8 XFX-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000432class XFXForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
433 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000434 field bits<5> ST;
435 field bits<10> SPR;
436
437 let ArgCount = 2;
438 let Arg0Type = Imm5.Value;
439 let Arg1Type = Gpr.Value;
440 let Arg2Type = 0;
441 let Arg3Type = 0;
442 let Arg4Type = 0;
443
444 let Inst{6-10} = ST;
445 let Inst{11-20} = SPR;
446 let Inst{21-30} = xo;
447 let Inst{31} = 0;
Nate Begeman143cf942004-08-30 02:28:06 +0000448 let OperandList = OL;
449 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000450}
451
Nate Begeman143cf942004-08-30 02:28:06 +0000452class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, bit ppc64,
453 bit vmx, dag OL, string asmstr>
454 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000455 let ArgCount = 1;
456 let Arg0Type = Gpr.Value;
457 let Arg1Type = 0;
458 let SPR = spr;
459}
460
Nate Begeman143cf942004-08-30 02:28:06 +0000461class XFXForm_7<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
462 dag OL, string asmstr>
463 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000464
Nate Begeman143cf942004-08-30 02:28:06 +0000465class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
466 bit ppc64, bit vmx, dag OL, string asmstr>
467 : XFXForm_7<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000468 let ArgCount = 1;
469 let Arg0Type = Gpr.Value;
470 let Arg1Type = 0;
471 let SPR = spr;
472}
473
Nate Begeman765cb5f2004-08-13 02:19:26 +0000474// 1.7.10 XS-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000475class XSForm_1<bits<6> opcode, bits<9> xo, bit rc, bit ppc64, bit vmx,
476 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000477 field bits<5> RS;
478 field bits<5> A;
479 field bits<6> SH;
480
481 let ArgCount = 3;
482 let Arg0Type = Gpr.Value;
483 let Arg1Type = Gpr.Value;
484 let Arg2Type = Imm6.Value;
485 let Arg3Type = 0;
486 let Arg4Type = 0;
487
488 let Inst{6-10} = RS;
489 let Inst{11-15} = A;
490 let Inst{16-20} = SH{1-5};
491 let Inst{21-29} = xo;
492 let Inst{30} = SH{0};
493 let Inst{31} = rc;
Nate Begeman143cf942004-08-30 02:28:06 +0000494 let OperandList = OL;
495 let AsmString = asmstr;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000496}
497
Misha Brukman5295e1d2004-08-09 17:24:04 +0000498// 1.7.11 XO-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000499class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
500 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000501 field bits<5> RT;
502 field bits<5> RA;
503 field bits<5> RB;
504
505 let ArgCount = 3;
506 let Arg0Type = Gpr.Value;
507 let Arg1Type = Gpr.Value;
508 let Arg2Type = Gpr.Value;
509 let Arg3Type = 0;
510 let Arg4Type = 0;
511
512 let Inst{6-10} = RT;
513 let Inst{11-15} = RA;
514 let Inst{16-20} = RB;
515 let Inst{21} = oe;
516 let Inst{22-30} = xo;
517 let Inst{31} = rc;
Nate Begeman143cf942004-08-30 02:28:06 +0000518 let OperandList = OL;
519 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000520}
521
Nate Begeman143cf942004-08-30 02:28:06 +0000522class XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
523 dag OL, string asmstr>
524 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000525 let Inst{11-15} = RB;
526 let Inst{16-20} = RA;
527}
528
Nate Begeman143cf942004-08-30 02:28:06 +0000529class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
530 dag OL, string asmstr>
531 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
532 let ArgCount = 2;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000533 let RB = 0;
534}
535
536// 1.7.12 A-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000537class AForm_1<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx,
538 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000539 let ArgCount = 4;
540 field bits<5> FRT;
541 field bits<5> FRA;
542 field bits<5> FRB;
543 field bits<5> FRC;
544
545 let Arg0Type = Fpr.Value;
546 let Arg1Type = Fpr.Value;
547 let Arg2Type = Fpr.Value;
548 let Arg3Type = Fpr.Value;
549 let Arg4Type = 0;
550
551 let Inst{6-10} = FRT;
552 let Inst{11-15} = FRA;
553 let Inst{16-20} = FRB;
554 let Inst{21-25} = FRC;
555 let Inst{26-30} = xo;
556 let Inst{31} = rc;
Nate Begeman6cdbd222004-08-29 22:45:13 +0000557 let OperandList = OL;
558 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000559}
560
Nate Begeman6cdbd222004-08-29 22:45:13 +0000561class AForm_2<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
562 string asmstr>
563 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000564 let ArgCount = 3;
565 let Arg3Type = 0;
566 let FRC = 0;
567}
568
Nate Begeman6cdbd222004-08-29 22:45:13 +0000569class AForm_3<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 FRB = 0;
575}
576
Misha Brukman5295e1d2004-08-09 17:24:04 +0000577// 1.7.13 M-Form
Nate Begemana113d742004-08-31 02:28:08 +0000578class MForm_1<bits<6> opcode, bit rc, bit ppc64, bit vmx,
579 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000580 let ArgCount = 5;
581 field bits<5> RS;
582 field bits<5> RA;
583 field bits<5> RB;
584 field bits<5> MB;
585 field bits<5> ME;
586
587 let Arg0Type = Gpr.Value;
588 let Arg1Type = Gpr.Value;
589 let Arg2Type = Gpr.Value;
590 let Arg3Type = Imm5.Value;
591 let Arg4Type = Imm5.Value;
592
593 let Inst{6-10} = RS;
594 let Inst{11-15} = RA;
595 let Inst{16-20} = RB;
596 let Inst{21-25} = MB;
597 let Inst{26-30} = ME;
598 let Inst{31} = rc;
Nate Begemana113d742004-08-31 02:28:08 +0000599 let OperandList = OL;
600 let AsmString = asmstr;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000601}
602
Nate Begemana113d742004-08-31 02:28:08 +0000603class MForm_2<bits<6> opcode, bit rc, bit ppc64, bit vmx,
604 dag OL, string asmstr>
605 : MForm_1<opcode, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000606 let Arg2Type = Imm5.Value;
607}
608
Nate Begeman765cb5f2004-08-13 02:19:26 +0000609// 1.7.14 MD-Form
Nate Begemana113d742004-08-31 02:28:08 +0000610class MDForm_1<bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx,
611 dag OL, string asmstr> : I<"", opcode, ppc64, vmx> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000612 let ArgCount = 4;
613 field bits<5> RS;
614 field bits<5> RA;
615 field bits<6> SH;
616 field bits<6> MBE;
617
618 let Arg0Type = Gpr.Value;
619 let Arg1Type = Gpr.Value;
620 let Arg2Type = Imm6.Value;
621 let Arg3Type = Imm6.Value;
622 let Arg4Type = 0;
623
624 let Inst{6-10} = RS;
625 let Inst{11-15} = RA;
626 let Inst{16-20} = SH{1-5};
627 let Inst{21-26} = MBE;
628 let Inst{27-29} = xo;
629 let Inst{30} = SH{0};
630 let Inst{31} = rc;
Nate Begemana113d742004-08-31 02:28:08 +0000631 let OperandList = OL;
632 let AsmString = asmstr;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000633}
634
Misha Brukman6b21bde2004-08-02 21:56:35 +0000635//===----------------------------------------------------------------------===//
636
Misha Brukmandad438b2004-08-10 22:47:03 +0000637class Pseudo<string name> : I<name, 0, 0, 0> {
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000638 let Name = name;
639 let ArgCount = 0;
640 let PPC64 = 0;
641 let VMX = 0;
642
Misha Brukman5295e1d2004-08-09 17:24:04 +0000643 let Arg0Type = Pseudo.Value;
644 let Arg1Type = Pseudo.Value;
645 let Arg2Type = Pseudo.Value;
646 let Arg3Type = Pseudo.Value;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000647 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000648
Misha Brukmandad438b2004-08-10 22:47:03 +0000649 let Inst{31-0} = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000650}