blob: 4c0a913d8ee582546b0997323b67f5b0dffd7652 [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>;
21def Zimm16 : Format<4>;
22def PCRelimm24 : Format<5>;
23def Imm24 : Format<6>;
24def Imm5 : Format<7>;
25def PCRelimm14 : Format<8>;
26def Imm14 : Format<9>;
27def Imm2 : Format<10>;
28def Crf : Format<11>;
29def Imm3 : Format<12>;
30def Imm1 : Format<13>;
31def Fpr : Format<14>;
32def Imm4 : Format<15>;
33def Imm8 : Format<16>;
34def Disimm16 : Format<17>;
35def Disimm14 : Format<18>;
36def Spr : Format<19>;
37def Sgr : Format<20>;
38def Imm15 : Format<21>;
39def Vpr : Format<22>;
Nate Begeman765cb5f2004-08-13 02:19:26 +000040def Imm6 : Format<23>;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000041
Misha Brukman6b21bde2004-08-02 21:56:35 +000042//===----------------------------------------------------------------------===//
43//
44// PowerPC instruction formats
Misha Brukmancd4f51b2004-08-02 16:54:54 +000045
Misha Brukmandad438b2004-08-10 22:47:03 +000046class I<string name, bits<6> opcode, bit ppc64, bit vmx> : 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
Misha Brukman6b21bde2004-08-02 21:56:35 +000058 let Name = 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;
Misha Brukmancd4f51b2004-08-02 16:54:54 +000061}
62
Misha Brukman5295e1d2004-08-09 17:24:04 +000063// 1.7.1 I-Form
64class IForm<string name, bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +000065 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +000066 field bits<24> LI;
Misha Brukman6b21bde2004-08-02 21:56:35 +000067
Misha Brukman5295e1d2004-08-09 17:24:04 +000068 let ArgCount = 1;
69 let Arg0Type = Imm24.Value;
70 let Arg1Type = 0;
71 let Arg2Type = 0;
Misha Brukman6b21bde2004-08-02 21:56:35 +000072 let Arg3Type = 0;
73 let Arg4Type = 0;
74
Misha Brukman5295e1d2004-08-09 17:24:04 +000075 let Inst{6-29} = LI;
76 let Inst{30} = aa;
77 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +000078}
79
Misha Brukman5295e1d2004-08-09 17:24:04 +000080// 1.7.2 B-Form
81class BForm<string name, bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +000082 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +000083 field bits<5> BO;
84 field bits<5> BI;
85 field bits<14> BD;
86
87 let ArgCount = 3;
88 let Arg0Type = Imm5.Value;
89 let Arg1Type = Imm5.Value;
90 let Arg2Type = PCRelimm14.Value;
91 let Arg3Type = 0;
92 let Arg4Type = 0;
93
94 let Inst{6-10} = BO;
95 let Inst{11-15} = BI;
96 let Inst{16-29} = BD;
97 let Inst{30} = aa;
98 let Inst{31} = lk;
Misha Brukman6b21bde2004-08-02 21:56:35 +000099}
100
Misha Brukman5295e1d2004-08-09 17:24:04 +0000101class BForm_ext<string name, bits<6> opcode, bit aa, bit lk, bits<5> bo,
102 bits<5> bi, bit ppc64, bit vmx>
103 : BForm<name, opcode, aa, lk, ppc64, vmx> {
104 let ArgCount = 2;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000105 let Arg2Type = Imm5.Value;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000106 let Arg1Type = PCRelimm14.Value;
107 let Arg2Type = 0;
108 let BO = bo;
109 let BI = bi;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000110}
111
Misha Brukman5295e1d2004-08-09 17:24:04 +0000112// 1.7.4 D-Form
Misha Brukman6b21bde2004-08-02 21:56:35 +0000113class DForm_base<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000114 : I<name, opcode, ppc64, vmx> {
Misha Brukman6b21bde2004-08-02 21:56:35 +0000115 field bits<5> A;
116 field bits<5> B;
117 field bits<16> C;
118
119 let ArgCount = 3;
120 let Arg0Type = Gpr.Value;
121 let Arg1Type = Gpr.Value;
122 let Arg2Type = Simm16.Value;
123 let Arg3Type = 0;
124 let Arg4Type = 0;
125
126 let Inst{6-10} = A;
127 let Inst{11-15} = B;
128 let Inst{16-31} = C;
129}
130
131class DForm_1<string name, bits<6> opcode, bit ppc64, bit vmx>
132 : DForm_base<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000133 let Arg1Type = Disimm16.Value;
134 let Arg2Type = Gpr0.Value;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000135}
136
137class DForm_2<string name, bits<6> opcode, bit ppc64, bit vmx>
138 : DForm_base<name, opcode, ppc64, vmx>;
139
140class DForm_2_r0<string name, bits<6> opcode, bit ppc64, bit vmx>
141 : DForm_base<name, opcode, ppc64, vmx> {
142 let Arg1Type = Gpr0.Value;
143}
144
145// Currently we make the use/def reg distinction in ISel, not tablegen
146class DForm_3<string name, bits<6> opcode, bit ppc64, bit vmx>
147 : DForm_1<name, opcode, ppc64, vmx>;
148
Chris Lattner8a796852004-08-15 05:20:16 +0000149class DForm_4<bits<6> opcode, bit ppc64, bit vmx,
150 dag OL, string asmstr> : DForm_base<"", opcode, ppc64, vmx> {
151 let OperandList = OL;
152 let AsmString = asmstr;
Misha Brukman09d87b42004-08-10 18:07:55 +0000153}
Misha Brukman6b21bde2004-08-02 21:56:35 +0000154
Misha Brukman5295e1d2004-08-09 17:24:04 +0000155class DForm_4_zero<string name, bits<6> opcode, bit ppc64, bit vmx>
156 : DForm_1<name, opcode, ppc64, vmx> {
157 let ArgCount = 0;
158 let Arg0Type = 0;
159 let Arg1Type = 0;
160 let Arg2Type = 0;
161 let A = 0;
162 let B = 0;
163 let C = 0;
164}
165
166class DForm_5<string name, bits<6> opcode, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000167 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000168 field bits<3> BF;
169 field bits<1> L;
170 field bits<5> RA;
171 field bits<16> I;
172
173 let ArgCount = 4;
174 let Arg0Type = Imm3.Value;
175 let Arg1Type = Imm1.Value;
176 let Arg2Type = Gpr.Value;
177 let Arg3Type = Simm16.Value;
178 let Arg4Type = 0;
179
180 let Inst{6-8} = BF;
181 let Inst{9} = 0;
182 let Inst{10} = L;
183 let Inst{11-15} = RA;
184 let Inst{16-31} = I;
185}
186
187class DForm_5_ext<string name, bits<6> opcode, bit ppc64, bit vmx>
188 : DForm_5<name, opcode, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000189 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000190 let ArgCount = 3;
191 let Arg0Type = Imm3.Value;
192 let Arg1Type = Gpr.Value;
193 let Arg2Type = Simm16.Value;
194 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000195}
196
197class DForm_6<string name, bits<6> opcode, bit ppc64, bit vmx>
198 : DForm_5<name, opcode, ppc64, vmx> {
199 let Arg3Type = Zimm16.Value;
200}
201
202class DForm_6_ext<string name, bits<6> opcode, bit ppc64, bit vmx>
203 : DForm_6<name, opcode, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000204 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000205 let ArgCount = 3;
206 let Arg0Type = Imm3.Value;
207 let Arg1Type = Gpr.Value;
208 let Arg2Type = Simm16.Value;
209 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000210}
211
Misha Brukman6b21bde2004-08-02 21:56:35 +0000212class DForm_7<string name, bits<6> opcode, bit ppc64, bit vmx>
213 : DForm_base<name, opcode, ppc64, vmx> {
214 let Arg1Type = Imm5.Value;
215}
216
Misha Brukman5295e1d2004-08-09 17:24:04 +0000217class DForm_8<string name, bits<6> opcode, bit ppc64, bit vmx>
218 : DForm_1<name, opcode, ppc64, vmx> {
219 let Arg0Type = Fpr.Value;
220}
221
222class DForm_9<string name, bits<6> opcode, bit ppc64, bit vmx>
223 : DForm_1<name, opcode, ppc64, vmx> {
224 let Arg0Type = Fpr.Value;
225}
226
Misha Brukman28beda92004-08-11 15:54:36 +0000227// 1.7.5 DS-Form
228class DSForm_1<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
229 : I<name, opcode, ppc64, vmx> {
230 field bits<5> RST;
231 field bits<14> DS;
232 field bits<5> RA;
233
234 let ArgCount = 3;
235 let Arg0Type = Gpr.Value;
236 let Arg1Type = Disimm14.Value;
237 let Arg2Type = Gpr.Value;
238 let Arg3Type = 0;
239 let Arg4Type = 0;
240
241 let Inst{6-10} = RST;
242 let Inst{11-15} = RA;
243 let Inst{16-29} = DS;
244 let Inst{30-31} = xo;
245}
246
247class DSForm_2<string name, bits<6> opcode, bits<2> xo, bit ppc64, bit vmx>
248 : DSForm_1<name, opcode, xo, ppc64, vmx>;
249
Misha Brukman5295e1d2004-08-09 17:24:04 +0000250// 1.7.6 X-Form
251class XForm_base_r3xo<string name, bits<6> opcode, bits<10> xo, bit rc,
Misha Brukmandad438b2004-08-10 22:47:03 +0000252 bit ppc64, bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman28beda92004-08-11 15:54:36 +0000253 field bits<5> RST;
254 field bits<5> A;
255 field bits<5> B;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000256
257 let ArgCount = 3;
258 let Arg0Type = Gpr.Value;
259 let Arg1Type = Gpr.Value;
260 let Arg2Type = Gpr.Value;
261 let Arg3Type = 0;
262 let Arg4Type = 0;
263
Misha Brukman28beda92004-08-11 15:54:36 +0000264 let Inst{6-10} = RST;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000265 let Inst{11-15} = A;
266 let Inst{16-20} = B;
267 let Inst{21-30} = xo;
268 let Inst{31} = rc;
269}
270
Nate Begeman765cb5f2004-08-13 02:19:26 +0000271
Misha Brukman5295e1d2004-08-09 17:24:04 +0000272class XForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64,
273 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx>;
274
275class XForm_5<string name, bits<6> opcode, bits<10> xo, bit ppc64,
276 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
277 let ArgCount = 1;
278 let Arg1Type = 0;
279 let Arg2Type = 0;
280 let A = 0;
281 let B = 0;
282}
283
284class XForm_6<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
285 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx>;
286
287class XForm_7<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
288 : XForm_base_r3xo<name, opcode, xo, 1, ppc64, vmx>;
289
290class XForm_8<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
291 : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx>;
292
293class XForm_10<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
294 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
295 let Arg2Type = Imm5.Value;
296}
297
298class XForm_11<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
299 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
300 let ArgCount = 2;
301 let Arg2Type = 0;
302 let B = 0;
303}
304
305class XForm_16<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000306 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000307 field bits<3> BF;
308 field bits<1> L;
309 field bits<5> RA;
310 field bits<5> RB;
311
312 let ArgCount = 4;
313 let Arg0Type = Imm3.Value;
314 let Arg1Type = Imm1.Value;
315 let Arg2Type = Gpr.Value;
316 let Arg3Type = Gpr.Value;
317 let Arg4Type = 0;
318
319 let Inst{6-8} = BF;
320 let Inst{9} = 0;
321 let Inst{10} = L;
322 let Inst{11-15} = RA;
323 let Inst{16-20} = RB;
324 let Inst{21-30} = xo;
325 let Inst{31} = 0;
326}
327
328class XForm_16_ext<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
329 : XForm_16<name, opcode, xo, ppc64, vmx> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000330 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000331}
332
333class XForm_17<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000334 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000335 field bits<3> BF;
336 field bits<5> FRA;
337 field bits<5> FRB;
338
339 let ArgCount = 3;
340 let Arg0Type = Imm3.Value;
341 let Arg1Type = Fpr.Value;
342 let Arg2Type = Fpr.Value;
343 let Arg3Type = 0;
344 let Arg4Type = 0;
345
346 let Inst{6-8} = BF;
347 let Inst{9-10} = 0;
348 let Inst{11-15} = FRA;
349 let Inst{16-20} = FRB;
350 let Inst{21-30} = xo;
351 let Inst{31} = 0;
352}
353
354class XForm_25<string name, bits<6> opcode, bits<10> xo, bit ppc64,
355 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
356 let Arg0Type = Fpr.Value;
357 let Arg1Type = Gpr0.Value;
358}
359
360class XForm_26<string name, bits<6> opcode, bits<10> xo, bit rc, bit ppc64,
361 bit vmx> : XForm_base_r3xo<name, opcode, xo, rc, ppc64, vmx> {
362 let ArgCount = 2;
363 let Arg0Type = Fpr.Value;
364 let Arg1Type = Fpr.Value;
365 let Arg2Type = 0;
366 let A = 0;
367}
368
369class XForm_28<string name, bits<6> opcode, bits<10> xo, bit ppc64,
370 bit vmx> : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
371 let Arg0Type = Fpr.Value;
372 let Arg1Type = Gpr0.Value;
373}
374
375// 1.7.7 XL-Form
376class XLForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
377 : XForm_base_r3xo<name, opcode, xo, 0, ppc64, vmx> {
378 let Arg0Type = Imm5.Value;
379 let Arg1Type = Imm5.Value;
380 let Arg2Type = Imm5.Value;
381}
382
383class XLForm_2<string name, bits<6> opcode, bits<10> xo, bit lk, bit ppc64,
Misha Brukmandad438b2004-08-10 22:47:03 +0000384 bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000385 field bits<5> BO;
386 field bits<5> BI;
387 field bits<2> BH;
388
389 let ArgCount = 3;
390 let Arg0Type = Imm5.Value;
391 let Arg1Type = Imm5.Value;
392 let Arg2Type = Imm2.Value;
393 let Arg3Type = 0;
394 let Arg4Type = 0;
395
396 let Inst{6-10} = BO;
397 let Inst{11-15} = BI;
398 let Inst{16-18} = 0;
399 let Inst{19-20} = BH;
400 let Inst{21-30} = xo;
401 let Inst{31} = lk;
402}
403
404class XLForm_2_ext<string name, bits<6> opcode, bits<10> xo, bits<5> bo,
405 bits<5> bi, bit lk, bit ppc64, bit vmx>
406 : XLForm_2<name, opcode, xo, lk, ppc64, vmx> {
407 let ArgCount = 0;
408 let Arg0Type = 0;
409 let Arg1Type = 0;
410 let Arg2Type = 0;
411 let BO = bo;
412 let BI = bi;
413 let BH = 0;
414}
415
416// 1.7.8 XFX-Form
417class XFXForm_1<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000418 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000419 field bits<5> ST;
420 field bits<10> SPR;
421
422 let ArgCount = 2;
423 let Arg0Type = Imm5.Value;
424 let Arg1Type = Gpr.Value;
425 let Arg2Type = 0;
426 let Arg3Type = 0;
427 let Arg4Type = 0;
428
429 let Inst{6-10} = ST;
430 let Inst{11-20} = SPR;
431 let Inst{21-30} = xo;
432 let Inst{31} = 0;
433}
434
435class XFXForm_1_ext<string name, bits<6> opcode, bits<10> xo, bits<10> spr,
436 bit ppc64, bit vmx> : XFXForm_1<name,opcode,xo,ppc64,vmx> {
437 let ArgCount = 1;
438 let Arg0Type = Gpr.Value;
439 let Arg1Type = 0;
440 let SPR = spr;
441}
442
443class XFXForm_7<string name, bits<6> opcode, bits<10> xo, bit ppc64, bit vmx>
444 : XFXForm_1<name, opcode, xo, ppc64, vmx>;
445
446class XFXForm_7_ext<string name, bits<6> opcode, bits<10> xo, bits<10> spr,
447 bit ppc64, bit vmx> : XFXForm_7<name,opcode,xo,ppc64,vmx> {
448 let ArgCount = 1;
449 let Arg0Type = Gpr.Value;
450 let Arg1Type = 0;
451 let SPR = spr;
452}
453
Nate Begeman765cb5f2004-08-13 02:19:26 +0000454// 1.7.10 XS-Form
455class XSForm_1<string name, bits<6> opcode, bits<9> xo, bit rc,
456 bit ppc64, bit vmx> : I<name, opcode, ppc64, vmx> {
457 field bits<5> RS;
458 field bits<5> A;
459 field bits<6> SH;
460
461 let ArgCount = 3;
462 let Arg0Type = Gpr.Value;
463 let Arg1Type = Gpr.Value;
464 let Arg2Type = Imm6.Value;
465 let Arg3Type = 0;
466 let Arg4Type = 0;
467
468 let Inst{6-10} = RS;
469 let Inst{11-15} = A;
470 let Inst{16-20} = SH{1-5};
471 let Inst{21-29} = xo;
472 let Inst{30} = SH{0};
473 let Inst{31} = rc;
474}
475
Misha Brukman5295e1d2004-08-09 17:24:04 +0000476// 1.7.11 XO-Form
477class XOForm_1<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
Misha Brukmandad438b2004-08-10 22:47:03 +0000478 bit ppc64, bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000479 field bits<5> RT;
480 field bits<5> RA;
481 field bits<5> RB;
482
483 let ArgCount = 3;
484 let Arg0Type = Gpr.Value;
485 let Arg1Type = Gpr.Value;
486 let Arg2Type = Gpr.Value;
487 let Arg3Type = 0;
488 let Arg4Type = 0;
489
490 let Inst{6-10} = RT;
491 let Inst{11-15} = RA;
492 let Inst{16-20} = RB;
493 let Inst{21} = oe;
494 let Inst{22-30} = xo;
495 let Inst{31} = rc;
496}
497
498// This is a reversal of the two operands, used notably by extended ops SUB*:
499// sub x, y, z == subf x, z, y
500// subc x, y, z == subfc x, z, y
501class XOForm_1_rev<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
502 bit ppc64, bit vmx>
503 : XOForm_1<name, opcode, xo, oe, rc, ppc64, vmx> {
504 let Inst{11-15} = RB;
505 let Inst{16-20} = RA;
506}
507
508class XOForm_2<string name, bits<6> opcode, bits<9> xo, bit rc, bit ppc64,
509 bit vmx> : XOForm_1<name, opcode, xo, 0, rc, ppc64, vmx>;
510
511class XOForm_3<string name, bits<6> opcode, bits<9> xo, bit oe, bit rc,
512 bit ppc64, bit vmx> : XOForm_1<name,opcode,xo,oe,rc,ppc64,vmx> {
513 let RB = 0;
514}
515
516// 1.7.12 A-Form
517class AForm_1<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
Misha Brukmandad438b2004-08-10 22:47:03 +0000518 bit vmx> : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000519 let ArgCount = 4;
520 field bits<5> FRT;
521 field bits<5> FRA;
522 field bits<5> FRB;
523 field bits<5> FRC;
524
525 let Arg0Type = Fpr.Value;
526 let Arg1Type = Fpr.Value;
527 let Arg2Type = Fpr.Value;
528 let Arg3Type = Fpr.Value;
529 let Arg4Type = 0;
530
531 let Inst{6-10} = FRT;
532 let Inst{11-15} = FRA;
533 let Inst{16-20} = FRB;
534 let Inst{21-25} = FRC;
535 let Inst{26-30} = xo;
536 let Inst{31} = rc;
537}
538
539class AForm_2<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
540 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
541 let ArgCount = 3;
542 let Arg3Type = 0;
543 let FRC = 0;
544}
545
546class AForm_3<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
547 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
548 let ArgCount = 3;
549 let Arg3Type = 0;
550 let FRB = 0;
551}
552
553class AForm_4<string name, bits<6> opcode, bits<5> xo, bit rc, bit ppc64,
554 bit vmx> : AForm_1<name, opcode, xo, rc, ppc64, vmx> {
555 let ArgCount = 2;
556 let Arg2Type = 0;
557 let Arg3Type = 0;
558 let FRA = 0;
559 let FRC = 0;
560}
561
562// 1.7.13 M-Form
563class MForm_1<string name, bits<6> opcode, bit rc, bit ppc64, bit vmx>
Misha Brukmandad438b2004-08-10 22:47:03 +0000564 : I<name, opcode, ppc64, vmx> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000565 let ArgCount = 5;
566 field bits<5> RS;
567 field bits<5> RA;
568 field bits<5> RB;
569 field bits<5> MB;
570 field bits<5> ME;
571
572 let Arg0Type = Gpr.Value;
573 let Arg1Type = Gpr.Value;
574 let Arg2Type = Gpr.Value;
575 let Arg3Type = Imm5.Value;
576 let Arg4Type = Imm5.Value;
577
578 let Inst{6-10} = RS;
579 let Inst{11-15} = RA;
580 let Inst{16-20} = RB;
581 let Inst{21-25} = MB;
582 let Inst{26-30} = ME;
583 let Inst{31} = rc;
584}
585
586class MForm_2<string name, bits<6> opcode, bit rc, bit ppc64, bit vmx>
587 : MForm_1<name, opcode, rc, ppc64, vmx> {
588 let Arg2Type = Imm5.Value;
589}
590
Nate Begeman765cb5f2004-08-13 02:19:26 +0000591// 1.7.14 MD-Form
592class MDForm_1<string name, bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx>
593 : I<name, opcode, ppc64, vmx> {
594 let ArgCount = 4;
595 field bits<5> RS;
596 field bits<5> RA;
597 field bits<6> SH;
598 field bits<6> MBE;
599
600 let Arg0Type = Gpr.Value;
601 let Arg1Type = Gpr.Value;
602 let Arg2Type = Imm6.Value;
603 let Arg3Type = Imm6.Value;
604 let Arg4Type = 0;
605
606 let Inst{6-10} = RS;
607 let Inst{11-15} = RA;
608 let Inst{16-20} = SH{1-5};
609 let Inst{21-26} = MBE;
610 let Inst{27-29} = xo;
611 let Inst{30} = SH{0};
612 let Inst{31} = rc;
613}
614
Misha Brukman6b21bde2004-08-02 21:56:35 +0000615//===----------------------------------------------------------------------===//
616
Misha Brukmandad438b2004-08-10 22:47:03 +0000617class Pseudo<string name> : I<name, 0, 0, 0> {
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000618 let Name = name;
619 let ArgCount = 0;
620 let PPC64 = 0;
621 let VMX = 0;
622
Misha Brukman5295e1d2004-08-09 17:24:04 +0000623 let Arg0Type = Pseudo.Value;
624 let Arg1Type = Pseudo.Value;
625 let Arg2Type = Pseudo.Value;
626 let Arg3Type = Pseudo.Value;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000627 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000628
Misha Brukmandad438b2004-08-10 22:47:03 +0000629 let Inst{31-0} = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000630}