blob: 3f6e6495f667f9df5414de6437ebf3c34601815e [file] [log] [blame]
Misha Brukmanffe99682005-02-05 02:24:26 +00001//===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00002//
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
Andrew Lenharth7b698672005-10-20 00:28:31 +000020def u8imm : Operand<i64>;
21def s14imm : Operand<i64>;
22def s16imm : Operand<i64>;
23def s21imm : Operand<i64>;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000024def s64imm : Operand<i64>;
25
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000026//===----------------------------------------------------------------------===//
27// Instruction format superclass
28//===----------------------------------------------------------------------===//
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000029// Alpha instruction baseline
Andrew Lenharth16b96d22006-03-09 17:16:45 +000030class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000031 field bits<32> Inst;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000032 let Namespace = "Alpha";
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000033 let AsmString = asmstr;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000034 let Inst{31-26} = op;
Andrew Lenharth16b96d22006-03-09 17:16:45 +000035 let Itinerary = itin;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000036}
37
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000038
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000039//3.3.1
Andrew Lenharth16b96d22006-03-09 17:16:45 +000040class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern, InstrItinClass itin>
41 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000042 let Pattern = pattern;
Andrew Lenharthb9aaea32005-12-24 07:34:33 +000043 let isStore = store;
44 let isLoad = load;
Andrew Lenharth153f8082006-01-26 03:22:07 +000045 let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
Andrew Lenharth636e1ae2005-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 Lenharth16b96d22006-03-09 17:16:45 +000055class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
56 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth01aa5632005-11-11 16:47:30 +000057 bits<5> Ra;
Andrew Lenharth01aa5632005-11-11 16:47:30 +000058
Andrew Lenharth16b96d22006-03-09 17:16:45 +000059 let OperandList = (ops GPRC:$RA);
Andrew Lenharth01aa5632005-11-11 16:47:30 +000060 let Inst{25-21} = Ra;
Andrew Lenharth34380b72006-01-16 21:22:38 +000061 let Inst{20-16} = 0;
Andrew Lenharth01aa5632005-11-11 16:47:30 +000062 let Inst{15-0} = fc;
63}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000064
Andrew Lenharth16b96d22006-03-09 17:16:45 +000065class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
66 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth02daecc2005-07-22 20:50:29 +000067 bits<5> Ra;
68 bits<5> Rb;
69 bits<14> disp;
70
Andrew Lenharth16b96d22006-03-09 17:16:45 +000071 let OperandList = OL;
72
Andrew Lenharth02daecc2005-07-22 20:50:29 +000073 let Inst{25-21} = Ra;
74 let Inst{20-16} = Rb;
75 let Inst{15-14} = TB;
76 let Inst{13-0} = disp;
77}
Andrew Lenharth80528492006-06-12 18:09:24 +000078class MbrpForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, list<dag> pattern, InstrItinClass itin>
79 : InstAlpha<opcode, asmstr, itin> {
80 let Pattern=pattern;
81 bits<5> Ra;
82 bits<5> Rb;
83 bits<14> disp;
84
85 let OperandList = OL;
86
87 let Inst{25-21} = Ra;
88 let Inst{20-16} = Rb;
89 let Inst{15-14} = TB;
90 let Inst{13-0} = disp;
91}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000092
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000093//3.3.2
Andrew Lenharthf5200932005-12-25 17:36:48 +000094def target : Operand<OtherVT> {}
Andrew Lenharth29b7ef02005-12-06 20:40:34 +000095let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +000096class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
97 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthf5200932005-12-25 17:36:48 +000098 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +000099 let OperandList = (ops target:$DISP);
Andrew Lenharthf5200932005-12-25 17:36:48 +0000100 bits<5> Ra;
Andrew Lenharth5a990412005-10-22 22:06:58 +0000101 bits<21> disp;
102
103 let Inst{25-21} = Ra;
104 let Inst{20-0} = disp;
105}
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000106let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000107class BForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
108 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000109 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000110 let OperandList = (ops GPRC:$RA, target:$DISP);
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000111
112 bits<5> Ra;
113 bits<21> disp;
114
115 let Inst{25-21} = Ra;
116 let Inst{20-0} = disp;
117}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000118
119let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000120class FBForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
121 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000122 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000123 let OperandList = (ops F8RC:$RA, target:$DISP);
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000124
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000125 bits<5> Ra;
126 bits<21> disp;
127
128 let Inst{25-21} = Ra;
129 let Inst{20-0} = disp;
130}
131
132//3.3.3
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000133class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
134 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000135 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000136 let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000137
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000138 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000139 bits<5> Ra;
140 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000141 bits<7> Function = fun;
142
143 let Inst{25-21} = Ra;
144 let Inst{20-16} = Rb;
145 let Inst{15-13} = 0;
146 let Inst{12} = 0;
147 let Inst{11-5} = Function;
148 let Inst{4-0} = Rc;
149}
150
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000151class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
152 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000153 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000154 let OperandList = (ops GPRC:$RC, GPRC:$RB);
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000155
156 bits<5> Rc;
157 bits<5> Rb;
158 bits<7> Function = fun;
159
Andrew Lenharth5a990412005-10-22 22:06:58 +0000160 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000161 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
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000168class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
169 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000170 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000171 let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, GPRC:$RTRUE, GPRC:$RCOND);
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000172
173 bits<5> Rc;
174 bits<5> Rb;
175 bits<5> Ra;
176 bits<7> Function = fun;
177
178 let isTwoAddress = 1;
179 let Inst{25-21} = Ra;
180 let Inst{20-16} = Rb;
181 let Inst{15-13} = 0;
182 let Inst{12} = 0;
183 let Inst{11-5} = Function;
184 let Inst{4-0} = Rc;
185}
186
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000187
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000188class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
189 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000190 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000191 let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000192
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000193 bits<5> Rc;
194 bits<5> Ra;
195 bits<8> LIT;
196 bits<7> Function = fun;
197
198 let Inst{25-21} = Ra;
199 let Inst{20-13} = LIT;
200 let Inst{12} = 1;
201 let Inst{11-5} = Function;
202 let Inst{4-0} = Rc;
203}
204
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000205class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
206 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth4b1c7262006-02-01 19:37:33 +0000207 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000208 let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, s64imm:$RTRUE, GPRC:$RCOND);
209
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000210 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000211 bits<8> LIT;
212 bits<5> Ra;
213 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000214
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000215 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000216 let Inst{25-21} = Ra;
217 let Inst{20-13} = LIT;
218 let Inst{12} = 1;
219 let Inst{11-5} = Function;
220 let Inst{4-0} = Rc;
221}
222
223//3.3.4
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000224class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
225 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000226 let Pattern = pattern;
227
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000228 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000229 bits<5> Fa;
230 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000231 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000232
233 let Inst{25-21} = Fa;
234 let Inst{20-16} = Fb;
235 let Inst{15-5} = Function;
236 let Inst{4-0} = Fc;
237}
238
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000239//3.3.5
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000240class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
241 : InstAlpha<opcode, asmstr, itin> {
242 let OperandList = OL;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000243 bits<26> Function;
244
245 let Inst{25-0} = Function;
246}
247
248
249// Pseudo instructions.
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000250class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin>
251 : InstAlpha<0, nm, itin> {
252 let OperandList = OL;
Andrew Lenharth0294e332005-11-22 04:20:06 +0000253 let Pattern = pattern;
254
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000255}