blob: 259e9afe22c756faf581a7d3a8e1ca162957d15b [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>;
Andrew Lenharth692e4152006-10-31 16:49:55 +000025def u64imm : Operand<i64>;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000026
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000027//===----------------------------------------------------------------------===//
28// Instruction format superclass
29//===----------------------------------------------------------------------===//
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000030// Alpha instruction baseline
Andrew Lenharth16b96d22006-03-09 17:16:45 +000031class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000032 field bits<32> Inst;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000033 let Namespace = "Alpha";
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000034 let AsmString = asmstr;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000035 let Inst{31-26} = op;
Andrew Lenharth16b96d22006-03-09 17:16:45 +000036 let Itinerary = itin;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000037}
38
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000039
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000040//3.3.1
Andrew Lenharth16b96d22006-03-09 17:16:45 +000041class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern, InstrItinClass itin>
42 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000043 let Pattern = pattern;
Andrew Lenharthb9aaea32005-12-24 07:34:33 +000044 let isStore = store;
45 let isLoad = load;
Andrew Lenharth153f8082006-01-26 03:22:07 +000046 let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000047
48 bits<5> Ra;
49 bits<16> disp;
50 bits<5> Rb;
51
52 let Inst{25-21} = Ra;
53 let Inst{20-16} = Rb;
54 let Inst{15-0} = disp;
55}
Andrew Lenharth16b96d22006-03-09 17:16:45 +000056class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
57 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth01aa5632005-11-11 16:47:30 +000058 bits<5> Ra;
Andrew Lenharth01aa5632005-11-11 16:47:30 +000059
Andrew Lenharth16b96d22006-03-09 17:16:45 +000060 let OperandList = (ops GPRC:$RA);
Andrew Lenharth01aa5632005-11-11 16:47:30 +000061 let Inst{25-21} = Ra;
Andrew Lenharth34380b72006-01-16 21:22:38 +000062 let Inst{20-16} = 0;
Andrew Lenharth01aa5632005-11-11 16:47:30 +000063 let Inst{15-0} = fc;
64}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000065
Andrew Lenharth16b96d22006-03-09 17:16:45 +000066class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
67 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth02daecc2005-07-22 20:50:29 +000068 bits<5> Ra;
69 bits<5> Rb;
70 bits<14> disp;
71
Andrew Lenharth16b96d22006-03-09 17:16:45 +000072 let OperandList = OL;
73
Andrew Lenharth02daecc2005-07-22 20:50:29 +000074 let Inst{25-21} = Ra;
75 let Inst{20-16} = Rb;
76 let Inst{15-14} = TB;
77 let Inst{13-0} = disp;
78}
Andrew Lenharth80528492006-06-12 18:09:24 +000079class MbrpForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, list<dag> pattern, InstrItinClass itin>
80 : InstAlpha<opcode, asmstr, itin> {
81 let Pattern=pattern;
82 bits<5> Ra;
83 bits<5> Rb;
84 bits<14> disp;
85
86 let OperandList = OL;
87
88 let Inst{25-21} = Ra;
89 let Inst{20-16} = Rb;
90 let Inst{15-14} = TB;
91 let Inst{13-0} = disp;
92}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000093
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000094//3.3.2
Andrew Lenharthf5200932005-12-25 17:36:48 +000095def target : Operand<OtherVT> {}
Andrew Lenharth692e4152006-10-31 16:49:55 +000096
97let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, noResults = 1 in {
98class BFormN<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
99 : InstAlpha<opcode, asmstr, itin> {
100 let OperandList = OL;
101 bits<64> Opc; //dummy
102 bits<5> Ra;
103 bits<21> disp;
104
105 let Inst{25-21} = Ra;
106 let Inst{20-0} = disp;
107}
108}
109
Andrew Lenharth29b7ef02005-12-06 20:40:34 +0000110let isBranch = 1, isTerminator = 1 in
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000111class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
112 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthf5200932005-12-25 17:36:48 +0000113 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000114 let OperandList = (ops target:$DISP);
Andrew Lenharthf5200932005-12-25 17:36:48 +0000115 bits<5> Ra;
Andrew Lenharth5a990412005-10-22 22:06:58 +0000116 bits<21> disp;
117
118 let Inst{25-21} = Ra;
119 let Inst{20-0} = disp;
120}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000121
122//3.3.3
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000123class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
124 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000125 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000126 let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000127
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000128 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000129 bits<5> Ra;
130 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000131 bits<7> Function = fun;
132
133 let Inst{25-21} = Ra;
134 let Inst{20-16} = Rb;
135 let Inst{15-13} = 0;
136 let Inst{12} = 0;
137 let Inst{11-5} = Function;
138 let Inst{4-0} = Rc;
139}
140
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000141class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
142 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000143 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000144 let OperandList = (ops GPRC:$RC, GPRC:$RB);
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000145
146 bits<5> Rc;
147 bits<5> Rb;
148 bits<7> Function = fun;
149
Andrew Lenharth5a990412005-10-22 22:06:58 +0000150 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000151 let Inst{20-16} = Rb;
152 let Inst{15-13} = 0;
153 let Inst{12} = 0;
154 let Inst{11-5} = Function;
155 let Inst{4-0} = Rc;
156}
157
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000158class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
159 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000160 let Pattern = pattern;
Andrew Lenharth20778142007-04-17 04:07:59 +0000161 let OperandList = (ops GPRC:$RDEST, GPRC:$RCOND, GPRC:$RTRUE, GPRC:$RFALSE);
162 let Constraints = "$RFALSE = $RDEST";
163 let DisableEncoding = "$RFALSE";
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000164
165 bits<5> Rc;
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000166 bits<5> Ra;
Andrew Lenharth20778142007-04-17 04:07:59 +0000167 bits<5> Rb;
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000168 bits<7> Function = fun;
169
Andrew Lenharth20778142007-04-17 04:07:59 +0000170// let isTwoAddress = 1;
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000171 let Inst{25-21} = Ra;
172 let Inst{20-16} = Rb;
173 let Inst{15-13} = 0;
174 let Inst{12} = 0;
175 let Inst{11-5} = Function;
176 let Inst{4-0} = Rc;
177}
178
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000179
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000180class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
181 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000182 let Pattern = pattern;
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000183 let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L);
Andrew Lenharth7b698672005-10-20 00:28:31 +0000184
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000185 bits<5> Rc;
186 bits<5> Ra;
187 bits<8> LIT;
188 bits<7> Function = fun;
189
190 let Inst{25-21} = Ra;
191 let Inst{20-13} = LIT;
192 let Inst{12} = 1;
193 let Inst{11-5} = Function;
194 let Inst{4-0} = Rc;
195}
196
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000197class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
198 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth4b1c7262006-02-01 19:37:33 +0000199 let Pattern = pattern;
Andrew Lenharth20778142007-04-17 04:07:59 +0000200 let OperandList = (ops GPRC:$RDEST, GPRC:$RCOND, s64imm:$RTRUE, GPRC:$RFALSE);
201 let Constraints = "$RFALSE = $RDEST";
202 let DisableEncoding = "$RFALSE";
203
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000204 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000205 bits<5> Ra;
Andrew Lenharth20778142007-04-17 04:07:59 +0000206 bits<8> LIT;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000207 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000208
Andrew Lenharth20778142007-04-17 04:07:59 +0000209// let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000210 let Inst{25-21} = Ra;
211 let Inst{20-13} = LIT;
212 let Inst{12} = 1;
213 let Inst{11-5} = Function;
214 let Inst{4-0} = Rc;
215}
216
217//3.3.4
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000218class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
219 : InstAlpha<opcode, asmstr, itin> {
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000220 let Pattern = pattern;
221
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000222 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000223 bits<5> Fa;
224 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000225 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000226
227 let Inst{25-21} = Fa;
228 let Inst{20-16} = Fb;
229 let Inst{15-5} = Function;
230 let Inst{4-0} = Fc;
231}
232
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000233//3.3.5
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000234class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
235 : InstAlpha<opcode, asmstr, itin> {
236 let OperandList = OL;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000237 bits<26> Function;
238
239 let Inst{25-0} = Function;
240}
241
242
243// Pseudo instructions.
Andrew Lenharth16b96d22006-03-09 17:16:45 +0000244class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin>
245 : InstAlpha<0, nm, itin> {
246 let OperandList = OL;
Andrew Lenharth0294e332005-11-22 04:20:06 +0000247 let Pattern = pattern;
248
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000249}