1 //===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
20 def u8imm : Operand<i64>;
21 def s14imm : Operand<i64>;
22 def s16imm : Operand<i64>;
23 def s21imm : Operand<i64>;
24 def s64imm : Operand<i64>;
25 def u64imm : Operand<i64>;
27 //===----------------------------------------------------------------------===//
28 // Instruction format superclass
29 //===----------------------------------------------------------------------===//
30 // Alpha instruction baseline
31 class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
33 let Namespace = "Alpha";
34 let AsmString = asmstr;
41 class MForm<bits<6> opcode, bit load, string asmstr, list<dag> pattern, InstrItinClass itin>
42 : InstAlpha<opcode, asmstr, itin> {
43 let Pattern = pattern;
44 let canFoldAsLoad = load;
45 let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
53 let Inst{15-0} = disp;
55 class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
56 : InstAlpha<opcode, asmstr, itin> {
59 let OutOperandList = (outs GPRC:$RA);
60 let InOperandList = (ins);
65 class MfcPForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin>
66 : InstAlpha<opcode, asmstr, itin> {
67 let OutOperandList = (outs);
68 let InOperandList = (ins);
74 class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
75 : InstAlpha<opcode, asmstr, itin> {
80 let OutOperandList = (outs);
81 let InOperandList = OL;
86 let Inst{13-0} = disp;
88 class MbrpForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, list<dag> pattern, InstrItinClass itin>
89 : InstAlpha<opcode, asmstr, itin> {
95 let OutOperandList = (outs);
96 let InOperandList = OL;
100 let Inst{15-14} = TB;
101 let Inst{13-0} = disp;
105 def target : Operand<OtherVT> {}
107 let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in {
108 class BFormN<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
109 : InstAlpha<opcode, asmstr, itin> {
110 let OutOperandList = (outs);
111 let InOperandList = OL;
112 bits<64> Opc; //dummy
116 let Inst{25-21} = Ra;
117 let Inst{20-0} = disp;
121 let isBranch = 1, isTerminator = 1 in
122 class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin>
123 : InstAlpha<opcode, asmstr, itin> {
124 let Pattern = pattern;
125 let OutOperandList = (outs);
126 let InOperandList = (ins target:$DISP);
130 let Inst{25-21} = Ra;
131 let Inst{20-0} = disp;
135 class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
136 : InstAlpha<opcode, asmstr, itin> {
137 let Pattern = pattern;
138 let OutOperandList = (outs GPRC:$RC);
139 let InOperandList = (ins GPRC:$RA, GPRC:$RB);
144 bits<7> Function = fun;
146 let Inst{25-21} = Ra;
147 let Inst{20-16} = Rb;
150 let Inst{11-5} = Function;
154 class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
155 : InstAlpha<opcode, asmstr, itin> {
156 let Pattern = pattern;
157 let OutOperandList = (outs GPRC:$RC);
158 let InOperandList = (ins GPRC:$RB);
162 bits<7> Function = fun;
164 let Inst{25-21} = 31;
165 let Inst{20-16} = Rb;
168 let Inst{11-5} = Function;
172 class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
173 : InstAlpha<opcode, asmstr, itin> {
174 let Pattern = pattern;
175 let OutOperandList = (outs GPRC:$RDEST);
176 let InOperandList = (ins GPRC:$RCOND, GPRC:$RTRUE, GPRC:$RFALSE);
177 let Constraints = "$RFALSE = $RDEST";
178 let DisableEncoding = "$RFALSE";
183 bits<7> Function = fun;
185 // let Constraints = "$RFALSE = $RDEST";
186 let Inst{25-21} = Ra;
187 let Inst{20-16} = Rb;
190 let Inst{11-5} = Function;
195 class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
196 : InstAlpha<opcode, asmstr, itin> {
197 let Pattern = pattern;
198 let OutOperandList = (outs GPRC:$RC);
199 let InOperandList = (ins GPRC:$RA, u8imm:$L);
204 bits<7> Function = fun;
206 let Inst{25-21} = Ra;
207 let Inst{20-13} = LIT;
209 let Inst{11-5} = Function;
213 class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
214 : InstAlpha<opcode, asmstr, itin> {
215 let Pattern = pattern;
216 let OutOperandList = (outs GPRC:$RDEST);
217 let InOperandList = (ins GPRC:$RCOND, s64imm:$RTRUE, GPRC:$RFALSE);
218 let Constraints = "$RFALSE = $RDEST";
219 let DisableEncoding = "$RFALSE";
224 bits<7> Function = fun;
226 // let Constraints = "$RFALSE = $RDEST";
227 let Inst{25-21} = Ra;
228 let Inst{20-13} = LIT;
230 let Inst{11-5} = Function;
235 class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin>
236 : InstAlpha<opcode, asmstr, itin> {
237 let Pattern = pattern;
242 bits<11> Function = fun;
244 let Inst{25-21} = Fa;
245 let Inst{20-16} = Fb;
246 let Inst{15-5} = Function;
251 class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
252 : InstAlpha<opcode, asmstr, itin> {
253 let OutOperandList = (outs);
254 let InOperandList = OL;
257 let Inst{25-0} = Function;
261 // Pseudo instructions.
262 class PseudoInstAlpha<dag OOL, dag IOL, string nm, list<dag> pattern, InstrItinClass itin>
263 : InstAlpha<0, nm, itin> {
264 let OutOperandList = OOL;
265 let InOperandList = IOL;
266 let Pattern = pattern;