1 //===- PowerPCInstrFormats.td - PowerPC Instruction Formats --*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 class Format<bits<5> val> {
17 def Pseudo: Format<0>;
20 def Simm16 : Format<3>;
21 def PCRelimm24 : Format<5>;
22 def Imm24 : Format<6>;
24 def PCRelimm14 : Format<8>;
25 def Imm14 : Format<9>;
26 def Imm2 : Format<10>;
28 def Imm3 : Format<12>;
29 def Imm1 : Format<13>;
31 def Imm4 : Format<15>;
32 def Imm8 : Format<16>;
33 def Disimm16 : Format<17>;
34 def Disimm14 : Format<18>;
37 def Imm15 : Format<21>;
39 def Imm6 : Format<23>;
41 //===----------------------------------------------------------------------===//
43 // PowerPC instruction formats
45 class I<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
53 let Namespace = "PPC";
54 let Inst{0-5} = opcode;
56 let AsmString = asmstr;
60 class IForm<bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx,
61 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
70 class BForm<bits<6> opcode, bit aa, bit lk, bit ppc64, bit vmx,
71 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
83 class BForm_ext<bits<6> opcode, bit aa, bit lk, bits<5> bo, bits<5> bi,
84 bit ppc64, bit vmx, dag OL, string asmstr>
85 : BForm<opcode, aa, lk, ppc64, vmx, OL, asmstr> {
91 class DForm_base<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
92 : I<opcode, ppc64, vmx, OL, asmstr> {
102 class DForm_1<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
103 : I<opcode, ppc64, vmx, OL, asmstr> {
113 class DForm_2<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
114 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
116 class DForm_2_r0<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
117 : I<opcode, ppc64, vmx, OL, asmstr> {
126 // Currently we make the use/def reg distinction in ISel, not tablegen
127 class DForm_3<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
128 : DForm_1<opcode, ppc64, vmx, OL, asmstr>;
130 class DForm_4<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
131 : DForm_base<opcode, ppc64, vmx, OL, asmstr>;
133 class DForm_4_zero<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
134 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
140 class DForm_5<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
141 : I<opcode, ppc64, vmx, OL, asmstr> {
150 let Inst{11-15} = RA;
154 class DForm_5_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
155 : DForm_5<opcode, ppc64, vmx, OL, asmstr> {
159 class DForm_6<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
160 : DForm_5<opcode, ppc64, vmx, OL, asmstr>;
162 class DForm_6_ext<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
163 : DForm_6<opcode, ppc64, vmx, OL, asmstr> {
167 class DForm_8<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
168 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
171 class DForm_9<bits<6> opcode, bit ppc64, bit vmx, dag OL, string asmstr>
172 : DForm_1<opcode, ppc64, vmx, OL, asmstr> {
176 class DSForm_1<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
177 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
182 let Inst{6-10} = RST;
183 let Inst{11-15} = RA;
184 let Inst{16-29} = DS;
185 let Inst{30-31} = xo;
188 class DSForm_2<bits<6> opcode, bits<2> xo, bit ppc64, bit vmx,
189 dag OL, string asmstr>
190 : DSForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
193 class XForm_base_r3xo<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
194 dag OL, string asmstr>
195 : I<opcode, ppc64, vmx, OL, asmstr> {
200 let Inst{6-10} = RST;
203 let Inst{21-30} = xo;
208 class XForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
209 dag OL, string asmstr>
210 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
212 class XForm_5<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
213 dag OL, string asmstr>
214 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
219 class XForm_6<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
220 dag OL, string asmstr>
221 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr>;
223 class XForm_8<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
224 dag OL, string asmstr>
225 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr>;
227 class XForm_10<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
228 dag OL, string asmstr>
229 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
232 class XForm_11<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
233 dag OL, string asmstr>
234 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
238 class XForm_16<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
239 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
248 let Inst{11-15} = RA;
249 let Inst{16-20} = RB;
250 let Inst{21-30} = xo;
254 class XForm_16_ext<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
255 dag OL, string asmstr>
256 : XForm_16<opcode, xo, ppc64, vmx, OL, asmstr> {
260 class XForm_17<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
261 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
268 let Inst{11-15} = FRA;
269 let Inst{16-20} = FRB;
270 let Inst{21-30} = xo;
274 class XForm_25<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
275 dag OL, string asmstr>
276 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
279 class XForm_26<bits<6> opcode, bits<10> xo, bit rc, bit ppc64, bit vmx,
280 dag OL, string asmstr>
281 : XForm_base_r3xo<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
285 class XForm_28<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
286 dag OL, string asmstr>
287 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
291 class XLForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
292 dag OL, string asmstr>
293 : XForm_base_r3xo<opcode, xo, 0, ppc64, vmx, OL, asmstr> {
296 class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, bit ppc64, bit vmx,
297 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
303 let Inst{11-15} = BI;
305 let Inst{19-20} = BH;
306 let Inst{21-30} = xo;
310 class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,
311 bits<5> bi, bit lk, bit ppc64, bit vmx,
312 dag OL, string asmstr>
313 : XLForm_2<opcode, xo, lk, ppc64, vmx, OL, asmstr> {
320 class XFXForm_1<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
321 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
326 let Inst{11-20} = SPR;
327 let Inst{21-30} = xo;
331 class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, bit ppc64,
332 bit vmx, dag OL, string asmstr>
333 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr> {
337 class XFXForm_7<bits<6> opcode, bits<10> xo, bit ppc64, bit vmx,
338 dag OL, string asmstr>
339 : XFXForm_1<opcode, xo, ppc64, vmx, OL, asmstr>;
341 class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
342 bit ppc64, bit vmx, dag OL, string asmstr>
343 : XFXForm_7<opcode, xo, ppc64, vmx, OL, asmstr> {
348 class XSForm_1<bits<6> opcode, bits<9> xo, bit rc, bit ppc64, bit vmx,
349 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
356 let Inst{16-20} = SH{1-5};
357 let Inst{21-29} = xo;
358 let Inst{30} = SH{0};
363 class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
364 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
370 let Inst{11-15} = RA;
371 let Inst{16-20} = RB;
373 let Inst{22-30} = xo;
377 class XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
378 dag OL, string asmstr>
379 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
380 let Inst{11-15} = RB;
381 let Inst{16-20} = RA;
384 class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx,
385 dag OL, string asmstr>
386 : XOForm_1<opcode, xo, oe, rc, ppc64, vmx, OL, asmstr> {
391 class AForm_1<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx,
392 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
398 let Inst{6-10} = FRT;
399 let Inst{11-15} = FRA;
400 let Inst{16-20} = FRB;
401 let Inst{21-25} = FRC;
402 let Inst{26-30} = xo;
406 class AForm_2<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
408 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
412 class AForm_3<bits<6> opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL,
414 : AForm_1<opcode, xo, rc, ppc64, vmx, OL, asmstr> {
419 class MForm_1<bits<6> opcode, bit rc, bit ppc64, bit vmx,
420 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
428 let Inst{11-15} = RA;
429 let Inst{16-20} = RB;
430 let Inst{21-25} = MB;
431 let Inst{26-30} = ME;
435 class MForm_2<bits<6> opcode, bit rc, bit ppc64, bit vmx,
436 dag OL, string asmstr>
437 : MForm_1<opcode, rc, ppc64, vmx, OL, asmstr> {
441 class MDForm_1<bits<6> opcode, bits<3> xo, bit rc, bit ppc64, bit vmx,
442 dag OL, string asmstr> : I<opcode, ppc64, vmx, OL, asmstr> {
449 let Inst{11-15} = RA;
450 let Inst{16-20} = SH{1-5};
451 let Inst{21-26} = MBE;
452 let Inst{27-29} = xo;
453 let Inst{30} = SH{0};
457 //===----------------------------------------------------------------------===//
459 class Pseudo<dag OL, string asmstr> : I<0, 0, 0, OL, asmstr> {