blob: b4f868fb39eb190242ae27481d201c6f018e488a [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>
134 : DForm_base<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000135 let Arg1Type = Disimm16.Value;
Nate Begeman4bfceb12004-09-04 05:00:00 +0000136 let Arg2Type = Gpr.Value;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000137}
138
Nate Begeman4bfceb12004-09-04 05:00:00 +0000139class DForm_2<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
140 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000141
Nate Begeman4bfceb12004-09-04 05:00:00 +0000142class DForm_2_r0<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
143 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000144 bits<5> A;
145 bits<16> B;
Nate Begeman4bfceb12004-09-04 05:00:00 +0000146
147 let ArgCount = 2;
148 let Arg0Type = Gpr.Value;
149 let Arg1Type = Simm16.Value;
150 let Arg2Type = 0;
151 let Arg3Type = 0;
152 let Arg4Type = 0;
153
154 let Inst{6-10} = A;
155 let Inst{11-15} = 0;
156 let Inst{16-31} = B;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000157}
158
159// Currently we make the use/def reg distinction in ISel, not tablegen
Nate Begeman4bfceb12004-09-04 05:00:00 +0000160class DForm_3<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
161 : DForm_1<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman6b21bde2004-08-02 21:56:35 +0000162
Nate Begeman4bfceb12004-09-04 05:00:00 +0000163class DForm_4<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
164 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
165
166class DForm_4_zero<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
167 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000168 let ArgCount = 0;
169 let Arg0Type = 0;
170 let Arg1Type = 0;
171 let Arg2Type = 0;
172 let A = 0;
173 let B = 0;
174 let C = 0;
175}
176
Nate Begeman4bfceb12004-09-04 05:00:00 +0000177class DForm_5<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
178 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000179 bits<3> BF;
180 bits<1> L;
181 bits<5> RA;
182 bits<16> I;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000183
184 let ArgCount = 4;
185 let Arg0Type = Imm3.Value;
186 let Arg1Type = Imm1.Value;
187 let Arg2Type = Gpr.Value;
188 let Arg3Type = Simm16.Value;
189 let Arg4Type = 0;
190
191 let Inst{6-8} = BF;
192 let Inst{9} = 0;
193 let Inst{10} = L;
194 let Inst{11-15} = RA;
195 let Inst{16-31} = I;
196}
197
Nate Begeman4bfceb12004-09-04 05:00:00 +0000198class DForm_5_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
199 : DForm_5<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000200 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000201 let ArgCount = 3;
202 let Arg0Type = Imm3.Value;
203 let Arg1Type = Gpr.Value;
204 let Arg2Type = Simm16.Value;
205 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000206}
207
Nate Begeman4bfceb12004-09-04 05:00:00 +0000208class DForm_6<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
209 : DForm_5<opcode, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000210
Nate Begeman4bfceb12004-09-04 05:00:00 +0000211class DForm_6_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
Chris Lattnerda2e56f2004-08-15 05:46:14 +0000212 : DForm_6<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000213 let L = ppc64;
Misha Brukmanc6b114f2004-08-10 19:03:31 +0000214 let ArgCount = 3;
215 let Arg0Type = Imm3.Value;
216 let Arg1Type = Gpr.Value;
217 let Arg2Type = Simm16.Value;
218 let Arg3Type = 0;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000219}
220
Nate Begeman4bfceb12004-09-04 05:00:00 +0000221class DForm_8<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
222 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000223 let Arg0Type = Fpr.Value;
224}
225
Nate Begeman4bfceb12004-09-04 05:00:00 +0000226class DForm_9<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
227 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000228 let Arg0Type = Fpr.Value;
229}
230
Misha Brukman28beda92004-08-11 15:54:36 +0000231// 1.7.5 DS-Form
Nate Begeman4bfceb12004-09-04 05:00:00 +0000232class DSForm_1<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
233 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000234 bits<5> RST;
235 bits<14> DS;
236 bits<5> RA;
Misha Brukman28beda92004-08-11 15:54:36 +0000237
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
Nate Begeman4bfceb12004-09-04 05:00:00 +0000251class DSForm_2<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
252 dag OL, string asmstr>
253 : DSForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman28beda92004-08-11 15:54:36 +0000254
Misha Brukman5295e1d2004-08-09 17:24:04 +0000255// 1.7.6 X-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000256class XForm_base_r3xo<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000257 dag OL, string asmstr>
258 : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000259 bits<5> RST;
260 bits<5> A;
261 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;
275}
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
Nate Begeman61738782004-09-02 08:13:00 +0000314class XForm_16<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000315 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000316 bits<3> BF;
317 bits<1> L;
318 bits<5> RA;
319 bits<5> RB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000320
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
Nate Begeman61738782004-09-02 08:13:00 +0000337class XForm_16_ext<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
338 dag OL, string asmstr>
339 : XForm_16<opcode, xo, ppc64, vmx, OL, asmstr> {
340 let ArgCount = 3;
341 let Arg1Type = Gpr.Value;
342 let Arg2Type = Gpr.Value;
343 let Arg3Type = 0;
Misha Brukman78c1dcf2004-08-11 20:56:14 +0000344 let L = ppc64;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000345}
346
Nate Begemana113d742004-08-31 02:28:08 +0000347class XForm_17<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000348 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000349 bits<3> BF;
350 bits<5> FRA;
351 bits<5> FRB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000352
353 let ArgCount = 3;
354 let Arg0Type = Imm3.Value;
355 let Arg1Type = Fpr.Value;
356 let Arg2Type = Fpr.Value;
357 let Arg3Type = 0;
358 let Arg4Type = 0;
359
360 let Inst{6-8} = BF;
361 let Inst{9-10} = 0;
362 let Inst{11-15} = FRA;
363 let Inst{16-20} = FRB;
364 let Inst{21-30} = xo;
365 let Inst{31} = 0;
366}
367
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000368class XForm_25<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
369 dag OL, string asmstr>
370 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000371 let Arg0Type = Fpr.Value;
372 let Arg1Type = Gpr0.Value;
373}
374
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000375class XForm_26<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
376 dag OL, string asmstr>
377 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000378 let ArgCount = 2;
379 let Arg0Type = Fpr.Value;
380 let Arg1Type = Fpr.Value;
381 let Arg2Type = 0;
382 let A = 0;
383}
384
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000385class XForm_28<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
386 dag OL, string asmstr>
387 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000388 let Arg0Type = Fpr.Value;
389 let Arg1Type = Gpr0.Value;
390}
391
392// 1.7.7 XL-Form
Nate Begeman3ad3ad42004-08-21 05:56:39 +0000393class XLForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
394 dag OL, string asmstr>
395 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000396 let Arg0Type = Imm5.Value;
397 let Arg1Type = Imm5.Value;
398 let Arg2Type = Imm5.Value;
399}
400
Nate Begeman61738782004-09-02 08:13:00 +0000401class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000402 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000403 bits<5> BO;
404 bits<5> BI;
405 bits<2> BH;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000406
407 let ArgCount = 3;
408 let Arg0Type = Imm5.Value;
409 let Arg1Type = Imm5.Value;
410 let Arg2Type = Imm2.Value;
411 let Arg3Type = 0;
412 let Arg4Type = 0;
413
414 let Inst{6-10} = BO;
415 let Inst{11-15} = BI;
416 let Inst{16-18} = 0;
417 let Inst{19-20} = BH;
418 let Inst{21-30} = xo;
419 let Inst{31} = lk;
420}
421
Nate Begeman61738782004-09-02 08:13:00 +0000422class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,
423 bits<5> bi, bit lk, bit ppc64, bit vmx,
424 dag OL, string asmstr>
425 : XLForm_2<opcode, xo, lk, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000426 let ArgCount = 0;
427 let Arg0Type = 0;
428 let Arg1Type = 0;
429 let Arg2Type = 0;
430 let BO = bo;
431 let BI = bi;
432 let BH = 0;
433}
434
435// 1.7.8 XFX-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000436class XFXForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000437 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000438 bits<5> ST;
439 bits<10> SPR;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000440
441 let ArgCount = 2;
442 let Arg0Type = Imm5.Value;
443 let Arg1Type = Gpr.Value;
444 let Arg2Type = 0;
445 let Arg3Type = 0;
446 let Arg4Type = 0;
447
448 let Inst{6-10} = ST;
449 let Inst{11-20} = SPR;
450 let Inst{21-30} = xo;
451 let Inst{31} = 0;
452}
453
Nate Begeman143cf942004-08-30 02:28:06 +0000454class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, bit ppc64,
455 bit vmx, dag OL, string asmstr>
456 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000457 let ArgCount = 1;
458 let Arg0Type = Gpr.Value;
459 let Arg1Type = 0;
460 let SPR = spr;
461}
462
Nate Begeman143cf942004-08-30 02:28:06 +0000463class XFXForm_7<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
464 dag OL, string asmstr>
465 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000466
Nate Begeman143cf942004-08-30 02:28:06 +0000467class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
468 bit ppc64, bit vmx, dag OL, string asmstr>
469 : XFXForm_7<opcode, xo, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000470 let ArgCount = 1;
471 let Arg0Type = Gpr.Value;
472 let Arg1Type = 0;
473 let SPR = spr;
474}
475
Nate Begeman765cb5f2004-08-13 02:19:26 +0000476// 1.7.10 XS-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000477class XSForm_1<bits<6> opcode, bits<9> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000478 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000479 bits<5> RS;
480 bits<5> A;
481 bits<6> SH;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000482
483 let ArgCount = 3;
484 let Arg0Type = Gpr.Value;
485 let Arg1Type = Gpr.Value;
486 let Arg2Type = Imm6.Value;
487 let Arg3Type = 0;
488 let Arg4Type = 0;
489
490 let Inst{6-10} = RS;
491 let Inst{11-15} = A;
492 let Inst{16-20} = SH{1-5};
493 let Inst{21-29} = xo;
494 let Inst{30} = SH{0};
495 let Inst{31} = rc;
496}
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,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000500 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman189f3dc2004-10-14 05:55:37 +0000501 bits<5> RT;
502 bits<5> RA;
503 bits<5> RB;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000504
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;
518}
519
Nate Begeman143cf942004-08-30 02:28:06 +0000520class XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
521 dag OL, string asmstr>
522 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000523 let Inst{11-15} = RB;
524 let Inst{16-20} = RA;
525}
526
Nate Begeman143cf942004-08-30 02:28:06 +0000527class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
528 dag OL, string asmstr>
529 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
530 let ArgCount = 2;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000531 let RB = 0;
532}
533
534// 1.7.12 A-Form
Nate Begeman143cf942004-08-30 02:28:06 +0000535class AForm_1<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000536 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000537 let ArgCount = 4;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000538 bits<5> FRT;
539 bits<5> FRA;
540 bits<5> FRB;
541 bits<5> FRC;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000542
543 let Arg0Type = Fpr.Value;
544 let Arg1Type = Fpr.Value;
545 let Arg2Type = Fpr.Value;
546 let Arg3Type = Fpr.Value;
547 let Arg4Type = 0;
548
549 let Inst{6-10} = FRT;
550 let Inst{11-15} = FRA;
551 let Inst{16-20} = FRB;
552 let Inst{21-25} = FRC;
553 let Inst{26-30} = xo;
554 let Inst{31} = rc;
555}
556
Nate Begeman6cdbd222004-08-29 22:45:13 +0000557class AForm_2<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
558 string asmstr>
559 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000560 let ArgCount = 3;
561 let Arg3Type = 0;
562 let FRC = 0;
563}
564
Nate Begeman6cdbd222004-08-29 22:45:13 +0000565class AForm_3<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
566 string asmstr>
567 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000568 let ArgCount = 3;
569 let Arg3Type = 0;
570 let FRB = 0;
571}
572
Misha Brukman5295e1d2004-08-09 17:24:04 +0000573// 1.7.13 M-Form
Nate Begemana113d742004-08-31 02:28:08 +0000574class MForm_1<bits<6> opcode, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000575 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000576 let ArgCount = 5;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000577 bits<5> RS;
578 bits<5> RA;
579 bits<5> RB;
580 bits<5> MB;
581 bits<5> ME;
Misha Brukman5295e1d2004-08-09 17:24:04 +0000582
583 let Arg0Type = Gpr.Value;
584 let Arg1Type = Gpr.Value;
585 let Arg2Type = Gpr.Value;
586 let Arg3Type = Imm5.Value;
587 let Arg4Type = Imm5.Value;
588
589 let Inst{6-10} = RS;
590 let Inst{11-15} = RA;
591 let Inst{16-20} = RB;
592 let Inst{21-25} = MB;
593 let Inst{26-30} = ME;
594 let Inst{31} = rc;
595}
596
Nate Begemana113d742004-08-31 02:28:08 +0000597class MForm_2<bits<6> opcode, bit rc, bit ppc64, bit vmx,
598 dag OL, string asmstr>
599 : MForm_1<opcode, rc, ppc64, vmx, OL, asmstr> {
Misha Brukman5295e1d2004-08-09 17:24:04 +0000600 let Arg2Type = Imm5.Value;
601}
602
Nate Begeman765cb5f2004-08-13 02:19:26 +0000603// 1.7.14 MD-Form
Nate Begemana113d742004-08-31 02:28:08 +0000604class MDForm_1<bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx,
Nate Begeman4bfceb12004-09-04 05:00:00 +0000605 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
Nate Begeman765cb5f2004-08-13 02:19:26 +0000606 let ArgCount = 4;
Misha Brukman189f3dc2004-10-14 05:55:37 +0000607 bits<5> RS;
608 bits<5> RA;
609 bits<6> SH;
610 bits<6> MBE;
Nate Begeman765cb5f2004-08-13 02:19:26 +0000611
612 let Arg0Type = Gpr.Value;
613 let Arg1Type = Gpr.Value;
614 let Arg2Type = Imm6.Value;
615 let Arg3Type = Imm6.Value;
616 let Arg4Type = 0;
617
618 let Inst{6-10} = RS;
619 let Inst{11-15} = RA;
620 let Inst{16-20} = SH{1-5};
621 let Inst{21-26} = MBE;
622 let Inst{27-29} = xo;
623 let Inst{30} = SH{0};
624 let Inst{31} = rc;
625}
626
Misha Brukman6b21bde2004-08-02 21:56:35 +0000627//===----------------------------------------------------------------------===//
628
Nate Begeman4bfceb12004-09-04 05:00:00 +0000629class Pseudo<dag OL, string asmstr> : I<0, 0, 0, OL, asmstr> {
Nate Begeman61738782004-09-02 08:13:00 +0000630 let ArgCount = 0;
631 let PPC64 = 0;
632 let VMX = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000633
Nate Begeman61738782004-09-02 08:13:00 +0000634 let Arg0Type = Pseudo.Value;
635 let Arg1Type = Pseudo.Value;
636 let Arg2Type = Pseudo.Value;
637 let Arg3Type = Pseudo.Value;
638 let Arg4Type = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000639
Nate Begeman61738782004-09-02 08:13:00 +0000640 let Inst{31-0} = 0;
Misha Brukmancd4f51b2004-08-02 16:54:54 +0000641}