dform 8/9 are identical to dform 1
[oota-llvm.git] / lib / Target / PowerPC / PPCInstrFormats.td
1 //===- 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 // PowerPC instruction formats
13
14 class I<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
15         : Instruction {
16   field bits<32> Inst;
17
18   bit PPC64 = 0;  // Default value, override with isPPC64
19
20   let Name = "";
21   let Namespace = "PPC";
22   let Inst{0-5} = opcode;
23   let OperandList = OL;
24   let AsmString = asmstr;
25   let Itinerary = itin;
26   
27   /// These fields correspond to the fields in PPCInstrInfo.h.  Any changes to
28   /// these must be reflected there!  See comments there for what these are.
29   bits<1> PPC970_First = 0;
30   bits<1> PPC970_Single = 0;
31   bits<1> PPC970_Cracked = 0;
32   bits<3> PPC970_Unit = 0;
33 }
34
35 class PPC970_DGroup_First   { bits<1> PPC970_First = 1;  }
36 class PPC970_DGroup_Single  { bits<1> PPC970_Single = 1; }
37 class PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
38 class PPC970_MicroCode;
39
40 class PPC970_Unit_Pseudo   { bits<3> PPC970_Unit = 0;   }
41 class PPC970_Unit_FXU      { bits<3> PPC970_Unit = 1;   }
42 class PPC970_Unit_LSU      { bits<3> PPC970_Unit = 2;   }
43 class PPC970_Unit_FPU      { bits<3> PPC970_Unit = 3;   }
44 class PPC970_Unit_CRU      { bits<3> PPC970_Unit = 4;   }
45 class PPC970_Unit_VALU     { bits<3> PPC970_Unit = 5;   }
46 class PPC970_Unit_VPERM    { bits<3> PPC970_Unit = 6;   }
47 class PPC970_Unit_BRU      { bits<3> PPC970_Unit = 7;   }
48
49
50 // 1.7.1 I-Form
51 class IForm<bits<6> opcode, bit aa, bit lk, dag OL, string asmstr,
52             InstrItinClass itin, list<dag> pattern>
53          : I<opcode, OL, asmstr, itin> {
54   let Pattern = pattern;
55   bits<24> LI;
56
57   let Inst{6-29}  = LI;
58   let Inst{30}    = aa;
59   let Inst{31}    = lk;
60 }
61
62 // 1.7.2 B-Form
63 class BForm<bits<6> opcode, bit aa, bit lk, bits<5> bo, bits<2> bicode, dag OL, 
64             string asmstr, InstrItinClass itin>
65   : I<opcode, OL, asmstr, itin> {
66   bits<3>  CR;
67   bits<14> BD;
68
69   let Inst{6-10}  = bo;
70   let Inst{11-13} = CR;
71   let Inst{14-15} = bicode;
72   let Inst{16-29} = BD;
73   let Inst{30}    = aa;
74   let Inst{31}    = lk;
75 }
76
77 // 1.7.4 D-Form
78 class DForm_base<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
79                  list<dag> pattern> 
80   : I<opcode, OL, asmstr, itin> {
81   bits<5>  A;
82   bits<5>  B;
83   bits<16> C;
84
85   let Pattern = pattern;
86   
87   let Inst{6-10}  = A;
88   let Inst{11-15} = B;
89   let Inst{16-31} = C;
90 }
91
92 class DForm_1<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
93               list<dag> pattern>
94   : I<opcode, OL, asmstr, itin> {
95   bits<5>  A;
96   bits<16> C;
97   bits<5>  B;
98
99   let Pattern = pattern;
100   
101   let Inst{6-10}  = A;
102   let Inst{11-15} = B;
103   let Inst{16-31} = C;
104 }
105
106 class DForm_2<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
107               list<dag> pattern>
108   : DForm_base<opcode, OL, asmstr, itin, pattern>;
109
110 class DForm_2_r0<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
111                  list<dag> pattern>
112   : I<opcode, OL, asmstr, itin> {
113   bits<5>  A;
114   bits<16> B;
115   
116   let Pattern = pattern;
117   
118   let Inst{6-10}  = A;
119   let Inst{11-15} = 0;
120   let Inst{16-31} = B;
121 }
122
123 // Currently we make the use/def reg distinction in ISel, not tablegen
124 class DForm_3<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
125               list<dag> pattern>
126   : DForm_1<opcode, OL, asmstr, itin, pattern>;
127
128 class DForm_4<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
129               list<dag> pattern>
130   : I<opcode, OL, asmstr, itin> {
131   bits<5>  B;
132   bits<5>  A;
133   bits<16> C;
134   
135   let Pattern = pattern;
136   
137   let Inst{6-10}  = A;
138   let Inst{11-15} = B;
139   let Inst{16-31} = C;
140 }
141               
142 class DForm_4_zero<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
143                    list<dag> pattern>
144   : DForm_1<opcode, OL, asmstr, itin, pattern> {
145   let A = 0;
146   let B = 0;
147   let C = 0;
148 }
149
150 class DForm_5<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
151   : I<opcode, OL, asmstr, itin> {
152   bits<3>  BF;
153   bits<1>  L;
154   bits<5>  RA;
155   bits<16> I;
156
157   let Inst{6-8}   = BF;
158   let Inst{9}     = 0;
159   let Inst{10}    = L;
160   let Inst{11-15} = RA;
161   let Inst{16-31} = I;
162 }
163
164 class DForm_5_ext<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
165   : DForm_5<opcode, OL, asmstr, itin> {
166   let L = PPC64;
167 }
168
169 class DForm_6<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin> 
170   : DForm_5<opcode, OL, asmstr, itin>;
171
172 class DForm_6_ext<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
173   : DForm_6<opcode, OL, asmstr, itin> {
174   let L = PPC64;
175 }
176
177
178 // 1.7.5 DS-Form
179 class DSForm_1<bits<6> opcode, bits<2> xo, dag OL, string asmstr,
180                InstrItinClass itin, list<dag> pattern>
181          : I<opcode, OL, asmstr, itin> {
182   bits<5>  RST;
183   bits<14> DS;
184   bits<5>  RA;
185
186   let Pattern = pattern;
187   
188   let Inst{6-10}  = RST;
189   let Inst{11-15} = RA;
190   let Inst{16-29} = DS;
191   let Inst{30-31} = xo;
192 }
193
194 class DSForm_2<bits<6> opcode, bits<2> xo, dag OL, string asmstr,
195                InstrItinClass itin, list<dag> pattern>
196   : DSForm_1<opcode, xo, OL, asmstr, itin, pattern>;
197
198 // 1.7.6 X-Form
199 class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OL, string asmstr, 
200                       InstrItinClass itin, list<dag> pattern>
201   : I<opcode, OL, asmstr, itin> {
202   bits<5> RST;
203   bits<5> A;
204   bits<5> B;
205
206   let Pattern = pattern;
207
208   bit RC = 0;    // set by isDOT
209
210   let Inst{6-10}  = RST;
211   let Inst{11-15} = A;
212   let Inst{16-20} = B;
213   let Inst{21-30} = xo;
214   let Inst{31}    = RC;
215 }
216
217 // This is the same as XForm_base_r3xo, but the first two operands are swapped
218 // when code is emitted.
219 class XForm_base_r3xo_swapped
220         <bits<6> opcode, bits<10> xo, dag OL, string asmstr,
221         InstrItinClass itin> 
222   : I<opcode, OL, asmstr, itin> {
223   bits<5> A;
224   bits<5> RST;
225   bits<5> B;
226
227   bit RC = 0;    // set by isDOT
228
229   let Inst{6-10}  = RST;
230   let Inst{11-15} = A;
231   let Inst{16-20} = B;
232   let Inst{21-30} = xo;
233   let Inst{31}    = RC;
234 }
235
236
237 class XForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
238               InstrItinClass itin, list<dag> pattern> 
239   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern>;
240
241 class XForm_6<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
242               InstrItinClass itin, list<dag> pattern> 
243   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
244   let Pattern = pattern;
245 }
246
247 class XForm_8<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
248               InstrItinClass itin, list<dag> pattern> 
249   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern>;
250
251 class XForm_10<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
252                InstrItinClass itin, list<dag> pattern> 
253   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
254     let Pattern = pattern;
255 }
256
257 class XForm_11<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
258                InstrItinClass itin, list<dag> pattern> 
259   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
260   let B = 0;
261   let Pattern = pattern;
262 }
263
264 class XForm_16<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
265                InstrItinClass itin>
266          : I<opcode, OL, asmstr, itin> {
267   bits<3> BF;
268   bits<1> L; 
269   bits<5> RA;
270   bits<5> RB;
271   
272   let Inst{6-8}   = BF;
273   let Inst{9}     = 0;
274   let Inst{10}    = L;
275   let Inst{11-15} = RA;
276   let Inst{16-20} = RB;
277   let Inst{21-30} = xo;
278   let Inst{31}    = 0;
279 }
280
281 class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
282                    InstrItinClass itin>
283   : XForm_16<opcode, xo, OL, asmstr, itin> {
284   let L = PPC64;
285 }
286
287 class XForm_17<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
288                InstrItinClass itin>
289          : I<opcode, OL, asmstr, itin> {
290   bits<3> BF;
291   bits<5> FRA;
292   bits<5> FRB;
293   
294   let Inst{6-8}   = BF;
295   let Inst{9-10}  = 0;
296   let Inst{11-15} = FRA;
297   let Inst{16-20} = FRB;
298   let Inst{21-30} = xo;
299   let Inst{31}    = 0;
300 }
301
302 class XForm_25<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
303                InstrItinClass itin, list<dag> pattern> 
304   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
305 }
306
307 class XForm_26<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
308                InstrItinClass itin, list<dag> pattern>
309   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
310   let A = 0;
311 }
312
313 class XForm_28<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
314                InstrItinClass itin, list<dag> pattern> 
315   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
316 }
317
318 // DCB_Form - Form X instruction, used for dcb* instructions.
319 class DCB_Form<bits<10> xo, bits<5> immfield, dag OL, string asmstr, 
320                       InstrItinClass itin, list<dag> pattern>
321   : I<31, OL, asmstr, itin> {
322   bits<5> A;
323   bits<5> B;
324
325   let Pattern = pattern;
326
327   let Inst{6-10}  = immfield;
328   let Inst{11-15} = A;
329   let Inst{16-20} = B;
330   let Inst{21-30} = xo;
331   let Inst{31}    = 0;
332 }
333
334
335 // DSS_Form - Form X instruction, used for altivec dss* instructions.
336 class DSS_Form<bits<10> xo, dag OL, string asmstr, 
337                       InstrItinClass itin, list<dag> pattern>
338   : I<31, OL, asmstr, itin> {
339   bits<1> T;
340   bits<2> STRM;
341   bits<5> A;
342   bits<5> B;
343
344   let Pattern = pattern;
345
346   let Inst{6}     = T;
347   let Inst{7-8}   = 0;
348   let Inst{9-10}  = STRM;
349   let Inst{11-15} = A;
350   let Inst{16-20} = B;
351   let Inst{21-30} = xo;
352   let Inst{31}    = 0;
353 }
354
355 // 1.7.7 XL-Form
356 class XLForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
357                InstrItinClass itin>
358     : I<opcode, OL, asmstr, itin> {
359   bits<3> CRD;
360   bits<2> CRDb;
361   bits<3> CRA;
362   bits<2> CRAb;
363   bits<3> CRB;
364   bits<2> CRBb;
365   
366   let Inst{6-8}   = CRD;
367   let Inst{9-10}  = CRDb;
368   let Inst{11-13} = CRA;
369   let Inst{14-15} = CRAb;
370   let Inst{16-18} = CRB;
371   let Inst{19-20} = CRBb;
372   let Inst{21-30} = xo;
373   let Inst{31}    = 0;
374 }
375
376 class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OL, string asmstr, 
377                InstrItinClass itin, list<dag> pattern>
378     : I<opcode, OL, asmstr, itin> {
379   bits<5> BO;
380   bits<5> BI;
381   bits<2> BH;
382   
383   let Pattern = pattern;
384   
385   let Inst{6-10}  = BO;
386   let Inst{11-15} = BI;
387   let Inst{16-18} = 0;
388   let Inst{19-20} = BH;
389   let Inst{21-30} = xo;
390   let Inst{31}    = lk;
391 }
392
393 class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
394                   dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
395   : XLForm_2<opcode, xo, lk, OL, asmstr, itin, pattern> {
396   bits<7> BIBO;  // 2 bits of BI and 5 bits of BO.
397   bits<3>  CR;
398   
399   let BO = BIBO{2-6};
400   let BI{0-1} = BIBO{0-1};
401   let BI{2-4} = CR;
402   let BH = 0;
403 }
404
405
406 class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,  bits<5> bi, bit lk,
407                   dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
408   : XLForm_2<opcode, xo, lk, OL, asmstr, itin, pattern> {
409   let BO = bo;
410   let BI = bi;
411   let BH = 0;
412 }
413
414 class XLForm_3<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
415                InstrItinClass itin>
416          : I<opcode, OL, asmstr, itin> {
417   bits<3> BF;
418   bits<3> BFA;
419   
420   let Inst{6-8}   = BF;
421   let Inst{9-10}  = 0;
422   let Inst{11-13} = BFA;
423   let Inst{14-15} = 0;
424   let Inst{16-20} = 0;
425   let Inst{21-30} = xo;
426   let Inst{31}    = 0;
427 }
428
429 // 1.7.8 XFX-Form
430 class XFXForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
431                 InstrItinClass itin>
432          : I<opcode, OL, asmstr, itin> {
433   bits<5>  RT;
434   bits<10> SPR;
435
436   let Inst{6-10}  = RT;
437   let Inst{11}    = SPR{4};
438   let Inst{12}    = SPR{3};
439   let Inst{13}    = SPR{2};
440   let Inst{14}    = SPR{1};
441   let Inst{15}    = SPR{0};
442   let Inst{16}    = SPR{9};
443   let Inst{17}    = SPR{8};
444   let Inst{18}    = SPR{7};
445   let Inst{19}    = SPR{6};
446   let Inst{20}    = SPR{5};
447   let Inst{21-30} = xo;
448   let Inst{31}    = 0;
449 }
450
451 class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, 
452                    dag OL, string asmstr, InstrItinClass itin> 
453   : XFXForm_1<opcode, xo, OL, asmstr, itin> {
454   let SPR = spr;
455 }
456
457 class XFXForm_3<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
458                 InstrItinClass itin>
459          : I<opcode, OL, asmstr, itin> {
460   bits<5>  RT;
461    
462   let Inst{6-10}  = RT;
463   let Inst{11-20} = 0;
464   let Inst{21-30} = xo;
465   let Inst{31}    = 0;
466 }
467
468 class XFXForm_5<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
469                 InstrItinClass itin> 
470   : I<opcode, OL, asmstr, itin> {
471   bits<8>  FXM;
472   bits<5>  ST;
473    
474   let Inst{6-10}  = ST;
475   let Inst{11}    = 0;
476   let Inst{12-19} = FXM;
477   let Inst{20}    = 0;
478   let Inst{21-30} = xo;
479   let Inst{31}    = 0;
480 }
481
482 class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
483                  InstrItinClass itin> 
484   : I<opcode, OL, asmstr, itin> {
485   bits<5>  ST;
486   bits<8>  FXM;
487    
488   let Inst{6-10}  = ST;
489   let Inst{11}    = 1;
490   let Inst{12-19} = FXM;
491   let Inst{20}    = 0;
492   let Inst{21-30} = xo;
493   let Inst{31}    = 0;
494 }
495
496 class XFXForm_7<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
497                 InstrItinClass itin>
498   : XFXForm_1<opcode, xo, OL, asmstr, itin>;
499
500 class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr, 
501                     dag OL, string asmstr, InstrItinClass itin> 
502   : XFXForm_7<opcode, xo, OL, asmstr, itin> {
503   let SPR = spr;
504 }
505
506 // 1.7.10 XS-Form
507 class XSForm_1<bits<6> opcode, bits<9> xo, dag OL, string asmstr,
508                InstrItinClass itin, list<dag> pattern>
509          : I<opcode, OL, asmstr, itin> {
510   bits<5> RS;
511   bits<5> A;
512   bits<6> SH;
513
514   bit RC = 0;    // set by isDOT
515   let Pattern = pattern;
516
517   let Inst{6-10}  = RS;
518   let Inst{11-15} = A;
519   let Inst{16-20} = SH{1-5};
520   let Inst{21-29} = xo;
521   let Inst{30}    = SH{0};
522   let Inst{31}    = RC;
523 }
524
525 // 1.7.11 XO-Form
526 class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OL, string asmstr,
527                InstrItinClass itin, list<dag> pattern>
528          : I<opcode, OL, asmstr, itin> {
529   bits<5> RT;
530   bits<5> RA;
531   bits<5> RB;
532
533   let Pattern = pattern;
534
535   bit RC = 0;    // set by isDOT
536
537   let Inst{6-10}  = RT;
538   let Inst{11-15} = RA;
539   let Inst{16-20} = RB;
540   let Inst{21}    = oe;
541   let Inst{22-30} = xo;
542   let Inst{31}    = RC;  
543 }
544
545 class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, 
546                dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
547   : XOForm_1<opcode, xo, oe, OL, asmstr, itin, pattern> {
548   let RB = 0;
549 }
550
551 // 1.7.12 A-Form
552 class AForm_1<bits<6> opcode, bits<5> xo, dag OL, string asmstr, 
553               InstrItinClass itin, list<dag> pattern>
554          : I<opcode, OL, asmstr, itin> {
555   bits<5> FRT;
556   bits<5> FRA;
557   bits<5> FRC;
558   bits<5> FRB;
559
560   let Pattern = pattern;
561
562   bit RC = 0;    // set by isDOT
563
564   let Inst{6-10}  = FRT;
565   let Inst{11-15} = FRA;
566   let Inst{16-20} = FRB;
567   let Inst{21-25} = FRC;
568   let Inst{26-30} = xo;
569   let Inst{31}    = RC;
570 }
571
572 class AForm_2<bits<6> opcode, bits<5> xo, dag OL, string asmstr,
573               InstrItinClass itin, list<dag> pattern>
574   : AForm_1<opcode, xo, OL, asmstr, itin, pattern> {
575   let FRC = 0;
576 }
577
578 class AForm_3<bits<6> opcode, bits<5> xo, dag OL, string asmstr,
579               InstrItinClass itin, list<dag> pattern> 
580   : AForm_1<opcode, xo, OL, asmstr, itin, pattern> {
581   let FRB = 0;
582 }
583
584 // 1.7.13 M-Form
585 class MForm_1<bits<6> opcode, dag OL, string asmstr,
586               InstrItinClass itin, list<dag> pattern>
587     : I<opcode, OL, asmstr, itin> {
588   bits<5> RA;
589   bits<5> RS;
590   bits<5> RB;
591   bits<5> MB;
592   bits<5> ME;
593
594   let Pattern = pattern;
595
596   bit RC = 0;    // set by isDOT
597
598   let Inst{6-10}  = RS;
599   let Inst{11-15} = RA;
600   let Inst{16-20} = RB;
601   let Inst{21-25} = MB;
602   let Inst{26-30} = ME;
603   let Inst{31}    = RC;
604 }
605
606 class MForm_2<bits<6> opcode, dag OL, string asmstr,
607               InstrItinClass itin, list<dag> pattern>
608   : MForm_1<opcode, OL, asmstr, itin, pattern> {
609 }
610
611 // 1.7.14 MD-Form
612 class MDForm_1<bits<6> opcode, bits<3> xo, dag OL, string asmstr,
613                InstrItinClass itin, list<dag> pattern>
614     : I<opcode, OL, asmstr, itin> {
615   bits<5> RA;
616   bits<5> RS;
617   bits<6> SH;
618   bits<6> MBE;
619
620   let Pattern = pattern;
621
622   bit RC = 0;    // set by isDOT
623
624   let Inst{6-10}  = RS;
625   let Inst{11-15} = RA;
626   let Inst{16-20} = { SH{4}, SH{3}, SH{2}, SH{1}, SH{0} };
627   let Inst{21-26} = { MBE{4}, MBE{3}, MBE{2}, MBE{1}, MBE{0}, MBE{5} };
628   let Inst{27-29} = xo;
629   let Inst{30}    = SH{5};
630   let Inst{31}    = RC;
631 }
632
633
634
635 // E-1 VA-Form
636
637 // VAForm_1 - DACB ordering.
638 class VAForm_1<bits<6> xo, dag OL, string asmstr,
639                InstrItinClass itin, list<dag> pattern>
640     : I<4, OL, asmstr, itin> {
641   bits<5> VD;
642   bits<5> VA;
643   bits<5> VC;
644   bits<5> VB;
645
646   let Pattern = pattern;
647   
648   let Inst{6-10}  = VD;
649   let Inst{11-15} = VA;
650   let Inst{16-20} = VB;
651   let Inst{21-25} = VC;
652   let Inst{26-31} = xo;
653 }
654
655 // VAForm_1a - DABC ordering.
656 class VAForm_1a<bits<6> xo, dag OL, string asmstr,
657                 InstrItinClass itin, list<dag> pattern>
658     : I<4, OL, asmstr, itin> {
659   bits<5> VD;
660   bits<5> VA;
661   bits<5> VB;
662   bits<5> VC;
663
664   let Pattern = pattern;
665   
666   let Inst{6-10}  = VD;
667   let Inst{11-15} = VA;
668   let Inst{16-20} = VB;
669   let Inst{21-25} = VC;
670   let Inst{26-31} = xo;
671 }
672
673 class VAForm_2<bits<6> xo, dag OL, string asmstr,
674                InstrItinClass itin, list<dag> pattern>
675     : I<4, OL, asmstr, itin> {
676   bits<5> VD;
677   bits<5> VA;
678   bits<5> VB;
679   bits<4> SH;
680
681   let Pattern = pattern;
682   
683   let Inst{6-10}  = VD;
684   let Inst{11-15} = VA;
685   let Inst{16-20} = VB;
686   let Inst{21}    = 0;
687   let Inst{22-25} = SH;
688   let Inst{26-31} = xo;
689 }
690
691 // E-2 VX-Form
692 class VXForm_1<bits<11> xo, dag OL, string asmstr,
693                InstrItinClass itin, list<dag> pattern>
694     : I<4, OL, asmstr, itin> {
695   bits<5> VD;
696   bits<5> VA;
697   bits<5> VB;
698   
699   let Pattern = pattern;
700   
701   let Inst{6-10}  = VD;
702   let Inst{11-15} = VA;
703   let Inst{16-20} = VB;
704   let Inst{21-31} = xo;
705 }
706
707 class VXForm_setzero<bits<11> xo, dag OL, string asmstr,
708                InstrItinClass itin, list<dag> pattern>
709     : VXForm_1<xo, OL, asmstr, itin, pattern> {
710   let VA = VD;
711   let VB = VD;
712 }
713
714
715 class VXForm_2<bits<11> xo, dag OL, string asmstr,
716                InstrItinClass itin, list<dag> pattern>
717     : I<4, OL, asmstr, itin> {
718   bits<5> VD;
719   bits<5> VB;
720   
721   let Pattern = pattern;
722   
723   let Inst{6-10}  = VD;
724   let Inst{11-15} = 0;
725   let Inst{16-20} = VB;
726   let Inst{21-31} = xo;
727 }
728
729 class VXForm_3<bits<11> xo, dag OL, string asmstr,
730                InstrItinClass itin, list<dag> pattern>
731     : I<4, OL, asmstr, itin> {
732   bits<5> VD;
733   bits<5> IMM;
734   
735   let Pattern = pattern;
736   
737   let Inst{6-10}  = VD;
738   let Inst{11-15} = IMM;
739   let Inst{16-20} = 0;
740   let Inst{21-31} = xo;
741 }
742
743 /// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
744 class VXForm_4<bits<11> xo, dag OL, string asmstr,
745                InstrItinClass itin, list<dag> pattern>
746     : I<4, OL, asmstr, itin> {
747   bits<5> VD;
748   
749   let Pattern = pattern;
750   
751   let Inst{6-10}  = VD;
752   let Inst{11-15} = 0;
753   let Inst{16-20} = 0;
754   let Inst{21-31} = xo;
755 }
756
757 /// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
758 class VXForm_5<bits<11> xo, dag OL, string asmstr,
759                InstrItinClass itin, list<dag> pattern>
760     : I<4, OL, asmstr, itin> {
761   bits<5> VB;
762   
763   let Pattern = pattern;
764   
765   let Inst{6-10}  = 0;
766   let Inst{11-15} = 0;
767   let Inst{16-20} = VB;
768   let Inst{21-31} = xo;
769 }
770
771 // E-4 VXR-Form
772 class VXRForm_1<bits<10> xo, dag OL, string asmstr,
773                InstrItinClass itin, list<dag> pattern>
774     : I<4, OL, asmstr, itin> {
775   bits<5> VD;
776   bits<5> VA;
777   bits<5> VB;
778   bit RC = 0;
779   
780   let Pattern = pattern;
781   
782   let Inst{6-10}  = VD;
783   let Inst{11-15} = VA;
784   let Inst{16-20} = VB;
785   let Inst{21}    = RC;
786   let Inst{22-31} = xo;
787 }
788
789 //===----------------------------------------------------------------------===//
790 class Pseudo<dag OL, string asmstr, list<dag> pattern>
791     : I<0, OL, asmstr, NoItinerary> {
792   let PPC64 = 0;
793   let Pattern = pattern;
794   let Inst{31-0} = 0;
795 }