blob: 663562948d47adf5ec7b5cee580ae976f6c99471 [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}
78
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000079//3.3.2
Andrew Lenharthf5200932005-12-25 17:36:48 +000080def target : Operand<OtherVT> {}
Andrew Lenharth29b7ef02005-12-06 20:40:34 +000081let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +000082class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
83 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthf5200932005-12-25 17:36:48 +000084 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +000085 let OperandList = (ops target:$DISP);
Andrew Lenharthf5200932005-12-25 17:36:48 +000086 bits<5> Ra;
Andrew Lenharth5a990412005-10-22 22:06:58 +000087 bits<21> disp;
88
89 let Inst{25-21} = Ra;
90 let Inst{20-0} = disp;
91}
Andrew Lenharth6bec63a2006-01-01 22:16:14 +000092let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +000093class BForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
94 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth6bec63a2006-01-01 22:16:14 +000095 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +000096 let OperandList = (ops GPRC:$RA, target:$DISP);
Andrew Lenharth6bec63a2006-01-01 22:16:14 +000097
98 bits<5> Ra;
99 bits<21> disp;
100
101 let Inst{25-21} = Ra;
102 let Inst{20-0} = disp;
103}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000104
105let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000106class FBForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
107 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000108 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000109 let OperandList = (ops F8RC:$RA, target:$DISP);
Andrew Lenharth6bec63a2006-01-01 22:16:14 +0000110
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000111 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
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000119class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
120 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000121 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000122 let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000123
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000124 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000125 bits<5> Ra;
126 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000127 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
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000137class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
138 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000139 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000140 let OperandList = (ops GPRC:$RC, GPRC:$RB);
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000141
142 bits<5> Rc;
143 bits<5> Rb;
144 bits<7> Function = fun;
145
Andrew Lenharth5a990412005-10-22 22:06:58 +0000146 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000147 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 Lenharth16b96d22006-03-09 17:16:45 +0000154class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
155 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000156 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000157 let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, GPRC:$RTRUE, GPRC:$RCOND);
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000158
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
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000173
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000174class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
175 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000176 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000177 let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000178
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000179 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
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000191class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
192 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth4b1c7262006-02-01 19:37:33 +0000193 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000194 let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, s64imm:$RTRUE, GPRC:$RCOND);
195
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000196 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000197 bits<8> LIT;
198 bits<5> Ra;
199 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000200
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000201 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000202 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
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000210class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
211 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000212 let Pattern = pattern;
213
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000214 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000215 bits<5> Fa;
216 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000217 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000218
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
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000225//3.3.5
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000226class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
227 : InstAlpha<opcode, asmstr, itin> {
228 let OperandList = OL;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000229 bits<26> Function;
230
231 let Inst{25-0} = Function;
232}
233
234
235// Pseudo instructions.
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000236class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin>
237 : InstAlpha<0, nm, itin> {
238 let OperandList = OL;
Andrew Lenharth0294e332005-11-22 04:20:06 +0000239 let Pattern = pattern;
240
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000241}