blob: ed919cc7629eb6eace7b10f027dbfba1038b6981 [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 Lenharth5a990412005-10-22 22:06:58 +0000105class BFormD<bits<6> opcode, string asmstr>
106 : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> {
107 bits<5> Ra = 31;
108 bits<21> disp;
109
110 let Inst{25-21} = Ra;
111 let Inst{20-0} = disp;
112}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000113
114let isBranch = 1, isTerminator = 1 in
115class FBForm<bits<6> opcode, string asmstr>
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000116 : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000117 bits<5> Ra;
118 bits<21> disp;
119
120 let Inst{25-21} = Ra;
121 let Inst{20-0} = disp;
122}
123
124//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000125class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000126 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000127 let Pattern = pattern;
128
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000129 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000130 bits<5> Ra;
131 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000132 bits<7> Function = fun;
133
134 let Inst{25-21} = Ra;
135 let Inst{20-16} = Rb;
136 let Inst{15-13} = 0;
137 let Inst{12} = 0;
138 let Inst{11-5} = Function;
139 let Inst{4-0} = Rc;
140}
141
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000142class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000143 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
144 let Pattern = pattern;
145
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 Lenharthe788bbf2005-12-06 00:33:53 +0000158class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000159 : InstAlphaAlt<opcode, asmstr> {
160 let Pattern = pattern;
161
162 bits<5> Rc;
163 bits<5> Rb;
164 bits<5> Ra;
165 bits<7> Function = fun;
166
167 let isTwoAddress = 1;
168 let Inst{25-21} = Ra;
169 let Inst{20-16} = Rb;
170 let Inst{15-13} = 0;
171 let Inst{12} = 0;
172 let Inst{11-5} = Function;
173 let Inst{4-0} = Rc;
174}
175
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000176
Andrew Lenharth7b698672005-10-20 00:28:31 +0000177class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000178 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000179 let Pattern = pattern;
180
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000181 bits<5> Rc;
182 bits<5> Ra;
183 bits<8> LIT;
184 bits<7> Function = fun;
185
186 let Inst{25-21} = Ra;
187 let Inst{20-13} = LIT;
188 let Inst{12} = 1;
189 let Inst{11-5} = Function;
190 let Inst{4-0} = Rc;
191}
192
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000193class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
194 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000195 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000196 bits<8> LIT;
197 bits<5> Ra;
198 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000199
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000200 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000201 let Inst{25-21} = Ra;
202 let Inst{20-13} = LIT;
203 let Inst{12} = 1;
204 let Inst{11-5} = Function;
205 let Inst{4-0} = Rc;
206}
207
208//3.3.4
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000209class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern>
210 : InstAlphaAlt<opcode, asmstr> {
211 let Pattern = pattern;
212
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000213 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000214 bits<5> Fa;
215 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000216 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000217
218 let Inst{25-21} = Fa;
219 let Inst{20-16} = Fb;
220 let Inst{15-5} = Function;
221 let Inst{4-0} = Fc;
222}
223
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000224//3.3.5
225class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
226 bits<26> Function;
227
228 let Inst{25-0} = Function;
229}
230
231
232// Pseudo instructions.
Andrew Lenharth0294e332005-11-22 04:20:06 +0000233class PseudoInstAlpha<dag OL, string nm, list<dag> pattern> : InstAlpha<0, OL, nm> {
234 let Pattern = pattern;
235
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000236}