fix encoding of BLR
[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 class DForm_8<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
178               list<dag> pattern>
179   : DForm_1<opcode, OL, asmstr, itin, pattern> {
180 }
181
182 class DForm_9<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin,
183               list<dag> pattern>
184   : DForm_1<opcode, OL, asmstr, itin, pattern> {
185 }
186
187 // 1.7.5 DS-Form
188 class DSForm_1<bits<6> opcode, bits<2> xo, dag OL, string asmstr,
189                InstrItinClass itin, list<dag> pattern>
190          : I<opcode, OL, asmstr, itin> {
191   bits<5>  RST;
192   bits<14> DS;
193   bits<5>  RA;
194
195   let Pattern = pattern;
196   
197   let Inst{6-10}  = RST;
198   let Inst{11-15} = RA;
199   let Inst{16-29} = DS;
200   let Inst{30-31} = xo;
201 }
202
203 class DSForm_2<bits<6> opcode, bits<2> xo, dag OL, string asmstr,
204                InstrItinClass itin, list<dag> pattern>
205   : DSForm_1<opcode, xo, OL, asmstr, itin, pattern>;
206
207 // 1.7.6 X-Form
208 class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OL, string asmstr, 
209                       InstrItinClass itin, list<dag> pattern>
210   : I<opcode, OL, asmstr, itin> {
211   bits<5> RST;
212   bits<5> A;
213   bits<5> B;
214
215   let Pattern = pattern;
216
217   bit RC = 0;    // set by isDOT
218
219   let Inst{6-10}  = RST;
220   let Inst{11-15} = A;
221   let Inst{16-20} = B;
222   let Inst{21-30} = xo;
223   let Inst{31}    = RC;
224 }
225
226 // This is the same as XForm_base_r3xo, but the first two operands are swapped
227 // when code is emitted.
228 class XForm_base_r3xo_swapped
229         <bits<6> opcode, bits<10> xo, dag OL, string asmstr,
230         InstrItinClass itin> 
231   : I<opcode, OL, asmstr, itin> {
232   bits<5> A;
233   bits<5> RST;
234   bits<5> B;
235
236   bit RC = 0;    // set by isDOT
237
238   let Inst{6-10}  = RST;
239   let Inst{11-15} = A;
240   let Inst{16-20} = B;
241   let Inst{21-30} = xo;
242   let Inst{31}    = RC;
243 }
244
245
246 class XForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
247               InstrItinClass itin, list<dag> pattern> 
248   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern>;
249
250 class XForm_6<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
251               InstrItinClass itin, list<dag> pattern> 
252   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
253   let Pattern = pattern;
254 }
255
256 class XForm_8<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
257               InstrItinClass itin, list<dag> pattern> 
258   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern>;
259
260 class XForm_10<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
261                InstrItinClass itin, list<dag> pattern> 
262   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
263     let Pattern = pattern;
264 }
265
266 class XForm_11<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
267                InstrItinClass itin, list<dag> pattern> 
268   : XForm_base_r3xo_swapped<opcode, xo, OL, asmstr, itin> {
269   let B = 0;
270   let Pattern = pattern;
271 }
272
273 class XForm_16<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
274                InstrItinClass itin>
275          : I<opcode, OL, asmstr, itin> {
276   bits<3> BF;
277   bits<1> L; 
278   bits<5> RA;
279   bits<5> RB;
280   
281   let Inst{6-8}   = BF;
282   let Inst{9}     = 0;
283   let Inst{10}    = L;
284   let Inst{11-15} = RA;
285   let Inst{16-20} = RB;
286   let Inst{21-30} = xo;
287   let Inst{31}    = 0;
288 }
289
290 class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
291                    InstrItinClass itin>
292   : XForm_16<opcode, xo, OL, asmstr, itin> {
293   let L = PPC64;
294 }
295
296 class XForm_17<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
297                InstrItinClass itin>
298          : I<opcode, OL, asmstr, itin> {
299   bits<3> BF;
300   bits<5> FRA;
301   bits<5> FRB;
302   
303   let Inst{6-8}   = BF;
304   let Inst{9-10}  = 0;
305   let Inst{11-15} = FRA;
306   let Inst{16-20} = FRB;
307   let Inst{21-30} = xo;
308   let Inst{31}    = 0;
309 }
310
311 class XForm_25<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
312                InstrItinClass itin, list<dag> pattern> 
313   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
314 }
315
316 class XForm_26<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
317                InstrItinClass itin, list<dag> pattern>
318   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
319   let A = 0;
320 }
321
322 class XForm_28<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
323                InstrItinClass itin, list<dag> pattern> 
324   : XForm_base_r3xo<opcode, xo, OL, asmstr, itin, pattern> {
325 }
326
327 // DCB_Form - Form X instruction, used for dcb* instructions.
328 class DCB_Form<bits<10> xo, bits<5> immfield, dag OL, string asmstr, 
329                       InstrItinClass itin, list<dag> pattern>
330   : I<31, OL, asmstr, itin> {
331   bits<5> A;
332   bits<5> B;
333
334   let Pattern = pattern;
335
336   let Inst{6-10}  = immfield;
337   let Inst{11-15} = A;
338   let Inst{16-20} = B;
339   let Inst{21-30} = xo;
340   let Inst{31}    = 0;
341 }
342
343
344 // DSS_Form - Form X instruction, used for altivec dss* instructions.
345 class DSS_Form<bits<10> xo, dag OL, string asmstr, 
346                       InstrItinClass itin, list<dag> pattern>
347   : I<31, OL, asmstr, itin> {
348   bits<1> T;
349   bits<2> STRM;
350   bits<5> A;
351   bits<5> B;
352
353   let Pattern = pattern;
354
355   let Inst{6}     = T;
356   let Inst{7-8}   = 0;
357   let Inst{9-10}  = STRM;
358   let Inst{11-15} = A;
359   let Inst{16-20} = B;
360   let Inst{21-30} = xo;
361   let Inst{31}    = 0;
362 }
363
364 // 1.7.7 XL-Form
365 class XLForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
366                InstrItinClass itin>
367     : I<opcode, OL, asmstr, itin> {
368   bits<3> CRD;
369   bits<2> CRDb;
370   bits<3> CRA;
371   bits<2> CRAb;
372   bits<3> CRB;
373   bits<2> CRBb;
374   
375   let Inst{6-8}   = CRD;
376   let Inst{9-10}  = CRDb;
377   let Inst{11-13} = CRA;
378   let Inst{14-15} = CRAb;
379   let Inst{16-18} = CRB;
380   let Inst{19-20} = CRBb;
381   let Inst{21-30} = xo;
382   let Inst{31}    = 0;
383 }
384
385 class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OL, string asmstr, 
386                InstrItinClass itin, list<dag> pattern>
387     : I<opcode, OL, asmstr, itin> {
388   bits<5> BO;
389   bits<5> BI;
390   bits<2> BH;
391   
392   let Pattern = pattern;
393   
394   let Inst{6-10}  = BO;
395   let Inst{11-15} = BI;
396   let Inst{16-18} = 0;
397   let Inst{19-20} = BH;
398   let Inst{21-30} = xo;
399   let Inst{31}    = lk;
400 }
401
402 class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
403                   dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
404   : XLForm_2<opcode, xo, lk, OL, asmstr, itin, pattern> {
405   bits<7> BIBO;  // 2 bits of BI and 5 bits of BO.
406   bits<3>  CR;
407   
408   let BO = BIBO{2-6};
409   let BI{0-1} = BIBO{0-1};
410   let BI{2-4} = CR;
411   let BH = 0;
412 }
413
414
415 class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,  bits<5> bi, bit lk,
416                   dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
417   : XLForm_2<opcode, xo, lk, OL, asmstr, itin, pattern> {
418   let BO = bo;
419   let BI = bi;
420   let BH = 0;
421 }
422
423 class XLForm_3<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
424                InstrItinClass itin>
425          : I<opcode, OL, asmstr, itin> {
426   bits<3> BF;
427   bits<3> BFA;
428   
429   let Inst{6-8}   = BF;
430   let Inst{9-10}  = 0;
431   let Inst{11-13} = BFA;
432   let Inst{14-15} = 0;
433   let Inst{16-20} = 0;
434   let Inst{21-30} = xo;
435   let Inst{31}    = 0;
436 }
437
438 // 1.7.8 XFX-Form
439 class XFXForm_1<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
440                 InstrItinClass itin>
441          : I<opcode, OL, asmstr, itin> {
442   bits<5>  RT;
443   bits<10> SPR;
444
445   let Inst{6-10}  = RT;
446   let Inst{11}    = SPR{4};
447   let Inst{12}    = SPR{3};
448   let Inst{13}    = SPR{2};
449   let Inst{14}    = SPR{1};
450   let Inst{15}    = SPR{0};
451   let Inst{16}    = SPR{9};
452   let Inst{17}    = SPR{8};
453   let Inst{18}    = SPR{7};
454   let Inst{19}    = SPR{6};
455   let Inst{20}    = SPR{5};
456   let Inst{21-30} = xo;
457   let Inst{31}    = 0;
458 }
459
460 class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr, 
461                    dag OL, string asmstr, InstrItinClass itin> 
462   : XFXForm_1<opcode, xo, OL, asmstr, itin> {
463   let SPR = spr;
464 }
465
466 class XFXForm_3<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
467                 InstrItinClass itin>
468          : I<opcode, OL, asmstr, itin> {
469   bits<5>  RT;
470    
471   let Inst{6-10}  = RT;
472   let Inst{11-20} = 0;
473   let Inst{21-30} = xo;
474   let Inst{31}    = 0;
475 }
476
477 class XFXForm_5<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
478                 InstrItinClass itin> 
479   : I<opcode, OL, asmstr, itin> {
480   bits<8>  FXM;
481   bits<5>  ST;
482    
483   let Inst{6-10}  = ST;
484   let Inst{11}    = 0;
485   let Inst{12-19} = FXM;
486   let Inst{20}    = 0;
487   let Inst{21-30} = xo;
488   let Inst{31}    = 0;
489 }
490
491 class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
492                  InstrItinClass itin> 
493   : I<opcode, OL, asmstr, itin> {
494   bits<5>  ST;
495   bits<8>  FXM;
496    
497   let Inst{6-10}  = ST;
498   let Inst{11}    = 1;
499   let Inst{12-19} = FXM;
500   let Inst{20}    = 0;
501   let Inst{21-30} = xo;
502   let Inst{31}    = 0;
503 }
504
505 class XFXForm_7<bits<6> opcode, bits<10> xo, dag OL, string asmstr,
506                 InstrItinClass itin>
507   : XFXForm_1<opcode, xo, OL, asmstr, itin>;
508
509 class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr, 
510                     dag OL, string asmstr, InstrItinClass itin> 
511   : XFXForm_7<opcode, xo, OL, asmstr, itin> {
512   let SPR = spr;
513 }
514
515 // 1.7.10 XS-Form
516 class XSForm_1<bits<6> opcode, bits<9> xo, dag OL, string asmstr,
517                InstrItinClass itin, list<dag> pattern>
518          : I<opcode, OL, asmstr, itin> {
519   bits<5> RS;
520   bits<5> A;
521   bits<6> SH;
522
523   bit RC = 0;    // set by isDOT
524   let Pattern = pattern;
525
526   let Inst{6-10}  = RS;
527   let Inst{11-15} = A;
528   let Inst{16-20} = SH{1-5};
529   let Inst{21-29} = xo;
530   let Inst{30}    = SH{0};
531   let Inst{31}    = RC;
532 }
533
534 // 1.7.11 XO-Form
535 class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OL, string asmstr,
536                InstrItinClass itin, list<dag> pattern>
537          : I<opcode, OL, asmstr, itin> {
538   bits<5> RT;
539   bits<5> RA;
540   bits<5> RB;
541
542   let Pattern = pattern;
543
544   bit RC = 0;    // set by isDOT
545
546   let Inst{6-10}  = RT;
547   let Inst{11-15} = RA;
548   let Inst{16-20} = RB;
549   let Inst{21}    = oe;
550   let Inst{22-30} = xo;
551   let Inst{31}    = RC;  
552 }
553
554 class XOForm_3<bits<6> opcode, bits<9> xo, bit oe, 
555                dag OL, string asmstr, InstrItinClass itin, list<dag> pattern>
556   : XOForm_1<opcode, xo, oe, OL, asmstr, itin, pattern> {
557   let RB = 0;
558 }
559
560 // 1.7.12 A-Form
561 class AForm_1<bits<6> opcode, bits<5> xo, dag OL, string asmstr, 
562               InstrItinClass itin, list<dag> pattern>
563          : I<opcode, OL, asmstr, itin> {
564   bits<5> FRT;
565   bits<5> FRA;
566   bits<5> FRC;
567   bits<5> FRB;
568
569   let Pattern = pattern;
570
571   bit RC = 0;    // set by isDOT
572
573   let Inst{6-10}  = FRT;
574   let Inst{11-15} = FRA;
575   let Inst{16-20} = FRB;
576   let Inst{21-25} = FRC;
577   let Inst{26-30} = xo;
578   let Inst{31}    = RC;
579 }
580
581 class AForm_2<bits<6> opcode, bits<5> xo, dag OL, string asmstr,
582               InstrItinClass itin, list<dag> pattern>
583   : AForm_1<opcode, xo, OL, asmstr, itin, pattern> {
584   let FRC = 0;
585 }
586
587 class AForm_3<bits<6> opcode, bits<5> xo, dag OL, string asmstr,
588               InstrItinClass itin, list<dag> pattern> 
589   : AForm_1<opcode, xo, OL, asmstr, itin, pattern> {
590   let FRB = 0;
591 }
592
593 // 1.7.13 M-Form
594 class MForm_1<bits<6> opcode, dag OL, string asmstr,
595               InstrItinClass itin, list<dag> pattern>
596     : I<opcode, OL, asmstr, itin> {
597   bits<5> RA;
598   bits<5> RS;
599   bits<5> RB;
600   bits<5> MB;
601   bits<5> ME;
602
603   let Pattern = pattern;
604
605   bit RC = 0;    // set by isDOT
606
607   let Inst{6-10}  = RS;
608   let Inst{11-15} = RA;
609   let Inst{16-20} = RB;
610   let Inst{21-25} = MB;
611   let Inst{26-30} = ME;
612   let Inst{31}    = RC;
613 }
614
615 class MForm_2<bits<6> opcode, dag OL, string asmstr,
616               InstrItinClass itin, list<dag> pattern>
617   : MForm_1<opcode, OL, asmstr, itin, pattern> {
618 }
619
620 // 1.7.14 MD-Form
621 class MDForm_1<bits<6> opcode, bits<3> xo, dag OL, string asmstr,
622                InstrItinClass itin, list<dag> pattern>
623     : I<opcode, OL, asmstr, itin> {
624   bits<5> RA;
625   bits<5> RS;
626   bits<6> SH;
627   bits<6> MBE;
628
629   let Pattern = pattern;
630
631   bit RC = 0;    // set by isDOT
632
633   let Inst{6-10}  = RS;
634   let Inst{11-15} = RA;
635   let Inst{16-20} = { SH{4}, SH{3}, SH{2}, SH{1}, SH{0} };
636   let Inst{21-26} = { MBE{4}, MBE{3}, MBE{2}, MBE{1}, MBE{0}, MBE{5} };
637   let Inst{27-29} = xo;
638   let Inst{30}    = SH{5};
639   let Inst{31}    = RC;
640 }
641
642
643
644 // E-1 VA-Form
645
646 // VAForm_1 - DACB ordering.
647 class VAForm_1<bits<6> xo, dag OL, string asmstr,
648                InstrItinClass itin, list<dag> pattern>
649     : I<4, OL, asmstr, itin> {
650   bits<5> VD;
651   bits<5> VA;
652   bits<5> VC;
653   bits<5> VB;
654
655   let Pattern = pattern;
656   
657   let Inst{6-10}  = VD;
658   let Inst{11-15} = VA;
659   let Inst{16-20} = VB;
660   let Inst{21-25} = VC;
661   let Inst{26-31} = xo;
662 }
663
664 // VAForm_1a - DABC ordering.
665 class VAForm_1a<bits<6> xo, dag OL, string asmstr,
666                 InstrItinClass itin, list<dag> pattern>
667     : I<4, OL, asmstr, itin> {
668   bits<5> VD;
669   bits<5> VA;
670   bits<5> VB;
671   bits<5> VC;
672
673   let Pattern = pattern;
674   
675   let Inst{6-10}  = VD;
676   let Inst{11-15} = VA;
677   let Inst{16-20} = VB;
678   let Inst{21-25} = VC;
679   let Inst{26-31} = xo;
680 }
681
682 class VAForm_2<bits<6> xo, dag OL, string asmstr,
683                InstrItinClass itin, list<dag> pattern>
684     : I<4, OL, asmstr, itin> {
685   bits<5> VD;
686   bits<5> VA;
687   bits<5> VB;
688   bits<4> SH;
689
690   let Pattern = pattern;
691   
692   let Inst{6-10}  = VD;
693   let Inst{11-15} = VA;
694   let Inst{16-20} = VB;
695   let Inst{21}    = 0;
696   let Inst{22-25} = SH;
697   let Inst{26-31} = xo;
698 }
699
700 // E-2 VX-Form
701 class VXForm_1<bits<11> xo, dag OL, string asmstr,
702                InstrItinClass itin, list<dag> pattern>
703     : I<4, OL, asmstr, itin> {
704   bits<5> VD;
705   bits<5> VA;
706   bits<5> VB;
707   
708   let Pattern = pattern;
709   
710   let Inst{6-10}  = VD;
711   let Inst{11-15} = VA;
712   let Inst{16-20} = VB;
713   let Inst{21-31} = xo;
714 }
715
716 class VXForm_setzero<bits<11> xo, dag OL, string asmstr,
717                InstrItinClass itin, list<dag> pattern>
718     : VXForm_1<xo, OL, asmstr, itin, pattern> {
719   let VA = VD;
720   let VB = VD;
721 }
722
723
724 class VXForm_2<bits<11> xo, dag OL, string asmstr,
725                InstrItinClass itin, list<dag> pattern>
726     : I<4, OL, asmstr, itin> {
727   bits<5> VD;
728   bits<5> VB;
729   
730   let Pattern = pattern;
731   
732   let Inst{6-10}  = VD;
733   let Inst{11-15} = 0;
734   let Inst{16-20} = VB;
735   let Inst{21-31} = xo;
736 }
737
738 class VXForm_3<bits<11> xo, dag OL, string asmstr,
739                InstrItinClass itin, list<dag> pattern>
740     : I<4, OL, asmstr, itin> {
741   bits<5> VD;
742   bits<5> IMM;
743   
744   let Pattern = pattern;
745   
746   let Inst{6-10}  = VD;
747   let Inst{11-15} = IMM;
748   let Inst{16-20} = 0;
749   let Inst{21-31} = xo;
750 }
751
752 /// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
753 class VXForm_4<bits<11> xo, dag OL, string asmstr,
754                InstrItinClass itin, list<dag> pattern>
755     : I<4, OL, asmstr, itin> {
756   bits<5> VD;
757   
758   let Pattern = pattern;
759   
760   let Inst{6-10}  = VD;
761   let Inst{11-15} = 0;
762   let Inst{16-20} = 0;
763   let Inst{21-31} = xo;
764 }
765
766 /// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
767 class VXForm_5<bits<11> xo, dag OL, string asmstr,
768                InstrItinClass itin, list<dag> pattern>
769     : I<4, OL, asmstr, itin> {
770   bits<5> VB;
771   
772   let Pattern = pattern;
773   
774   let Inst{6-10}  = 0;
775   let Inst{11-15} = 0;
776   let Inst{16-20} = VB;
777   let Inst{21-31} = xo;
778 }
779
780 // E-4 VXR-Form
781 class VXRForm_1<bits<10> xo, dag OL, string asmstr,
782                InstrItinClass itin, list<dag> pattern>
783     : I<4, OL, asmstr, itin> {
784   bits<5> VD;
785   bits<5> VA;
786   bits<5> VB;
787   bit RC = 0;
788   
789   let Pattern = pattern;
790   
791   let Inst{6-10}  = VD;
792   let Inst{11-15} = VA;
793   let Inst{16-20} = VB;
794   let Inst{21}    = RC;
795   let Inst{22-31} = xo;
796 }
797
798 //===----------------------------------------------------------------------===//
799 class Pseudo<dag OL, string asmstr, list<dag> pattern>
800     : I<0, OL, asmstr, NoItinerary> {
801   let PPC64 = 0;
802   let Pattern = pattern;
803   let Inst{31-0} = 0;
804 }