blob: 674a259fe1dfd711750b3f0dbef3622713833238 [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
30class InstAlphaAlt<bits<6> op, string asmstr> : 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;
35}
36
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000037class InstAlpha<bits<6> op, dag OL, string asmstr>
38: InstAlphaAlt<op, asmstr> { // Alpha instruction baseline
39 let OperandList = OL;
40}
41
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000042//3.3.1
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000043class MFormD<bits<6> opcode, string asmstr, list<dag> pattern>
44 : InstAlphaAlt<opcode, asmstr> {
45 let Pattern = pattern;
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}
Andrew Lenharth6db615d2005-11-30 07:19:56 +000055class MFormAlt<bits<6> opcode, string asmstr>
56 : InstAlphaAlt<opcode, asmstr> {
57 bits<5> Ra;
58 bits<16> disp;
59 bits<5> Rb;
60
61 let Inst{25-21} = Ra;
62 let Inst{20-16} = Rb;
63 let Inst{15-0} = disp;
64}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000065class MForm<bits<6> opcode, string asmstr>
66 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000067 bits<5> Ra;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000068 bits<16> disp;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000069 bits<5> Rb;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000070
71 let Inst{25-21} = Ra;
72 let Inst{20-16} = Rb;
73 let Inst{15-0} = disp;
74}
Andrew Lenharth01aa5632005-11-11 16:47:30 +000075class MfcForm<bits<6> opcode, bits<16> fc, string asmstr>
76 : InstAlpha<opcode, (ops GPRC:$RA, GPRC:$RB), asmstr> {
77 bits<5> Ra;
78 bits<5> Rb;
79
80 let Inst{25-21} = Ra;
81 let Inst{20-16} = Rb;
82 let Inst{15-0} = fc;
83}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000084
Andrew Lenharth02daecc2005-07-22 20:50:29 +000085class MgForm<bits<6> opcode, string asmstr>
86 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> {
87 bits<5> Ra;
88 bits<16> disp;
89 bits<5> Rb;
90
91 let Inst{25-21} = Ra;
92 let Inst{20-16} = Rb;
93 let Inst{15-0} = disp;
94}
95
96class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
97 bits<5> Ra;
98 bits<5> Rb;
99 bits<14> disp;
100
101 let Inst{25-21} = Ra;
102 let Inst{20-16} = Rb;
103 let Inst{15-14} = TB;
104 let Inst{13-0} = disp;
105}
106
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000107//3.3.2
108let isBranch = 1, isTerminator = 1 in
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000109class BForm<bits<6> opcode, string asmstr>
110 : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
111 bits<5> Ra;
112 bits<21> disp;
113
114 let Inst{25-21} = Ra;
115 let Inst{20-0} = disp;
116}
Andrew Lenharth29b7ef02005-12-06 20:40:34 +0000117let isBranch = 1, isTerminator = 1 in
Andrew Lenharth5a990412005-10-22 22:06:58 +0000118class BFormD<bits<6> opcode, string asmstr>
119 : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> {
120 bits<5> Ra = 31;
121 bits<21> disp;
122
123 let Inst{25-21} = Ra;
124 let Inst{20-0} = disp;
125}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000126
127let isBranch = 1, isTerminator = 1 in
128class FBForm<bits<6> opcode, string asmstr>
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000129 : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000130 bits<5> Ra;
131 bits<21> disp;
132
133 let Inst{25-21} = Ra;
134 let Inst{20-0} = disp;
135}
136
137//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000138class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000139 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000140 let Pattern = pattern;
141
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000142 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000143 bits<5> Ra;
144 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000145 bits<7> Function = fun;
146
147 let Inst{25-21} = Ra;
148 let Inst{20-16} = Rb;
149 let Inst{15-13} = 0;
150 let Inst{12} = 0;
151 let Inst{11-5} = Function;
152 let Inst{4-0} = Rc;
153}
154
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000155class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000156 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
157 let Pattern = pattern;
158
159 bits<5> Rc;
160 bits<5> Rb;
161 bits<7> Function = fun;
162
Andrew Lenharth5a990412005-10-22 22:06:58 +0000163 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000164 let Inst{20-16} = Rb;
165 let Inst{15-13} = 0;
166 let Inst{12} = 0;
167 let Inst{11-5} = Function;
168 let Inst{4-0} = Rc;
169}
170
Andrew Lenharthe788bbf2005-12-06 00:33:53 +0000171class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000172 : InstAlphaAlt<opcode, asmstr> {
173 let Pattern = pattern;
174
175 bits<5> Rc;
176 bits<5> Rb;
177 bits<5> Ra;
178 bits<7> Function = fun;
179
180 let isTwoAddress = 1;
181 let Inst{25-21} = Ra;
182 let Inst{20-16} = Rb;
183 let Inst{15-13} = 0;
184 let Inst{12} = 0;
185 let Inst{11-5} = Function;
186 let Inst{4-0} = Rc;
187}
188
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000189
Andrew Lenharth7b698672005-10-20 00:28:31 +0000190class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000191 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000192 let Pattern = pattern;
193
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000194 bits<5> Rc;
195 bits<5> Ra;
196 bits<8> LIT;
197 bits<7> Function = fun;
198
199 let Inst{25-21} = Ra;
200 let Inst{20-13} = LIT;
201 let Inst{12} = 1;
202 let Inst{11-5} = Function;
203 let Inst{4-0} = Rc;
204}
205
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000206class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
207 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000208 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000209 bits<8> LIT;
210 bits<5> Ra;
211 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000212
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000213 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000214 let Inst{25-21} = Ra;
215 let Inst{20-13} = LIT;
216 let Inst{12} = 1;
217 let Inst{11-5} = Function;
218 let Inst{4-0} = Rc;
219}
220
221//3.3.4
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000222class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern>
223 : InstAlphaAlt<opcode, asmstr> {
224 let Pattern = pattern;
225
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000226 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000227 bits<5> Fa;
228 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000229 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000230
231 let Inst{25-21} = Fa;
232 let Inst{20-16} = Fb;
233 let Inst{15-5} = Function;
234 let Inst{4-0} = Fc;
235}
236
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000237//3.3.5
238class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
239 bits<26> Function;
240
241 let Inst{25-0} = Function;
242}
243
244
245// Pseudo instructions.
Andrew Lenharth0294e332005-11-22 04:20:06 +0000246class PseudoInstAlpha<dag OL, string nm, list<dag> pattern> : InstAlpha<0, OL, nm> {
247 let Pattern = pattern;
248
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000249}