blob: 6eb59e0eeca05934d4c323f41ba386484f5d22a5 [file] [log] [blame]
Misha Brukman2a8350a2005-02-05 02:24:26 +00001//===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Andrew Lenharth304d0f32005-01-22 23:41:55 +00007//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13//3.3:
14//Memory
15//Branch
16//Operate
17//Floating-point
18//PALcode
19
Andrew Lenharth4907d222005-10-20 00:28:31 +000020def u8imm : Operand<i64>;
21def s14imm : Operand<i64>;
22def s16imm : Operand<i64>;
23def s21imm : Operand<i64>;
Andrew Lenharthf3f951a2005-07-22 20:50:29 +000024def s64imm : Operand<i64>;
Andrew Lenharthf81173f2006-10-31 16:49:55 +000025def u64imm : Operand<i64>;
Andrew Lenharthf3f951a2005-07-22 20:50:29 +000026
Andrew Lenharth304d0f32005-01-22 23:41:55 +000027//===----------------------------------------------------------------------===//
28// Instruction format superclass
29//===----------------------------------------------------------------------===//
Andrew Lenharth5cefc5e2005-11-09 19:17:08 +000030// Alpha instruction baseline
Andrew Lenharth017c5562006-03-09 17:16:45 +000031class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
Andrew Lenharth304d0f32005-01-22 23:41:55 +000032 field bits<32> Inst;
Andrew Lenharth304d0f32005-01-22 23:41:55 +000033 let Namespace = "Alpha";
Andrew Lenharth304d0f32005-01-22 23:41:55 +000034 let AsmString = asmstr;
Andrew Lenharth304d0f32005-01-22 23:41:55 +000035 let Inst{31-26} = op;
Andrew Lenharth017c5562006-03-09 17:16:45 +000036 let Itinerary = itin;
Andrew Lenharth304d0f32005-01-22 23:41:55 +000037}
38
Andrew Lenharth5cefc5e2005-11-09 19:17:08 +000039
Andrew Lenharth304d0f32005-01-22 23:41:55 +000040//3.3.1
Chris Lattnerc8478d82008-01-06 06:44:58 +000041class MForm<bits<6> opcode, bit load, string asmstr, list<dag> pattern, InstrItinClass itin>
Andrew Lenharth017c5562006-03-09 17:16:45 +000042 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth9fa4d4c2005-12-24 03:41:56 +000043 let Pattern = pattern;
Chris Lattner834f1ce2008-01-06 23:38:27 +000044 let isSimpleLoad = load;
Andrew Lenharthcd1544e2006-01-26 03:22:07 +000045 let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
Andrew Lenharth9fa4d4c2005-12-24 03:41:56 +000046
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}
Andrew Lenharth017c5562006-03-09 17:16:45 +000055class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
56 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth51b8d542005-11-11 16:47:30 +000057 bits<5> Ra;
Andrew Lenharth51b8d542005-11-11 16:47:30 +000058
Evan Cheng64d80e32007-07-19 01:14:50 +000059 let OutOperandList = (ops GPRC:$RA);
60 let InOperandList = (ops);
Andrew Lenharth51b8d542005-11-11 16:47:30 +000061 let Inst{25-21} = Ra;
Andrew Lenharth739027e2006-01-16 21:22:38 +000062 let Inst{20-16} = 0;
Andrew Lenharth51b8d542005-11-11 16:47:30 +000063 let Inst{15-0} = fc;
64}
Andrew Lenharth22c5c1b2008-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}
Andrew Lenharth304d0f32005-01-22 23:41:55 +000073
Andrew Lenharth017c5562006-03-09 17:16:45 +000074class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
75 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthf3f951a2005-07-22 20:50:29 +000076 bits<5> Ra;
77 bits<5> Rb;
78 bits<14> disp;
79
Evan Cheng64d80e32007-07-19 01:14:50 +000080 let OutOperandList = (ops);
81 let InOperandList = OL;
Andrew Lenharth017c5562006-03-09 17:16:45 +000082
Andrew Lenharthf3f951a2005-07-22 20:50:29 +000083 let Inst{25-21} = Ra;
84 let Inst{20-16} = Rb;
85 let Inst{15-14} = TB;
86 let Inst{13-0} = disp;
87}
Andrew Lenharthf2b806a2006-06-12 18:09:24 +000088class 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 Cheng64d80e32007-07-19 01:14:50 +000095 let OutOperandList = (ops);
96 let InOperandList = OL;
Andrew Lenharthf2b806a2006-06-12 18:09:24 +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}
Andrew Lenharthf3f951a2005-07-22 20:50:29 +0000103
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000104//3.3.2
Andrew Lenhartheececba2005-12-25 17:36:48 +0000105def target : Operand<OtherVT> {}
Andrew Lenharthf81173f2006-10-31 16:49:55 +0000106
Evan Chengffbacca2007-07-21 00:34:19 +0000107let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in {
Andrew Lenharthf81173f2006-10-31 16:49:55 +0000108class BFormN<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
109 : InstAlpha<opcode, asmstr, itin> {
Evan Cheng64d80e32007-07-19 01:14:50 +0000110 let OutOperandList = (ops);
111 let InOperandList = OL;
Andrew Lenharthf81173f2006-10-31 16:49:55 +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
Andrew Lenharthcfb28152005-12-06 20:40:34 +0000121let isBranch = 1, isTerminator = 1 in
Andrew Lenharth017c5562006-03-09 17:16:45 +0000122class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
123 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenhartheececba2005-12-25 17:36:48 +0000124 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000125 let OutOperandList = (ops);
126 let InOperandList = (ops target:$DISP);
Andrew Lenhartheececba2005-12-25 17:36:48 +0000127 bits<5> Ra;
Andrew Lenharth756fbeb2005-10-22 22:06:58 +0000128 bits<21> disp;
129
130 let Inst{25-21} = Ra;
131 let Inst{20-0} = disp;
132}
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000133
134//3.3.3
Andrew Lenharth017c5562006-03-09 17:16:45 +0000135class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
136 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth4907d222005-10-20 00:28:31 +0000137 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000138 let OutOperandList = (outs GPRC:$RC);
139 let InOperandList = (ins GPRC:$RA, GPRC:$RB);
Andrew Lenharth4907d222005-10-20 00:28:31 +0000140
Andrew Lenharthf3f951a2005-07-22 20:50:29 +0000141 bits<5> Rc;
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000142 bits<5> Ra;
143 bits<5> Rb;
Andrew Lenharthf3f951a2005-07-22 20:50:29 +0000144 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
Andrew Lenharth017c5562006-03-09 17:16:45 +0000154class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
155 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth964b6aa2005-10-20 19:39:24 +0000156 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000157 let OutOperandList = (outs GPRC:$RC);
158 let InOperandList = (ins GPRC:$RB);
Andrew Lenharth964b6aa2005-10-20 19:39:24 +0000159
160 bits<5> Rc;
161 bits<5> Rb;
162 bits<7> Function = fun;
163
Andrew Lenharth756fbeb2005-10-22 22:06:58 +0000164 let Inst{25-21} = 31;
Andrew Lenharth964b6aa2005-10-20 19:39:24 +0000165 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
Andrew Lenharth017c5562006-03-09 17:16:45 +0000172class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
173 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth5de36f92005-12-05 23:19:44 +0000174 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000175 let OutOperandList = (outs GPRC:$RDEST);
176 let InOperandList = (ins GPRC:$RCOND, GPRC:$RTRUE, GPRC:$RFALSE);
Andrew Lenharth15b78232007-04-17 04:07:59 +0000177 let Constraints = "$RFALSE = $RDEST";
178 let DisableEncoding = "$RFALSE";
Andrew Lenharth5de36f92005-12-05 23:19:44 +0000179
180 bits<5> Rc;
Andrew Lenharth5de36f92005-12-05 23:19:44 +0000181 bits<5> Ra;
Andrew Lenharth15b78232007-04-17 04:07:59 +0000182 bits<5> Rb;
Andrew Lenharth5de36f92005-12-05 23:19:44 +0000183 bits<7> Function = fun;
184
Andrew Lenharth15b78232007-04-17 04:07:59 +0000185// let isTwoAddress = 1;
Andrew Lenharth5de36f92005-12-05 23:19:44 +0000186 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
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000194
Andrew Lenharth017c5562006-03-09 17:16:45 +0000195class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
196 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth4907d222005-10-20 00:28:31 +0000197 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000198 let OutOperandList = (outs GPRC:$RC);
199 let InOperandList = (ins GPRC:$RA, u8imm:$L);
Andrew Lenharth4907d222005-10-20 00:28:31 +0000200
Andrew Lenharthf3f951a2005-07-22 20:50:29 +0000201 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
Andrew Lenharth017c5562006-03-09 17:16:45 +0000213class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
214 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth77f08852006-02-01 19:37:33 +0000215 let Pattern = pattern;
Evan Cheng64d80e32007-07-19 01:14:50 +0000216 let OutOperandList = (outs GPRC:$RDEST);
217 let InOperandList = (ins GPRC:$RCOND, s64imm:$RTRUE, GPRC:$RFALSE);
Andrew Lenharth15b78232007-04-17 04:07:59 +0000218 let Constraints = "$RFALSE = $RDEST";
219 let DisableEncoding = "$RFALSE";
220
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000221 bits<5> Rc;
Andrew Lenharth1f347a32005-10-20 23:58:36 +0000222 bits<5> Ra;
Andrew Lenharth15b78232007-04-17 04:07:59 +0000223 bits<8> LIT;
Andrew Lenharth1f347a32005-10-20 23:58:36 +0000224 bits<7> Function = fun;
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000225
Andrew Lenharth15b78232007-04-17 04:07:59 +0000226// let isTwoAddress = 1;
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000227 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
Andrew Lenharth017c5562006-03-09 17:16:45 +0000235class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
236 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth5cefc5e2005-11-09 19:17:08 +0000237 let Pattern = pattern;
238
Andrew Lenharth98169be2005-07-28 18:14:47 +0000239 bits<5> Fc;
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000240 bits<5> Fa;
241 bits<5> Fb;
Andrew Lenharth3e98fde2005-01-26 21:54:09 +0000242 bits<11> Function = fun;
Andrew Lenharth98169be2005-07-28 18:14:47 +0000243
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
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000250//3.3.5
Andrew Lenharth017c5562006-03-09 17:16:45 +0000251class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
252 : InstAlpha<opcode, asmstr, itin> {
Evan Cheng64d80e32007-07-19 01:14:50 +0000253 let OutOperandList = (ops);
254 let InOperandList = OL;
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000255 bits<26> Function;
256
257 let Inst{25-0} = Function;
258}
259
260
261// Pseudo instructions.
Evan Cheng64d80e32007-07-19 01:14:50 +0000262class PseudoInstAlpha<dag OOL, dag IOL, string nm, list<dag> pattern, InstrItinClass itin>
Andrew Lenharth017c5562006-03-09 17:16:45 +0000263 : InstAlpha<0, nm, itin> {
Evan Cheng64d80e32007-07-19 01:14:50 +0000264 let OutOperandList = OOL;
265 let InOperandList = IOL;
Andrew Lenharth50b37842005-11-22 04:20:06 +0000266 let Pattern = pattern;
267
Andrew Lenharth304d0f32005-01-22 23:41:55 +0000268}