blob: fa56bf04da3d7bb13c7e8f42af14a3e25f5e592d [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}
84
85let isBranch = 1, isTerminator = 1 in
86class FBForm<bits<6> opcode, string asmstr>
87 : InstAlpha<opcode, (ops FPRC:$RA, s21imm:$DISP), asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000088 bits<5> Ra;
89 bits<21> disp;
90
91 let Inst{25-21} = Ra;
92 let Inst{20-0} = disp;
93}
94
95//3.3.3
Andrew Lenharth7b698672005-10-20 00:28:31 +000096class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +000097 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +000098 let Pattern = pattern;
99
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000100 bits<5> Rc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000101 bits<5> Ra;
102 bits<5> Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000103 bits<7> Function = fun;
104
105 let Inst{25-21} = Ra;
106 let Inst{20-16} = Rb;
107 let Inst{15-13} = 0;
108 let Inst{12} = 0;
109 let Inst{11-5} = Function;
110 let Inst{4-0} = Rc;
111}
112
Andrew Lenharthd4c0ed72005-10-20 19:39:24 +0000113class OFormT<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
114 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> {
115 let Pattern = pattern;
116
117 bits<5> Rc;
118 bits<5> Rb;
119 bits<7> Function = fun;
120
121 let Inst{25-21} = 0;
122 let Inst{20-16} = Rb;
123 let Inst{15-13} = 0;
124 let Inst{12} = 0;
125 let Inst{11-5} = Function;
126 let Inst{4-0} = Rc;
127}
128
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000129class OcmForm<bits<6> opcode, bits<7> fun, dag OL, string asmstr>
130 : InstAlpha<opcode, OL, asmstr> {
131 bits<5> Ra;
132 bits<5> Rb;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000133 bits<7> Function = fun;
134 bits<5> Rc;
135
136 let Inst{25-21} = Ra;
137 let Inst{20-16} = Rb;
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000138 let Inst{15-13} = 0;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000139 let Inst{12} = 0;
140 let Inst{11-5} = Function;
141 let Inst{4-0} = Rc;
142}
143
144
Andrew Lenharth7b698672005-10-20 00:28:31 +0000145class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern>
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000146 : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
Andrew Lenharth7b698672005-10-20 00:28:31 +0000147 let Pattern = pattern;
148
Andrew Lenharth02daecc2005-07-22 20:50:29 +0000149 bits<5> Rc;
150 bits<5> Ra;
151 bits<8> LIT;
152 bits<7> Function = fun;
153
154 let Inst{25-21} = Ra;
155 let Inst{20-13} = LIT;
156 let Inst{12} = 1;
157 let Inst{11-5} = Function;
158 let Inst{4-0} = Rc;
159}
160
161class OcmFormL<bits<6> opcode, bits<7> fun, dag OL, string asmstr>
162 : InstAlpha<opcode, OL, asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000163 bits<5> Ra;
164 bits<8> LIT;
Andrew Lenharth2f0f8452005-01-24 19:44:07 +0000165 bits<7> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000166 bits<5> Rc;
167
168 let Inst{25-21} = Ra;
169 let Inst{20-13} = LIT;
170 let Inst{12} = 1;
171 let Inst{11-5} = Function;
172 let Inst{4-0} = Rc;
173}
174
175//3.3.4
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000176class FPForm<bits<6> opcode, bits<11> fun, string asmstr>
177 : InstAlpha<opcode, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), asmstr> {
178 bits<5> Fc;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000179 bits<5> Fa;
180 bits<5> Fb;
Andrew Lenharth5ae5f812005-01-26 21:54:09 +0000181 bits<11> Function = fun;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000182
183 let Inst{25-21} = Fa;
184 let Inst{20-16} = Fb;
185 let Inst{15-5} = Function;
186 let Inst{4-0} = Fc;
187}
188
189class FPFormCM<bits<6> opcode, bits<11> fun, dag OL, string asmstr>
190 : InstAlpha<opcode, OL, asmstr> {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000191 bits<5> Fc;
Andrew Lenharth1ec48e82005-07-28 18:14:47 +0000192 bits<5> Fa;
193 bits<5> Fb;
194 bits<11> Function = fun;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +0000195
196 let Inst{25-21} = Fa;
197 let Inst{20-16} = Fb;
198 let Inst{15-5} = Function;
199 let Inst{4-0} = Fc;
200}
201
202//3.3.5
203class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
204 bits<26> Function;
205
206 let Inst{25-0} = Function;
207}
208
209
210// Pseudo instructions.
211class PseudoInstAlpha<dag OL, string nm> : InstAlpha<0, OL, nm> {
212}