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