add a note
[oota-llvm.git] / lib / Target / Alpha / AlphaInstrFormats.td
1 //===- AlphaInstrFormats.td - Alpha 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
13 //3.3:
14 //Memory
15 //Branch
16 //Operate
17 //Floating-point
18 //PALcode
19
20 def u8imm   : Operand<i64>;
21 def s14imm  : Operand<i64>;
22 def s16imm  : Operand<i64>;
23 def s21imm  : Operand<i64>;
24 def s64imm  : Operand<i64>;
25
26 //===----------------------------------------------------------------------===//
27 // Instruction format superclass
28 //===----------------------------------------------------------------------===//
29 // Alpha instruction baseline
30 class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
31   field bits<32> Inst;
32   let Namespace = "Alpha";
33   let AsmString = asmstr;
34   let Inst{31-26} = op;
35   let Itinerary = itin;
36 }
37
38
39 //3.3.1
40 class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern, InstrItinClass itin> 
41         : InstAlpha<opcode, asmstr, itin> {
42   let Pattern = pattern;
43   let isStore = store;
44   let isLoad = load;
45   let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
46
47   bits<5> Ra;
48   bits<16> disp;
49   bits<5> Rb;
50
51   let Inst{25-21} = Ra;
52   let Inst{20-16} = Rb;
53   let Inst{15-0} = disp;
54 }
55 class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin> 
56         : InstAlpha<opcode, asmstr, itin> {    
57   bits<5> Ra;
58
59   let OperandList = (ops GPRC:$RA);
60   let Inst{25-21} = Ra;
61   let Inst{20-16} = 0;
62   let Inst{15-0} = fc;
63 }
64
65 class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
66     : InstAlpha<opcode, asmstr, itin> {
67   bits<5> Ra;
68   bits<5> Rb;
69   bits<14> disp;
70
71   let OperandList = OL;
72
73   let Inst{25-21} = Ra;
74   let Inst{20-16} = Rb;
75   let Inst{15-14} = TB;
76   let Inst{13-0} = disp;
77 }
78
79 //3.3.2
80 def target : Operand<OtherVT> {}
81 let isBranch = 1, isTerminator = 1 in
82 class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> 
83     : InstAlpha<opcode, asmstr, itin> {
84   let Pattern = pattern;
85   let OperandList = (ops target:$DISP);
86   bits<5> Ra;
87   bits<21> disp;
88
89   let Inst{25-21} = Ra;
90   let Inst{20-0} = disp;
91 }
92 let isBranch = 1, isTerminator = 1 in
93 class BForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> 
94     : InstAlpha<opcode, asmstr, itin> {
95   let Pattern = pattern;
96   let OperandList = (ops GPRC:$RA, target:$DISP);
97
98   bits<5> Ra;
99   bits<21> disp;
100
101   let Inst{25-21} = Ra;
102   let Inst{20-0} = disp;
103 }
104
105 let isBranch = 1, isTerminator = 1 in
106 class FBForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> 
107     : InstAlpha<opcode, asmstr, itin> {
108   let Pattern = pattern;
109   let OperandList = (ops F8RC:$RA, target:$DISP);
110
111   bits<5> Ra;
112   bits<21> disp;
113
114   let Inst{25-21} = Ra;
115   let Inst{20-0} = disp;
116 }
117
118 //3.3.3
119 class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
120     : InstAlpha<opcode, asmstr, itin> {
121   let Pattern = pattern;
122   let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB);
123
124   bits<5> Rc;
125   bits<5> Ra;
126   bits<5> Rb;
127   bits<7> Function = fun;
128
129   let Inst{25-21} = Ra;
130   let Inst{20-16} = Rb;
131   let Inst{15-13} = 0;
132   let Inst{12} = 0;
133   let Inst{11-5} = Function;
134   let Inst{4-0} = Rc;
135 }
136
137 class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
138     : InstAlpha<opcode, asmstr, itin> {
139   let Pattern = pattern;
140   let OperandList = (ops GPRC:$RC, GPRC:$RB);
141
142   bits<5> Rc;
143   bits<5> Rb;
144   bits<7> Function = fun;
145
146   let Inst{25-21} = 31;
147   let Inst{20-16} = Rb;
148   let Inst{15-13} = 0;
149   let Inst{12} = 0;
150   let Inst{11-5} = Function;
151   let Inst{4-0} = Rc;
152 }
153
154 class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
155     : InstAlpha<opcode, asmstr, itin> {
156   let Pattern = pattern;
157   let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, GPRC:$RTRUE, GPRC:$RCOND);
158
159   bits<5> Rc;
160   bits<5> Rb;
161   bits<5> Ra;
162   bits<7> Function = fun;
163
164   let isTwoAddress = 1;
165   let Inst{25-21} = Ra;
166   let Inst{20-16} = Rb;
167   let Inst{15-13} = 0;
168   let Inst{12} = 0;
169   let Inst{11-5} = Function;
170   let Inst{4-0} = Rc;
171 }
172
173
174 class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
175     : InstAlpha<opcode, asmstr, itin> {
176   let Pattern = pattern;
177   let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L);
178
179   bits<5> Rc;
180   bits<5> Ra;
181   bits<8> LIT;
182   bits<7> Function = fun;
183
184   let Inst{25-21} = Ra;
185   let Inst{20-13} = LIT;
186   let Inst{12} = 1;
187   let Inst{11-5} = Function;
188   let Inst{4-0} = Rc;
189 }
190
191 class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
192     : InstAlpha<opcode, asmstr, itin> {
193   let Pattern = pattern;
194   let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, s64imm:$RTRUE, GPRC:$RCOND);
195  
196   bits<5> Rc;
197   bits<8> LIT;
198   bits<5> Ra;
199   bits<7> Function = fun;
200
201   let isTwoAddress = 1;
202   let Inst{25-21} = Ra;
203   let Inst{20-13} = LIT;
204   let Inst{12} = 1;
205   let Inst{11-5} = Function;
206   let Inst{4-0} = Rc;
207 }
208
209 //3.3.4
210 class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
211     : InstAlpha<opcode, asmstr, itin> {
212   let Pattern = pattern;
213
214   bits<5> Fc;
215   bits<5> Fa;
216   bits<5> Fb;
217   bits<11> Function = fun;
218
219   let Inst{25-21} = Fa;
220   let Inst{20-16} = Fb;
221   let Inst{15-5} = Function;
222   let Inst{4-0} = Fc;
223 }
224
225 //3.3.5
226 class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
227     : InstAlpha<opcode, asmstr, itin> {
228   let OperandList = OL;
229   bits<26> Function;
230
231   let Inst{25-0} = Function;
232 }
233
234
235 // Pseudo instructions.
236 class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin> 
237     : InstAlpha<0, nm, itin>  {
238   let OperandList = OL;
239   let Pattern = pattern;
240
241 }