blob: 85afcd2b2c908b37c1649b35cba94243f1a6c4e0 [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 Lenharthb9aaea32005-12-24 07:34:33 +000043class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern>
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000044 : InstAlphaAlt<opcode, asmstr> {
45 let Pattern = pattern;
Andrew Lenharthb9aaea32005-12-24 07:34:33 +000046 let isStore = store;
47 let isLoad = load;
Andrew Lenharth636e1ae2005-12-24 03:41:56 +000048
49 bits<5> Ra;
50 bits<16> disp;
51 bits<5> Rb;
52
53 let Inst{25-21} = Ra;
54 let Inst{20-16} = Rb;
55 let Inst{15-0} = disp;
56}
Andrew Lenharth6db615d2005-11-30 07:19:56 +000057class MFormAlt<bits<6> opcode, string asmstr>
58 : InstAlphaAlt<opcode, asmstr> {
59 bits<5> Ra;
60 bits<16> disp;
61 bits<5> Rb;
62
63 let Inst{25-21} = Ra;
64 let Inst{20-16} = Rb;
65 let Inst{15-0} = disp;
66}
Andrew Lenharth01aa5632005-11-11 16:47:30 +000067class MfcForm<bits<6> opcode, bits<16> fc, string asmstr>
68 : InstAlpha<opcode, (ops GPRC:$RA, GPRC:$RB), asmstr> {
69 bits<5> Ra;
70 bits<5> Rb;
71
72 let Inst{25-21} = Ra;
73 let Inst{20-16} = Rb;
74 let Inst{15-0} = fc;
75}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000076
Andrew Lenharth02daecc2005-07-22 20:50:29 +000077class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
78 bits<5> Ra;
79 bits<5> Rb;
80 bits<14> disp;
81
82 let Inst{25-21} = Ra;
83 let Inst{20-16} = Rb;
84 let Inst{15-14} = TB;
85 let Inst{13-0} = disp;
86}
87
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000088//3.3.2
89let isBranch = 1, isTerminator = 1 in
Andrew Lenharth02daecc2005-07-22 20:50:29 +000090class BForm<bits<6> opcode, string asmstr>
91 : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
92 bits<5> Ra;
93 bits<21> disp;
94
95 let Inst{25-21} = Ra;
96 let Inst{20-0} = disp;
97}
Andrew Lenharthf5200932005-12-25 17:36:48 +000098def target : Operand<OtherVT> {}
Andrew Lenharth29b7ef02005-12-06 20:40:34 +000099let isBranch = 1, isTerminator = 1 in
Andrew Lenharthf5200932005-12-25 17:36:48 +0000100class BFormD<bits<6> opcode, string asmstr, list<dag> pattern>
101 : InstAlpha<opcode, (ops target:$DISP), asmstr> {
102 let Pattern = pattern;
103
104 bits<5> Ra;
Andrew Lenharth5a990412005-10-22 22:06:58 +0000105 bits<21> disp;
106
107 let Inst{25-21} = Ra;
108 let Inst{20-0} = disp;
109}
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000110
111let isBranch = 1, isTerminator = 1 in
112class FBForm<bits<6> opcode, string asmstr>
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000113 : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000114 bits<5> Ra;
115 bits<21> disp;
116
117 let Inst{25-21} = Ra;
118 let Inst{20-0} = disp;
119}
120
121//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000122class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000123 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000124 let Pattern = pattern;
125
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000126 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000127 bits<5> Ra;
128 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000129 bits<7> Function = fun;
130
131 let Inst{25-21} = Ra;
132 let Inst{20-16} = Rb;
133 let Inst{15-13} = 0;
134 let Inst{12} = 0;
135 let Inst{11-5} = Function;
136 let Inst{4-0} = Rc;
137}
138
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000139class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000140 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
141 let Pattern = pattern;
142
143 bits<5> Rc;
144 bits<5> Rb;
145 bits<7> Function = fun;
146
Andrew Lenharth5a990412005-10-22 22:06:58 +0000147 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000148 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 Lenharthe788bbf2005-12-06 00:33:53 +0000155class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth3c7c4d72005-12-05 23:19:44 +0000156 : InstAlphaAlt<opcode, asmstr> {
157 let Pattern = pattern;
158
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 Lenharth7b698672005-10-20 00:28:31 +0000174class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000175 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000176 let Pattern = pattern;
177
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000178 bits<5> Rc;
179 bits<5> Ra;
180 bits<8> LIT;
181 bits<7> Function = fun;
182
183 let Inst{25-21} = Ra;
184 let Inst{20-13} = LIT;
185 let Inst{12} = 1;
186 let Inst{11-5} = Function;
187 let Inst{4-0} = Rc;
188}
189
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000190class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
191 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000192 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000193 bits<8> LIT;
194 bits<5> Ra;
195 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000196
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000197 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000198 let Inst{25-21} = Ra;
199 let Inst{20-13} = LIT;
200 let Inst{12} = 1;
201 let Inst{11-5} = Function;
202 let Inst{4-0} = Rc;
203}
204
205//3.3.4
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000206class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern>
207 : InstAlphaAlt<opcode, asmstr> {
208 let Pattern = pattern;
209
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000210 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000211 bits<5> Fa;
212 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000213 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000214
215 let Inst{25-21} = Fa;
216 let Inst{20-16} = Fb;
217 let Inst{15-5} = Function;
218 let Inst{4-0} = Fc;
219}
220
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000221//3.3.5
222class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
223 bits<26> Function;
224
225 let Inst{25-0} = Function;
226}
227
228
229// Pseudo instructions.
Andrew Lenharth0294e332005-11-22 04:20:06 +0000230class PseudoInstAlpha<dag OL, string nm, list<dag> pattern> : InstAlpha<0, OL, nm> {
231 let Pattern = pattern;
232
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000233}