blob: 57a35af34c8bf4d33abd49e77ce8d23c39571b7f [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//===----------------------------------------------------------------------===//
29
30class InstAlpha<bits<6> op, dag OL, string asmstr> : Instruction { // Alpha instruction baseline
31 field bits<32> Inst;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000032 let Namespace = "Alpha";
33 let OperandList = OL;
34 let AsmString = asmstr;
35
36
37 let Inst{31-26} = op;
38}
39
40//3.3.1
Andrew Lenharth02daecc2005-07-22 20:50:29 +000041class MForm<bits<6> opcode, string asmstr>
42 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000043 bits<5> Ra;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000044 bits<16> disp;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000045 bits<5> Rb;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000046
47 let Inst{25-21} = Ra;
48 let Inst{20-16} = Rb;
49 let Inst{15-0} = disp;
50}
51
Andrew Lenharth02daecc2005-07-22 20:50:29 +000052class MgForm<bits<6> opcode, string asmstr>
53 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> {
54 bits<5> Ra;
55 bits<16> disp;
56 bits<5> Rb;
57
58 let Inst{25-21} = Ra;
59 let Inst{20-16} = Rb;
60 let Inst{15-0} = disp;
61}
62
63class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
64 bits<5> Ra;
65 bits<5> Rb;
66 bits<14> disp;
67
68 let Inst{25-21} = Ra;
69 let Inst{20-16} = Rb;
70 let Inst{15-14} = TB;
71 let Inst{13-0} = disp;
72}
73
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000074//3.3.2
75let isBranch = 1, isTerminator = 1 in
Andrew Lenharth02daecc2005-07-22 20:50:29 +000076class BForm<bits<6> opcode, string asmstr>
77 : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
78 bits<5> Ra;
79 bits<21> disp;
80
81 let Inst{25-21} = Ra;
82 let Inst{20-0} = disp;
83}
Andrew Lenharth5a990412005-10-22 22:06:58 +000084class BFormD<bits<6> opcode, string asmstr>
85 : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> {
86 bits<5> Ra = 31;
87 bits<21> disp;
88
89 let Inst{25-21} = Ra;
90 let Inst{20-0} = disp;
91}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000092
93let isBranch = 1, isTerminator = 1 in
94class FBForm<bits<6> opcode, string asmstr>
95 : InstAlpha<opcode, (ops FPRC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000096 bits<5> Ra;
97 bits<21> disp;
98
99 let Inst{25-21} = Ra;
100 let Inst{20-0} = disp;
101}
102
103//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000104class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000105 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000106 let Pattern = pattern;
107
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000108 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000109 bits<5> Ra;
110 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000111 bits<7> Function = fun;
112
113 let Inst{25-21} = Ra;
114 let Inst{20-16} = Rb;
115 let Inst{15-13} = 0;
116 let Inst{12} = 0;
117 let Inst{11-5} = Function;
118 let Inst{4-0} = Rc;
119}
120
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000121class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000122 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
123 let Pattern = pattern;
124
125 bits<5> Rc;
126 bits<5> Rb;
127 bits<7> Function = fun;
128
Andrew Lenharth5a990412005-10-22 22:06:58 +0000129 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000130 let Inst{20-16} = Rb;
131 let Inst{15-13} = 0;
132 let Inst{12} = 0;
133 let Inst{11-5} = Function;
134 let Inst{4-0} = Rc;
135}
136
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000137class OForm4<bits<6> opcode, bits<7> fun, string asmstr>
138 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000139 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000140 bits<5> Rb;
141 bits<5> Ra;
142 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000143
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000144 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000145 let Inst{25-21} = Ra;
146 let Inst{20-16} = Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000147 let Inst{15-13} = 0;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000148 let Inst{12} = 0;
149 let Inst{11-5} = Function;
150 let Inst{4-0} = Rc;
151}
152
153
Andrew Lenharth7b698672005-10-20 00:28:31 +0000154class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000155 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000156 let Pattern = pattern;
157
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000158 bits<5> Rc;
159 bits<5> Ra;
160 bits<8> LIT;
161 bits<7> Function = fun;
162
163 let Inst{25-21} = Ra;
164 let Inst{20-13} = LIT;
165 let Inst{12} = 1;
166 let Inst{11-5} = Function;
167 let Inst{4-0} = Rc;
168}
169
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000170class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
171 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000172 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000173 bits<8> LIT;
174 bits<5> Ra;
175 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000176
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000177 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000178 let Inst{25-21} = Ra;
179 let Inst{20-13} = LIT;
180 let Inst{12} = 1;
181 let Inst{11-5} = Function;
182 let Inst{4-0} = Rc;
183}
184
185//3.3.4
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000186class FPForm<bits<6> opcode, bits<11> fun, string asmstr>
187 : InstAlpha<opcode, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), asmstr> {
188 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000189 bits<5> Fa;
190 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000191 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000192
193 let Inst{25-21} = Fa;
194 let Inst{20-16} = Fb;
195 let Inst{15-5} = Function;
196 let Inst{4-0} = Fc;
197}
198
199class FPFormCM<bits<6> opcode, bits<11> fun, dag OL, string asmstr>
200 : InstAlpha<opcode, OL, asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000201 bits<5> Fc;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000202 bits<5> Fa;
203 bits<5> Fb;
204 bits<11> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000205
206 let Inst{25-21} = Fa;
207 let Inst{20-16} = Fb;
208 let Inst{15-5} = Function;
209 let Inst{4-0} = Fc;
210}
211
212//3.3.5
213class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
214 bits<26> Function;
215
216 let Inst{25-0} = Function;
217}
218
219
220// Pseudo instructions.
221class PseudoInstAlpha<dag OL, string nm> : InstAlpha<0, OL, nm> {
222}