blob: 6eb59e0eeca05934d4c323f41ba386484f5d22a5 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13//3.3:
14//Memory
15//Branch
16//Operate
17//Floating-point
18//PALcode
19
20def u8imm : Operand<i64>;
21def s14imm : Operand<i64>;
22def s16imm : Operand<i64>;
23def s21imm : Operand<i64>;
24def s64imm : Operand<i64>;
25def u64imm : Operand<i64>;
26
27//===----------------------------------------------------------------------===//
28// Instruction format superclass
29//===----------------------------------------------------------------------===//
30// Alpha instruction baseline
31class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
32 field bits<32> Inst;
33 let Namespace = "Alpha";
34 let AsmString = asmstr;
35 let Inst{31-26} = op;
36 let Itinerary = itin;
37}
38
39
40//3.3.1
Chris Lattneref8d6082008-01-06 06:44:58 +000041class MForm<bits<6> opcode, bit load, string asmstr, list<dag> pattern, InstrItinClass itin>
Dan Gohmanf17a25c2007-07-18 16:29:46 +000042 : InstAlpha<opcode, asmstr, itin> {
43 let Pattern = pattern;
Chris Lattner1a1932c2008-01-06 23:38:27 +000044 let isSimpleLoad = load;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000045 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}
55class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
56 : InstAlpha<opcode, asmstr, itin> {
57 bits<5> Ra;
58
Evan Chengb783fa32007-07-19 01:14:50 +000059 let OutOperandList = (ops GPRC:$RA);
60 let InOperandList = (ops);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000061 let Inst{25-21} = Ra;
62 let Inst{20-16} = 0;
63 let Inst{15-0} = fc;
64}
Andrew Lenharth785610d2008-02-16 01:24:58 +000065class MfcPForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
66 : InstAlpha<opcode, asmstr, itin> {
67 let OutOperandList = (ops);
68 let InOperandList = (ops);
69 let Inst{25-21} = 0;
70 let Inst{20-16} = 0;
71 let Inst{15-0} = fc;
72}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000073
74class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
75 : InstAlpha<opcode, asmstr, itin> {
76 bits<5> Ra;
77 bits<5> Rb;
78 bits<14> disp;
79
Evan Chengb783fa32007-07-19 01:14:50 +000080 let OutOperandList = (ops);
81 let InOperandList = OL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000082
83 let Inst{25-21} = Ra;
84 let Inst{20-16} = Rb;
85 let Inst{15-14} = TB;
86 let Inst{13-0} = disp;
87}
88class MbrpForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, list<dag> pattern, InstrItinClass itin>
89 : InstAlpha<opcode, asmstr, itin> {
90 let Pattern=pattern;
91 bits<5> Ra;
92 bits<5> Rb;
93 bits<14> disp;
94
Evan Chengb783fa32007-07-19 01:14:50 +000095 let OutOperandList = (ops);
96 let InOperandList = OL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000097
98 let Inst{25-21} = Ra;
99 let Inst{20-16} = Rb;
100 let Inst{15-14} = TB;
101 let Inst{13-0} = disp;
102}
103
104//3.3.2
105def target : Operand<OtherVT> {}
106
Evan Cheng37e7c752007-07-21 00:34:19 +0000107let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000108class BFormN<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
109 : InstAlpha<opcode, asmstr, itin> {
Evan Chengb783fa32007-07-19 01:14:50 +0000110 let OutOperandList = (ops);
111 let InOperandList = OL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000112 bits<64> Opc; //dummy
113 bits<5> Ra;
114 bits<21> disp;
115
116 let Inst{25-21} = Ra;
117 let Inst{20-0} = disp;
118}
119}
120
121let isBranch = 1, isTerminator = 1 in
122class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
123 : InstAlpha<opcode, asmstr, itin> {
124 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000125 let OutOperandList = (ops);
126 let InOperandList = (ops target:$DISP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000127 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
135class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
136 : InstAlpha<opcode, asmstr, itin> {
137 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000138 let OutOperandList = (outs GPRC:$RC);
139 let InOperandList = (ins GPRC:$RA, GPRC:$RB);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000140
141 bits<5> Rc;
142 bits<5> Ra;
143 bits<5> Rb;
144 bits<7> Function = fun;
145
146 let Inst{25-21} = Ra;
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
154class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
155 : InstAlpha<opcode, asmstr, itin> {
156 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000157 let OutOperandList = (outs GPRC:$RC);
158 let InOperandList = (ins GPRC:$RB);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000159
160 bits<5> Rc;
161 bits<5> Rb;
162 bits<7> Function = fun;
163
164 let Inst{25-21} = 31;
165 let Inst{20-16} = Rb;
166 let Inst{15-13} = 0;
167 let Inst{12} = 0;
168 let Inst{11-5} = Function;
169 let Inst{4-0} = Rc;
170}
171
172class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
173 : InstAlpha<opcode, asmstr, itin> {
174 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000175 let OutOperandList = (outs GPRC:$RDEST);
176 let InOperandList = (ins GPRC:$RCOND, GPRC:$RTRUE, GPRC:$RFALSE);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000177 let Constraints = "$RFALSE = $RDEST";
178 let DisableEncoding = "$RFALSE";
179
180 bits<5> Rc;
181 bits<5> Ra;
182 bits<5> Rb;
183 bits<7> Function = fun;
184
185// let isTwoAddress = 1;
186 let Inst{25-21} = Ra;
187 let Inst{20-16} = Rb;
188 let Inst{15-13} = 0;
189 let Inst{12} = 0;
190 let Inst{11-5} = Function;
191 let Inst{4-0} = Rc;
192}
193
194
195class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
196 : InstAlpha<opcode, asmstr, itin> {
197 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000198 let OutOperandList = (outs GPRC:$RC);
199 let InOperandList = (ins GPRC:$RA, u8imm:$L);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000200
201 bits<5> Rc;
202 bits<5> Ra;
203 bits<8> LIT;
204 bits<7> Function = fun;
205
206 let Inst{25-21} = Ra;
207 let Inst{20-13} = LIT;
208 let Inst{12} = 1;
209 let Inst{11-5} = Function;
210 let Inst{4-0} = Rc;
211}
212
213class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
214 : InstAlpha<opcode, asmstr, itin> {
215 let Pattern = pattern;
Evan Chengb783fa32007-07-19 01:14:50 +0000216 let OutOperandList = (outs GPRC:$RDEST);
217 let InOperandList = (ins GPRC:$RCOND, s64imm:$RTRUE, GPRC:$RFALSE);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000218 let Constraints = "$RFALSE = $RDEST";
219 let DisableEncoding = "$RFALSE";
220
221 bits<5> Rc;
222 bits<5> Ra;
223 bits<8> LIT;
224 bits<7> Function = fun;
225
226// let isTwoAddress = 1;
227 let Inst{25-21} = Ra;
228 let Inst{20-13} = LIT;
229 let Inst{12} = 1;
230 let Inst{11-5} = Function;
231 let Inst{4-0} = Rc;
232}
233
234//3.3.4
235class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
236 : InstAlpha<opcode, asmstr, itin> {
237 let Pattern = pattern;
238
239 bits<5> Fc;
240 bits<5> Fa;
241 bits<5> Fb;
242 bits<11> Function = fun;
243
244 let Inst{25-21} = Fa;
245 let Inst{20-16} = Fb;
246 let Inst{15-5} = Function;
247 let Inst{4-0} = Fc;
248}
249
250//3.3.5
251class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
252 : InstAlpha<opcode, asmstr, itin> {
Evan Chengb783fa32007-07-19 01:14:50 +0000253 let OutOperandList = (ops);
254 let InOperandList = OL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000255 bits<26> Function;
256
257 let Inst{25-0} = Function;
258}
259
260
261// Pseudo instructions.
Evan Chengb783fa32007-07-19 01:14:50 +0000262class PseudoInstAlpha<dag OOL, dag IOL, string nm, list<dag> pattern, InstrItinClass itin>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000263 : InstAlpha<0, nm, itin> {
Evan Chengb783fa32007-07-19 01:14:50 +0000264 let OutOperandList = OOL;
265 let InOperandList = IOL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000266 let Pattern = pattern;
267
268}