blob: cf7df80085c3a0531b3fe562fc5e445810b76c73 [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 Lenharth6db615d2005-11-30 07:19:56 +000043class MFormAlt<bits<6> opcode, string asmstr>
44 : InstAlphaAlt<opcode, asmstr> {
45 bits<5> Ra;
46 bits<16> disp;
47 bits<5> Rb;
48
49 let Inst{25-21} = Ra;
50 let Inst{20-16} = Rb;
51 let Inst{15-0} = disp;
52}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000053class MForm<bits<6> opcode, string asmstr>
54 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000055 bits<5> Ra;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000056 bits<16> disp;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000057 bits<5> Rb;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000058
59 let Inst{25-21} = Ra;
60 let Inst{20-16} = Rb;
61 let Inst{15-0} = disp;
62}
Andrew Lenharth01aa5632005-11-11 16:47:30 +000063class MfcForm<bits<6> opcode, bits<16> fc, string asmstr>
64 : InstAlpha<opcode, (ops GPRC:$RA, GPRC:$RB), asmstr> {
65 bits<5> Ra;
66 bits<5> Rb;
67
68 let Inst{25-21} = Ra;
69 let Inst{20-16} = Rb;
70 let Inst{15-0} = fc;
71}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000072
Andrew Lenharth02daecc2005-07-22 20:50:29 +000073class MgForm<bits<6> opcode, string asmstr>
74 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> {
75 bits<5> Ra;
76 bits<16> disp;
77 bits<5> Rb;
78
79 let Inst{25-21} = Ra;
80 let Inst{20-16} = Rb;
81 let Inst{15-0} = disp;
82}
83
84class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
85 bits<5> Ra;
86 bits<5> Rb;
87 bits<14> disp;
88
89 let Inst{25-21} = Ra;
90 let Inst{20-16} = Rb;
91 let Inst{15-14} = TB;
92 let Inst{13-0} = disp;
93}
94
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000095//3.3.2
96let isBranch = 1, isTerminator = 1 in
Andrew Lenharth02daecc2005-07-22 20:50:29 +000097class BForm<bits<6> opcode, string asmstr>
98 : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
99 bits<5> Ra;
100 bits<21> disp;
101
102 let Inst{25-21} = Ra;
103 let Inst{20-0} = disp;
104}
Andrew Lenharth29b7ef02005-12-06 20:40:34 +0000105let isBranch = 1, isTerminator = 1 in
Andrew Lenharth5a990412005-10-22 22:06:58 +0000106class BFormD<bits<6> opcode, string asmstr>
107 : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> {
108 bits<5> Ra = 31;
109 bits<21> disp;
110
111 let Inst{25-21} = Ra;
112 let Inst{20-0} = disp;
113}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000114
115let isBranch = 1, isTerminator = 1 in
116class FBForm<bits<6> opcode, string asmstr>
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000117 : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000118 bits<5> Ra;
119 bits<21> disp;
120
121 let Inst{25-21} = Ra;
122 let Inst{20-0} = disp;
123}
124
125//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000126class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000127 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000128 let Pattern = pattern;
129
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000130 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000131 bits<5> Ra;
132 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000133 bits<7> Function = fun;
134
135 let Inst{25-21} = Ra;
136 let Inst{20-16} = Rb;
137 let Inst{15-13} = 0;
138 let Inst{12} = 0;
139 let Inst{11-5} = Function;
140 let Inst{4-0} = Rc;
141}
142
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000143class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000144 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
145 let Pattern = pattern;
146
147 bits<5> Rc;
148 bits<5> Rb;
149 bits<7> Function = fun;
150
Andrew Lenharth5a990412005-10-22 22:06:58 +0000151 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000152 let Inst{20-16} = Rb;
153 let Inst{15-13} = 0;
154 let Inst{12} = 0;
155 let Inst{11-5} = Function;
156 let Inst{4-0} = Rc;
157}
158
Andrew Lenharthe788bbf2005-12-06 00:33:53 +0000159class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000160 : InstAlphaAlt<opcode, asmstr> {
161 let Pattern = pattern;
162
163 bits<5> Rc;
164 bits<5> Rb;
165 bits<5> Ra;
166 bits<7> Function = fun;
167
168 let isTwoAddress = 1;
169 let Inst{25-21} = Ra;
170 let Inst{20-16} = Rb;
171 let Inst{15-13} = 0;
172 let Inst{12} = 0;
173 let Inst{11-5} = Function;
174 let Inst{4-0} = Rc;
175}
176
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000177
Andrew Lenharth7b698672005-10-20 00:28:31 +0000178class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000179 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000180 let Pattern = pattern;
181
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000182 bits<5> Rc;
183 bits<5> Ra;
184 bits<8> LIT;
185 bits<7> Function = fun;
186
187 let Inst{25-21} = Ra;
188 let Inst{20-13} = LIT;
189 let Inst{12} = 1;
190 let Inst{11-5} = Function;
191 let Inst{4-0} = Rc;
192}
193
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000194class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
195 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
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 Lenharth97a7fcf2005-11-09 19:17:08 +0000210class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern>
211 : InstAlphaAlt<opcode, asmstr> {
212 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
226class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
227 bits<26> Function;
228
229 let Inst{25-0} = Function;
230}
231
232
233// Pseudo instructions.
Andrew Lenharth0294e332005-11-22 04:20:06 +0000234class PseudoInstAlpha<dag OL, string nm, list<dag> pattern> : InstAlpha<0, OL, nm> {
235 let Pattern = pattern;
236
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000237}