blob: c0930e79fe3c85fb956ba134efe09397641490c9 [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
255class XForm_base_r3xo<string name, bits<6> opcode, bits<10> xo, bit rc,
Misha Brukmandad438b2004-08-10 22:47:03 +0000256 bit ppc64, bit vmx> : I<name, 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;
273}
274
Nate Begeman765cb5f2004-08-13 02:19:26 +0000275
Misha Brukman5295e1d2004-08-09 17:24:04 +0000276class XForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64,
277 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx>;
278
279class XForm_5<string name, bits<6> opcode, bits<10> xo, bit ppc64,
280 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
281 let ArgCount = 1;
282 let Arg1Type = 0;
283 let Arg2Type = 0;
284 let A = 0;
285 let B = 0;
286}
287
288class XForm_6<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
289 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx>;
290
291class XForm_7<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
292 : XForm_base_r3xo<name, opcode, xo, 1, ppc64, vmx>;
293
294class XForm_8<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
295 : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx>;
296
297class XForm_10<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
298 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
299 let Arg2Type = Imm5.Value;
300}
301
302class XForm_11<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
303 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
304 let ArgCount = 2;
305 let Arg2Type = 0;
306 let B = 0;
307}
308
309class XForm_16<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000310 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000311 field bits<3> BF;
312 field bits<1> L;
313 field bits<5> RA;
314 field bits<5> RB;
315
316 let ArgCount = 4;
317 let Arg0Type = Imm3.Value;
318 let Arg1Type = Imm1.Value;
319 let Arg2Type = Gpr.Value;
320 let Arg3Type = Gpr.Value;
321 let Arg4Type = 0;
322
323 let Inst{6-8} = BF;
324 let Inst{9} = 0;
325 let Inst{10} = L;
326 let Inst{11-15} = RA;
327 let Inst{16-20} = RB;
328 let Inst{21-30} = xo;
329 let Inst{31} = 0;
330}
331
332class XForm_16_ext<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
333 : XForm_16<name, opcode, xo, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000334 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000335}
336
337class XForm_17<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000338 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000339 field bits<3> BF;
340 field bits<5> FRA;
341 field bits<5> FRB;
342
343 let ArgCount = 3;
344 let Arg0Type = Imm3.Value;
345 let Arg1Type = Fpr.Value;
346 let Arg2Type = Fpr.Value;
347 let Arg3Type = 0;
348 let Arg4Type = 0;
349
350 let Inst{6-8} = BF;
351 let Inst{9-10} = 0;
352 let Inst{11-15} = FRA;
353 let Inst{16-20} = FRB;
354 let Inst{21-30} = xo;
355 let Inst{31} = 0;
356}
357
358class XForm_25<string name, bits<6> opcode, bits<10> xo, bit ppc64,
359 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
360 let Arg0Type = Fpr.Value;
361 let Arg1Type = Gpr0.Value;
362}
363
364class XForm_26<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
365 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
366 let ArgCount = 2;
367 let Arg0Type = Fpr.Value;
368 let Arg1Type = Fpr.Value;
369 let Arg2Type = 0;
370 let A = 0;
371}
372
373class XForm_28<string name, bits<6> opcode, bits<10> xo, bit ppc64,
374 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
375 let Arg0Type = Fpr.Value;
376 let Arg1Type = Gpr0.Value;
377}
378
379// 1.7.7 XL-Form
380class XLForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
381 : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
382 let Arg0Type = Imm5.Value;
383 let Arg1Type = Imm5.Value;
384 let Arg2Type = Imm5.Value;
385}
386
387class XLForm_2<string name, bits<6> opcode, bits<10> xo, bit lk, bit ppc64,
Misha Brukmandad438b2004-08-10 22:47:03 +0000388 bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000389 field bits<5> BO;
390 field bits<5> BI;
391 field bits<2> BH;
392
393 let ArgCount = 3;
394 let Arg0Type = Imm5.Value;
395 let Arg1Type = Imm5.Value;
396 let Arg2Type = Imm2.Value;
397 let Arg3Type = 0;
398 let Arg4Type = 0;
399
400 let Inst{6-10} = BO;
401 let Inst{11-15} = BI;
402 let Inst{16-18} = 0;
403 let Inst{19-20} = BH;
404 let Inst{21-30} = xo;
405 let Inst{31} = lk;
406}
407
408class XLForm_2_ext<string name, bits<6> opcode, bits<10> xo, bits<5> bo,
409 bits<5> bi, bit lk, bit ppc64, bit vmx>
410 : XLForm_2<name, opcode, xo, lk, ppc64, vmx> {
411 let ArgCount = 0;
412 let Arg0Type = 0;
413 let Arg1Type = 0;
414 let Arg2Type = 0;
415 let BO = bo;
416 let BI = bi;
417 let BH = 0;
418}
419
420// 1.7.8 XFX-Form
421class XFXForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000422 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000423 field bits<5> ST;
424 field bits<10> SPR;
425
426 let ArgCount = 2;
427 let Arg0Type = Imm5.Value;
428 let Arg1Type = Gpr.Value;
429 let Arg2Type = 0;
430 let Arg3Type = 0;
431 let Arg4Type = 0;
432
433 let Inst{6-10} = ST;
434 let Inst{11-20} = SPR;
435 let Inst{21-30} = xo;
436 let Inst{31} = 0;
437}
438
439class XFXForm_1_ext<string name, bits<6> opcode, bits<10> xo, bits<10> spr,
440 bit ppc64, bit vmx> : XFXForm_1<name,opcode,xo,ppc64,vmx> {
441 let ArgCount = 1;
442 let Arg0Type = Gpr.Value;
443 let Arg1Type = 0;
444 let SPR = spr;
445}
446
447class XFXForm_7<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
448 : XFXForm_1<name, opcode, xo, ppc64, vmx>;
449
450class XFXForm_7_ext<string name, bits<6> opcode, bits<10> xo, bits<10> spr,
451 bit ppc64, bit vmx> : XFXForm_7<name,opcode,xo,ppc64,vmx> {
452 let ArgCount = 1;
453 let Arg0Type = Gpr.Value;
454 let Arg1Type = 0;
455 let SPR = spr;
456}
457
Nate Begeman765cb5f2004-08-13 02:19:26 +0000458// 1.7.10 XS-Form
459class XSForm_1<string name, bits<6> opcode, bits<9> xo, bit rc,
460 bit ppc64, bit vmx> : I<name, opcode, ppc64, vmx> {
461 field bits<5> RS;
462 field bits<5> A;
463 field bits<6> SH;
464
465 let ArgCount = 3;
466 let Arg0Type = Gpr.Value;
467 let Arg1Type = Gpr.Value;
468 let Arg2Type = Imm6.Value;
469 let Arg3Type = 0;
470 let Arg4Type = 0;
471
472 let Inst{6-10} = RS;
473 let Inst{11-15} = A;
474 let Inst{16-20} = SH{1-5};
475 let Inst{21-29} = xo;
476 let Inst{30} = SH{0};
477 let Inst{31} = rc;
478}
479
Misha Brukman5295e1d2004-08-09 17:24:04 +0000480// 1.7.11 XO-Form
481class XOForm_1<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
Misha Brukmandad438b2004-08-10 22:47:03 +0000482 bit ppc64, bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000483 field bits<5> RT;
484 field bits<5> RA;
485 field bits<5> RB;
486
487 let ArgCount = 3;
488 let Arg0Type = Gpr.Value;
489 let Arg1Type = Gpr.Value;
490 let Arg2Type = Gpr.Value;
491 let Arg3Type = 0;
492 let Arg4Type = 0;
493
494 let Inst{6-10} = RT;
495 let Inst{11-15} = RA;
496 let Inst{16-20} = RB;
497 let Inst{21} = oe;
498 let Inst{22-30} = xo;
499 let Inst{31} = rc;
500}
501
502// This is a reversal of the two operands, used notably by extended ops SUB*:
503// sub x, y, z == subf x, z, y
504// subc x, y, z == subfc x, z, y
505class XOForm_1_rev<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
506 bit ppc64, bit vmx>
507 : XOForm_1<name, opcode, xo, oe, rc, ppc64, vmx> {
508 let Inst{11-15} = RB;
509 let Inst{16-20} = RA;
510}
511
512class XOForm_2<string name, bits<6> opcode, bits<9> xo, bit rc, bit ppc64,
513 bit vmx> : XOForm_1<name, opcode, xo, 0, rc, ppc64, vmx>;
514
515class XOForm_3<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
516 bit ppc64, bit vmx> : XOForm_1<name,opcode,xo,oe,rc,ppc64,vmx> {
517 let RB = 0;
518}
519
520// 1.7.12 A-Form
521class AForm_1<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
Misha Brukmandad438b2004-08-10 22:47:03 +0000522 bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000523 let ArgCount = 4;
524 field bits<5> FRT;
525 field bits<5> FRA;
526 field bits<5> FRB;
527 field bits<5> FRC;
528
529 let Arg0Type = Fpr.Value;
530 let Arg1Type = Fpr.Value;
531 let Arg2Type = Fpr.Value;
532 let Arg3Type = Fpr.Value;
533 let Arg4Type = 0;
534
535 let Inst{6-10} = FRT;
536 let Inst{11-15} = FRA;
537 let Inst{16-20} = FRB;
538 let Inst{21-25} = FRC;
539 let Inst{26-30} = xo;
540 let Inst{31} = rc;
541}
542
543class AForm_2<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
544 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
545 let ArgCount = 3;
546 let Arg3Type = 0;
547 let FRC = 0;
548}
549
550class AForm_3<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
551 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
552 let ArgCount = 3;
553 let Arg3Type = 0;
554 let FRB = 0;
555}
556
557class AForm_4<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
558 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
559 let ArgCount = 2;
560 let Arg2Type = 0;
561 let Arg3Type = 0;
562 let FRA = 0;
563 let FRC = 0;
564}
565
566// 1.7.13 M-Form
567class MForm_1<string name, bits<6> opcode, bit rc, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000568 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000569 let ArgCount = 5;
570 field bits<5> RS;
571 field bits<5> RA;
572 field bits<5> RB;
573 field bits<5> MB;
574 field bits<5> ME;
575
576 let Arg0Type = Gpr.Value;
577 let Arg1Type = Gpr.Value;
578 let Arg2Type = Gpr.Value;
579 let Arg3Type = Imm5.Value;
580 let Arg4Type = Imm5.Value;
581
582 let Inst{6-10} = RS;
583 let Inst{11-15} = RA;
584 let Inst{16-20} = RB;
585 let Inst{21-25} = MB;
586 let Inst{26-30} = ME;
587 let Inst{31} = rc;
588}
589
590class MForm_2<string name, bits<6> opcode, bit rc, bit ppc64, bit vmx>
591 : MForm_1<name, opcode, rc, ppc64, vmx> {
592 let Arg2Type = Imm5.Value;
593}
594
Nate Begeman765cb5f2004-08-13 02:19:26 +0000595// 1.7.14 MD-Form
596class MDForm_1<string name, bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx>
597 : I<name, opcode, ppc64, vmx> {
598 let ArgCount = 4;
599 field bits<5> RS;
600 field bits<5> RA;
601 field bits<6> SH;
602 field bits<6> MBE;
603
604 let Arg0Type = Gpr.Value;
605 let Arg1Type = Gpr.Value;
606 let Arg2Type = Imm6.Value;
607 let Arg3Type = Imm6.Value;
608 let Arg4Type = 0;
609
610 let Inst{6-10} = RS;
611 let Inst{11-15} = RA;
612 let Inst{16-20} = SH{1-5};
613 let Inst{21-26} = MBE;
614 let Inst{27-29} = xo;
615 let Inst{30} = SH{0};
616 let Inst{31} = rc;
617}
618
Misha Brukman6b21bde2004-08-02 21:56:35 +0000619//===----------------------------------------------------------------------===//
620
Misha Brukmandad438b2004-08-10 22:47:03 +0000621class Pseudo<string name> : I<name, 0, 0, 0> {
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000622 let Name = name;
623 let ArgCount = 0;
624 let PPC64 = 0;
625 let VMX = 0;
626
Misha Brukman5295e1d2004-08-09 17:24:04 +0000627 let Arg0Type = Pseudo.Value;
628 let Arg1Type = Pseudo.Value;
629 let Arg2Type = Pseudo.Value;
630 let Arg3Type = Pseudo.Value;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000631 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000632
Misha Brukmandad438b2004-08-10 22:47:03 +0000633 let Inst{31-0} = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000634}