blob: c34b624dcc344ecb00b672d16e2bd7eaa5f3600d [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 Lenharth02daecc2005-07-22 20:50:29 +000043class MForm<bits<6> opcode, string asmstr>
44 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000045 bits<5> Ra;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000046 bits<16> disp;
Andrew Lenharth02daecc2005-07-22 20:50:29 +000047 bits<5> Rb;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000048
49 let Inst{25-21} = Ra;
50 let Inst{20-16} = Rb;
51 let Inst{15-0} = disp;
52}
53
Andrew Lenharth02daecc2005-07-22 20:50:29 +000054class MgForm<bits<6> opcode, string asmstr>
55 : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> {
56 bits<5> Ra;
57 bits<16> disp;
58 bits<5> Rb;
59
60 let Inst{25-21} = Ra;
61 let Inst{20-16} = Rb;
62 let Inst{15-0} = disp;
63}
64
65class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
66 bits<5> Ra;
67 bits<5> Rb;
68 bits<14> disp;
69
70 let Inst{25-21} = Ra;
71 let Inst{20-16} = Rb;
72 let Inst{15-14} = TB;
73 let Inst{13-0} = disp;
74}
75
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000076//3.3.2
77let isBranch = 1, isTerminator = 1 in
Andrew Lenharth02daecc2005-07-22 20:50:29 +000078class BForm<bits<6> opcode, string asmstr>
79 : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
80 bits<5> Ra;
81 bits<21> disp;
82
83 let Inst{25-21} = Ra;
84 let Inst{20-0} = disp;
85}
Andrew Lenharth5a990412005-10-22 22:06:58 +000086class BFormD<bits<6> opcode, string asmstr>
87 : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> {
88 bits<5> Ra = 31;
89 bits<21> disp;
90
91 let Inst{25-21} = Ra;
92 let Inst{20-0} = disp;
93}
Andrew Lenharth02daecc2005-07-22 20:50:29 +000094
95let isBranch = 1, isTerminator = 1 in
96class FBForm<bits<6> opcode, string asmstr>
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +000097 : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000098 bits<5> Ra;
99 bits<21> disp;
100
101 let Inst{25-21} = Ra;
102 let Inst{20-0} = disp;
103}
104
105//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +0000106class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000107 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000108 let Pattern = pattern;
109
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000110 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000111 bits<5> Ra;
112 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000113 bits<7> Function = fun;
114
115 let Inst{25-21} = Ra;
116 let Inst{20-16} = Rb;
117 let Inst{15-13} = 0;
118 let Inst{12} = 0;
119 let Inst{11-5} = Function;
120 let Inst{4-0} = Rc;
121}
122
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000123class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000124 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
125 let Pattern = pattern;
126
127 bits<5> Rc;
128 bits<5> Rb;
129 bits<7> Function = fun;
130
Andrew Lenharth5a990412005-10-22 22:06:58 +0000131 let Inst{25-21} = 31;
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000132 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 OForm4<bits<6> opcode, bits<7> fun, string asmstr>
140 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000141 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000142 bits<5> Rb;
143 bits<5> Ra;
144 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000145
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000146 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000147 let Inst{25-21} = Ra;
148 let Inst{20-16} = Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000149 let Inst{15-13} = 0;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000150 let Inst{12} = 0;
151 let Inst{11-5} = Function;
152 let Inst{4-0} = Rc;
153}
154
155
Andrew Lenharth7b698672005-10-20 00:28:31 +0000156class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000157 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000158 let Pattern = pattern;
159
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000160 bits<5> Rc;
161 bits<5> Ra;
162 bits<8> LIT;
163 bits<7> Function = fun;
164
165 let Inst{25-21} = Ra;
166 let Inst{20-13} = LIT;
167 let Inst{12} = 1;
168 let Inst{11-5} = Function;
169 let Inst{4-0} = Rc;
170}
171
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000172class OForm4L<bits<6> opcode, bits<7> fun, string asmstr>
173 : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000174 bits<5> Rc;
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000175 bits<8> LIT;
176 bits<5> Ra;
177 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000178
Andrew Lenhartha6a23b52005-10-20 23:58:36 +0000179 let isTwoAddress = 1;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000180 let Inst{25-21} = Ra;
181 let Inst{20-13} = LIT;
182 let Inst{12} = 1;
183 let Inst{11-5} = Function;
184 let Inst{4-0} = Rc;
185}
186
187//3.3.4
Andrew Lenharth97a7fcf2005-11-09 19:17:08 +0000188class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern>
189 : InstAlphaAlt<opcode, asmstr> {
190 let Pattern = pattern;
191
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000192 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000193 bits<5> Fa;
194 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000195 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000196
197 let Inst{25-21} = Fa;
198 let Inst{20-16} = Fb;
199 let Inst{15-5} = Function;
200 let Inst{4-0} = Fc;
201}
202
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000203//3.3.5
204class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
205 bits<26> Function;
206
207 let Inst{25-0} = Function;
208}
209
210
211// Pseudo instructions.
212class PseudoInstAlpha<dag OL, string nm> : InstAlpha<0, OL, nm> {
213}