xref: /freebsd/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchLSXInstrFormats.td (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric// LoongArchLSXInstrFormats.td - LoongArch LSX Instr Formats -*- tablegen -*-=//
2*06c3fb27SDimitry Andric//
3*06c3fb27SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*06c3fb27SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*06c3fb27SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*06c3fb27SDimitry Andric//
7*06c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
8*06c3fb27SDimitry Andric
9*06c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
10*06c3fb27SDimitry Andric//  Describe LoongArch LSX instructions format
11*06c3fb27SDimitry Andric//
12*06c3fb27SDimitry Andric//  opcode       - operation code.
13*06c3fb27SDimitry Andric//  vd/rd/cd     - destination register operand.
14*06c3fb27SDimitry Andric//  {r/v}{j/k}   - source register operand.
15*06c3fb27SDimitry Andric//  immN         - immediate data operand.
16*06c3fb27SDimitry Andric//
17*06c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
18*06c3fb27SDimitry Andric
19*06c3fb27SDimitry Andric// 1RI13-type
20*06c3fb27SDimitry Andric// <opcode | I13 | vd>
21*06c3fb27SDimitry Andricclass Fmt1RI13_VI<bits<32> op, dag outs, dag ins, string opnstr,
22*06c3fb27SDimitry Andric                  list<dag> pattern = []>
23*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
24*06c3fb27SDimitry Andric  bits<13> imm13;
25*06c3fb27SDimitry Andric  bits<5> vd;
26*06c3fb27SDimitry Andric
27*06c3fb27SDimitry Andric  let Inst{31-0} = op;
28*06c3fb27SDimitry Andric  let Inst{17-5} = imm13;
29*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
30*06c3fb27SDimitry Andric}
31*06c3fb27SDimitry Andric
32*06c3fb27SDimitry Andric// 2R-type
33*06c3fb27SDimitry Andric// <opcode | vj | vd>
34*06c3fb27SDimitry Andricclass Fmt2R_VV<bits<32> op, dag outs, dag ins, string opnstr,
35*06c3fb27SDimitry Andric               list<dag> pattern = []>
36*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
37*06c3fb27SDimitry Andric  bits<5> vj;
38*06c3fb27SDimitry Andric  bits<5> vd;
39*06c3fb27SDimitry Andric
40*06c3fb27SDimitry Andric  let Inst{31-0} = op;
41*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
42*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
43*06c3fb27SDimitry Andric}
44*06c3fb27SDimitry Andric
45*06c3fb27SDimitry Andric// <opcode | rj | vd>
46*06c3fb27SDimitry Andricclass Fmt2R_VR<bits<32> op, dag outs, dag ins, string opnstr,
47*06c3fb27SDimitry Andric               list<dag> pattern = []>
48*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
49*06c3fb27SDimitry Andric  bits<5> rj;
50*06c3fb27SDimitry Andric  bits<5> vd;
51*06c3fb27SDimitry Andric
52*06c3fb27SDimitry Andric  let Inst{31-0} = op;
53*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
54*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
55*06c3fb27SDimitry Andric}
56*06c3fb27SDimitry Andric
57*06c3fb27SDimitry Andric// <opcode | vj | cd>
58*06c3fb27SDimitry Andricclass Fmt2R_CV<bits<32> op, dag outs, dag ins, string opnstr,
59*06c3fb27SDimitry Andric               list<dag> pattern = []>
60*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
61*06c3fb27SDimitry Andric  bits<5> vj;
62*06c3fb27SDimitry Andric  bits<3> cd;
63*06c3fb27SDimitry Andric
64*06c3fb27SDimitry Andric  let Inst{31-0} = op;
65*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
66*06c3fb27SDimitry Andric  let Inst{2-0} = cd;
67*06c3fb27SDimitry Andric}
68*06c3fb27SDimitry Andric
69*06c3fb27SDimitry Andric// 2RI1-type
70*06c3fb27SDimitry Andric// <opcode | I1 | vj | vd>
71*06c3fb27SDimitry Andricclass Fmt2RI1_VVI<bits<32> op, dag outs, dag ins, string opnstr,
72*06c3fb27SDimitry Andric                  list<dag> pattern = []>
73*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
74*06c3fb27SDimitry Andric  bits<1> imm1;
75*06c3fb27SDimitry Andric  bits<5> vj;
76*06c3fb27SDimitry Andric  bits<5> vd;
77*06c3fb27SDimitry Andric
78*06c3fb27SDimitry Andric  let Inst{31-0} = op;
79*06c3fb27SDimitry Andric  let Inst{10} = imm1;
80*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
81*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
82*06c3fb27SDimitry Andric}
83*06c3fb27SDimitry Andric
84*06c3fb27SDimitry Andric// <opcode | I1 | rj | vd>
85*06c3fb27SDimitry Andricclass Fmt2RI1_VRI<bits<32> op, dag outs, dag ins, string opnstr,
86*06c3fb27SDimitry Andric                  list<dag> pattern = []>
87*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
88*06c3fb27SDimitry Andric  bits<1> imm1;
89*06c3fb27SDimitry Andric  bits<5> rj;
90*06c3fb27SDimitry Andric  bits<5> vd;
91*06c3fb27SDimitry Andric
92*06c3fb27SDimitry Andric  let Inst{31-0} = op;
93*06c3fb27SDimitry Andric  let Inst{10} = imm1;
94*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
95*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
96*06c3fb27SDimitry Andric}
97*06c3fb27SDimitry Andric
98*06c3fb27SDimitry Andric// <opcode | I1 | vj | rd>
99*06c3fb27SDimitry Andricclass Fmt2RI1_RVI<bits<32> op, dag outs, dag ins, string opnstr,
100*06c3fb27SDimitry Andric                  list<dag> pattern = []>
101*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
102*06c3fb27SDimitry Andric  bits<1> imm1;
103*06c3fb27SDimitry Andric  bits<5> vj;
104*06c3fb27SDimitry Andric  bits<5> rd;
105*06c3fb27SDimitry Andric
106*06c3fb27SDimitry Andric  let Inst{31-0} = op;
107*06c3fb27SDimitry Andric  let Inst{10} = imm1;
108*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
109*06c3fb27SDimitry Andric  let Inst{4-0} = rd;
110*06c3fb27SDimitry Andric}
111*06c3fb27SDimitry Andric
112*06c3fb27SDimitry Andric// 2RI2-type
113*06c3fb27SDimitry Andric// <opcode | I2 | vj | vd>
114*06c3fb27SDimitry Andricclass Fmt2RI2_VVI<bits<32> op, dag outs, dag ins, string opnstr,
115*06c3fb27SDimitry Andric                  list<dag> pattern = []>
116*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
117*06c3fb27SDimitry Andric  bits<2> imm2;
118*06c3fb27SDimitry Andric  bits<5> vj;
119*06c3fb27SDimitry Andric  bits<5> vd;
120*06c3fb27SDimitry Andric
121*06c3fb27SDimitry Andric  let Inst{31-0} = op;
122*06c3fb27SDimitry Andric  let Inst{11-10} = imm2;
123*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
124*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
125*06c3fb27SDimitry Andric}
126*06c3fb27SDimitry Andric
127*06c3fb27SDimitry Andric// <opcode | I2 | rj | vd>
128*06c3fb27SDimitry Andricclass Fmt2RI2_VRI<bits<32> op, dag outs, dag ins, string opnstr,
129*06c3fb27SDimitry Andric                  list<dag> pattern = []>
130*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
131*06c3fb27SDimitry Andric  bits<2> imm2;
132*06c3fb27SDimitry Andric  bits<5> rj;
133*06c3fb27SDimitry Andric  bits<5> vd;
134*06c3fb27SDimitry Andric
135*06c3fb27SDimitry Andric  let Inst{31-0} = op;
136*06c3fb27SDimitry Andric  let Inst{11-10} = imm2;
137*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
138*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
139*06c3fb27SDimitry Andric}
140*06c3fb27SDimitry Andric
141*06c3fb27SDimitry Andric// <opcode | I2 | vj | rd>
142*06c3fb27SDimitry Andricclass Fmt2RI2_RVI<bits<32> op, dag outs, dag ins, string opnstr,
143*06c3fb27SDimitry Andric                  list<dag> pattern = []>
144*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
145*06c3fb27SDimitry Andric  bits<2> imm2;
146*06c3fb27SDimitry Andric  bits<5> vj;
147*06c3fb27SDimitry Andric  bits<5> rd;
148*06c3fb27SDimitry Andric
149*06c3fb27SDimitry Andric  let Inst{31-0} = op;
150*06c3fb27SDimitry Andric  let Inst{11-10} = imm2;
151*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
152*06c3fb27SDimitry Andric  let Inst{4-0} = rd;
153*06c3fb27SDimitry Andric}
154*06c3fb27SDimitry Andric
155*06c3fb27SDimitry Andric// 2RI3-type
156*06c3fb27SDimitry Andric// <opcode | I3 | vj | vd>
157*06c3fb27SDimitry Andricclass Fmt2RI3_VVI<bits<32> op, dag outs, dag ins, string opnstr,
158*06c3fb27SDimitry Andric                  list<dag> pattern = []>
159*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
160*06c3fb27SDimitry Andric  bits<3> imm3;
161*06c3fb27SDimitry Andric  bits<5> vj;
162*06c3fb27SDimitry Andric  bits<5> vd;
163*06c3fb27SDimitry Andric
164*06c3fb27SDimitry Andric  let Inst{31-0} = op;
165*06c3fb27SDimitry Andric  let Inst{12-10} = imm3;
166*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
167*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
168*06c3fb27SDimitry Andric}
169*06c3fb27SDimitry Andric
170*06c3fb27SDimitry Andric// <opcode | I3 | rj | vd>
171*06c3fb27SDimitry Andricclass Fmt2RI3_VRI<bits<32> op, dag outs, dag ins, string opnstr,
172*06c3fb27SDimitry Andric                  list<dag> pattern = []>
173*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
174*06c3fb27SDimitry Andric  bits<3> imm3;
175*06c3fb27SDimitry Andric  bits<5> rj;
176*06c3fb27SDimitry Andric  bits<5> vd;
177*06c3fb27SDimitry Andric
178*06c3fb27SDimitry Andric  let Inst{31-0} = op;
179*06c3fb27SDimitry Andric  let Inst{12-10} = imm3;
180*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
181*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
182*06c3fb27SDimitry Andric}
183*06c3fb27SDimitry Andric
184*06c3fb27SDimitry Andric// <opcode | I3 | vj | rd>
185*06c3fb27SDimitry Andricclass Fmt2RI3_RVI<bits<32> op, dag outs, dag ins, string opnstr,
186*06c3fb27SDimitry Andric                  list<dag> pattern = []>
187*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
188*06c3fb27SDimitry Andric  bits<3> imm3;
189*06c3fb27SDimitry Andric  bits<5> vj;
190*06c3fb27SDimitry Andric  bits<5> rd;
191*06c3fb27SDimitry Andric
192*06c3fb27SDimitry Andric  let Inst{31-0} = op;
193*06c3fb27SDimitry Andric  let Inst{12-10} = imm3;
194*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
195*06c3fb27SDimitry Andric  let Inst{4-0} = rd;
196*06c3fb27SDimitry Andric}
197*06c3fb27SDimitry Andric
198*06c3fb27SDimitry Andric// 2RI4-type
199*06c3fb27SDimitry Andric// <opcode | I4 | vj | vd>
200*06c3fb27SDimitry Andricclass Fmt2RI4_VVI<bits<32> op, dag outs, dag ins, string opnstr,
201*06c3fb27SDimitry Andric                  list<dag> pattern = []>
202*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
203*06c3fb27SDimitry Andric  bits<4> imm4;
204*06c3fb27SDimitry Andric  bits<5> vj;
205*06c3fb27SDimitry Andric  bits<5> vd;
206*06c3fb27SDimitry Andric
207*06c3fb27SDimitry Andric  let Inst{31-0} = op;
208*06c3fb27SDimitry Andric  let Inst{13-10} = imm4;
209*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
210*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
211*06c3fb27SDimitry Andric}
212*06c3fb27SDimitry Andric
213*06c3fb27SDimitry Andric// <opcode | I4 | rj | vd>
214*06c3fb27SDimitry Andricclass Fmt2RI4_VRI<bits<32> op, dag outs, dag ins, string opnstr,
215*06c3fb27SDimitry Andric                  list<dag> pattern = []>
216*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
217*06c3fb27SDimitry Andric  bits<4> imm4;
218*06c3fb27SDimitry Andric  bits<5> rj;
219*06c3fb27SDimitry Andric  bits<5> vd;
220*06c3fb27SDimitry Andric
221*06c3fb27SDimitry Andric  let Inst{31-0} = op;
222*06c3fb27SDimitry Andric  let Inst{13-10} = imm4;
223*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
224*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
225*06c3fb27SDimitry Andric}
226*06c3fb27SDimitry Andric
227*06c3fb27SDimitry Andric// <opcode | I4 | vj | rd>
228*06c3fb27SDimitry Andricclass Fmt2RI4_RVI<bits<32> op, dag outs, dag ins, string opnstr,
229*06c3fb27SDimitry Andric                  list<dag> pattern = []>
230*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
231*06c3fb27SDimitry Andric  bits<4> imm4;
232*06c3fb27SDimitry Andric  bits<5> vj;
233*06c3fb27SDimitry Andric  bits<5> rd;
234*06c3fb27SDimitry Andric
235*06c3fb27SDimitry Andric  let Inst{31-0} = op;
236*06c3fb27SDimitry Andric  let Inst{13-10} = imm4;
237*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
238*06c3fb27SDimitry Andric  let Inst{4-0} = rd;
239*06c3fb27SDimitry Andric}
240*06c3fb27SDimitry Andric
241*06c3fb27SDimitry Andric// 2RI5-type
242*06c3fb27SDimitry Andric// <opcode | I5 | vj | vd>
243*06c3fb27SDimitry Andricclass Fmt2RI5_VVI<bits<32> op, dag outs, dag ins, string opnstr,
244*06c3fb27SDimitry Andric                  list<dag> pattern = []>
245*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
246*06c3fb27SDimitry Andric  bits<5> imm5;
247*06c3fb27SDimitry Andric  bits<5> vj;
248*06c3fb27SDimitry Andric  bits<5> vd;
249*06c3fb27SDimitry Andric
250*06c3fb27SDimitry Andric  let Inst{31-0} = op;
251*06c3fb27SDimitry Andric  let Inst{14-10} = imm5;
252*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
253*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
254*06c3fb27SDimitry Andric}
255*06c3fb27SDimitry Andric
256*06c3fb27SDimitry Andric// 2RI6-type
257*06c3fb27SDimitry Andric// <opcode | I6 | vj | vd>
258*06c3fb27SDimitry Andricclass Fmt2RI6_VVI<bits<32> op, dag outs, dag ins, string opnstr,
259*06c3fb27SDimitry Andric                  list<dag> pattern = []>
260*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
261*06c3fb27SDimitry Andric  bits<6> imm6;
262*06c3fb27SDimitry Andric  bits<5> vj;
263*06c3fb27SDimitry Andric  bits<5> vd;
264*06c3fb27SDimitry Andric
265*06c3fb27SDimitry Andric  let Inst{31-0} = op;
266*06c3fb27SDimitry Andric  let Inst{15-10} = imm6;
267*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
268*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
269*06c3fb27SDimitry Andric}
270*06c3fb27SDimitry Andric
271*06c3fb27SDimitry Andric// 2RI7-type
272*06c3fb27SDimitry Andric// <opcode | I7 | vj | vd>
273*06c3fb27SDimitry Andricclass Fmt2RI7_VVI<bits<32> op, dag outs, dag ins, string opnstr,
274*06c3fb27SDimitry Andric                  list<dag> pattern = []>
275*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
276*06c3fb27SDimitry Andric  bits<7> imm7;
277*06c3fb27SDimitry Andric  bits<5> vj;
278*06c3fb27SDimitry Andric  bits<5> vd;
279*06c3fb27SDimitry Andric
280*06c3fb27SDimitry Andric  let Inst{31-0} = op;
281*06c3fb27SDimitry Andric  let Inst{16-10} = imm7;
282*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
283*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
284*06c3fb27SDimitry Andric}
285*06c3fb27SDimitry Andric
286*06c3fb27SDimitry Andric// 2RI8-type
287*06c3fb27SDimitry Andric// <opcode | I8 | vj | vd>
288*06c3fb27SDimitry Andricclass Fmt2RI8_VVI<bits<32> op, dag outs, dag ins, string opnstr,
289*06c3fb27SDimitry Andric                  list<dag> pattern = []>
290*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
291*06c3fb27SDimitry Andric  bits<8> imm8;
292*06c3fb27SDimitry Andric  bits<5> vj;
293*06c3fb27SDimitry Andric  bits<5> vd;
294*06c3fb27SDimitry Andric
295*06c3fb27SDimitry Andric  let Inst{31-0} = op;
296*06c3fb27SDimitry Andric  let Inst{17-10} = imm8;
297*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
298*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
299*06c3fb27SDimitry Andric}
300*06c3fb27SDimitry Andric
301*06c3fb27SDimitry Andric// 2RI8I1-type
302*06c3fb27SDimitry Andric// <opcode | I1 | I8 | vj | vd>
303*06c3fb27SDimitry Andricclass Fmt2RI8I1_VRII<bits<32> op, dag outs, dag ins, string opnstr,
304*06c3fb27SDimitry Andric                     list<dag> pattern = []>
305*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
306*06c3fb27SDimitry Andric  bits<1> imm1;
307*06c3fb27SDimitry Andric  bits<8> imm8;
308*06c3fb27SDimitry Andric  bits<5> rj;
309*06c3fb27SDimitry Andric  bits<5> vd;
310*06c3fb27SDimitry Andric
311*06c3fb27SDimitry Andric  let Inst{31-0} = op;
312*06c3fb27SDimitry Andric  let Inst{18} = imm1;
313*06c3fb27SDimitry Andric  let Inst{17-10} = imm8;
314*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
315*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
316*06c3fb27SDimitry Andric}
317*06c3fb27SDimitry Andric
318*06c3fb27SDimitry Andric// 2RI8I2-type
319*06c3fb27SDimitry Andric// <opcode | I2 | I8 | vj | vd>
320*06c3fb27SDimitry Andricclass Fmt2RI8I2_VRII<bits<32> op, dag outs, dag ins, string opnstr,
321*06c3fb27SDimitry Andric                     list<dag> pattern = []>
322*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
323*06c3fb27SDimitry Andric  bits<2> imm2;
324*06c3fb27SDimitry Andric  bits<8> imm8;
325*06c3fb27SDimitry Andric  bits<5> rj;
326*06c3fb27SDimitry Andric  bits<5> vd;
327*06c3fb27SDimitry Andric
328*06c3fb27SDimitry Andric  let Inst{31-0} = op;
329*06c3fb27SDimitry Andric  let Inst{19-18} = imm2;
330*06c3fb27SDimitry Andric  let Inst{17-10} = imm8;
331*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
332*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
333*06c3fb27SDimitry Andric}
334*06c3fb27SDimitry Andric
335*06c3fb27SDimitry Andric// 2RI8I3-type
336*06c3fb27SDimitry Andric// <opcode | I3 | I8 | vj | vd>
337*06c3fb27SDimitry Andricclass Fmt2RI8I3_VRII<bits<32> op, dag outs, dag ins, string opnstr,
338*06c3fb27SDimitry Andric                     list<dag> pattern = []>
339*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
340*06c3fb27SDimitry Andric  bits<3> imm3;
341*06c3fb27SDimitry Andric  bits<8> imm8;
342*06c3fb27SDimitry Andric  bits<5> rj;
343*06c3fb27SDimitry Andric  bits<5> vd;
344*06c3fb27SDimitry Andric
345*06c3fb27SDimitry Andric  let Inst{31-0} = op;
346*06c3fb27SDimitry Andric  let Inst{20-18} = imm3;
347*06c3fb27SDimitry Andric  let Inst{17-10} = imm8;
348*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
349*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
350*06c3fb27SDimitry Andric}
351*06c3fb27SDimitry Andric
352*06c3fb27SDimitry Andric// 2RI8I4-type
353*06c3fb27SDimitry Andric// <opcode | I4 | I8 | vj | vd>
354*06c3fb27SDimitry Andricclass Fmt2RI8I4_VRII<bits<32> op, dag outs, dag ins, string opnstr,
355*06c3fb27SDimitry Andric                     list<dag> pattern = []>
356*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
357*06c3fb27SDimitry Andric  bits<4> imm4;
358*06c3fb27SDimitry Andric  bits<8> imm8;
359*06c3fb27SDimitry Andric  bits<5> rj;
360*06c3fb27SDimitry Andric  bits<5> vd;
361*06c3fb27SDimitry Andric
362*06c3fb27SDimitry Andric  let Inst{31-0} = op;
363*06c3fb27SDimitry Andric  let Inst{21-18} = imm4;
364*06c3fb27SDimitry Andric  let Inst{17-10} = imm8;
365*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
366*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
367*06c3fb27SDimitry Andric}
368*06c3fb27SDimitry Andric// 2RI9-type
369*06c3fb27SDimitry Andric// <opcode | I9 | rj | vd>
370*06c3fb27SDimitry Andricclass Fmt2RI9_VRI<bits<32> op, dag outs, dag ins, string opnstr,
371*06c3fb27SDimitry Andric                  list<dag> pattern = []>
372*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
373*06c3fb27SDimitry Andric  bits<9> imm9;
374*06c3fb27SDimitry Andric  bits<5> rj;
375*06c3fb27SDimitry Andric  bits<5> vd;
376*06c3fb27SDimitry Andric
377*06c3fb27SDimitry Andric  let Inst{31-0} = op;
378*06c3fb27SDimitry Andric  let Inst{18-10} = imm9;
379*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
380*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
381*06c3fb27SDimitry Andric}
382*06c3fb27SDimitry Andric
383*06c3fb27SDimitry Andric// 2RI10-type
384*06c3fb27SDimitry Andric// <opcode | I10 | rj | vd>
385*06c3fb27SDimitry Andricclass Fmt2RI10_VRI<bits<32> op, dag outs, dag ins, string opnstr,
386*06c3fb27SDimitry Andric                  list<dag> pattern = []>
387*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
388*06c3fb27SDimitry Andric  bits<10> imm10;
389*06c3fb27SDimitry Andric  bits<5> rj;
390*06c3fb27SDimitry Andric  bits<5> vd;
391*06c3fb27SDimitry Andric
392*06c3fb27SDimitry Andric  let Inst{31-0} = op;
393*06c3fb27SDimitry Andric  let Inst{19-10} = imm10;
394*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
395*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
396*06c3fb27SDimitry Andric}
397*06c3fb27SDimitry Andric
398*06c3fb27SDimitry Andric// 2RI11-type
399*06c3fb27SDimitry Andric// <opcode | I11 | rj | vd>
400*06c3fb27SDimitry Andricclass Fmt2RI11_VRI<bits<32> op, dag outs, dag ins, string opnstr,
401*06c3fb27SDimitry Andric                  list<dag> pattern = []>
402*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
403*06c3fb27SDimitry Andric  bits<11> imm11;
404*06c3fb27SDimitry Andric  bits<5> rj;
405*06c3fb27SDimitry Andric  bits<5> vd;
406*06c3fb27SDimitry Andric
407*06c3fb27SDimitry Andric  let Inst{31-0} = op;
408*06c3fb27SDimitry Andric  let Inst{20-10} = imm11;
409*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
410*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
411*06c3fb27SDimitry Andric}
412*06c3fb27SDimitry Andric
413*06c3fb27SDimitry Andric// 2RI12-type
414*06c3fb27SDimitry Andric// <opcode | I12 | rj | vd>
415*06c3fb27SDimitry Andricclass Fmt2RI12_VRI<bits<32> op, dag outs, dag ins, string opnstr,
416*06c3fb27SDimitry Andric                  list<dag> pattern = []>
417*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
418*06c3fb27SDimitry Andric  bits<12> imm12;
419*06c3fb27SDimitry Andric  bits<5> rj;
420*06c3fb27SDimitry Andric  bits<5> vd;
421*06c3fb27SDimitry Andric
422*06c3fb27SDimitry Andric  let Inst{31-0} = op;
423*06c3fb27SDimitry Andric  let Inst{21-10} = imm12;
424*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
425*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
426*06c3fb27SDimitry Andric}
427*06c3fb27SDimitry Andric
428*06c3fb27SDimitry Andric// 3R-type
429*06c3fb27SDimitry Andric// <opcode | vk | vj | vd>
430*06c3fb27SDimitry Andricclass Fmt3R_VVV<bits<32> op, dag outs, dag ins, string opnstr,
431*06c3fb27SDimitry Andric                list<dag> pattern = []>
432*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
433*06c3fb27SDimitry Andric  bits<5> vk;
434*06c3fb27SDimitry Andric  bits<5> vj;
435*06c3fb27SDimitry Andric  bits<5> vd;
436*06c3fb27SDimitry Andric
437*06c3fb27SDimitry Andric  let Inst{31-0} = op;
438*06c3fb27SDimitry Andric  let Inst{14-10} = vk;
439*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
440*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
441*06c3fb27SDimitry Andric}
442*06c3fb27SDimitry Andric
443*06c3fb27SDimitry Andric// <opcode | rk | vj | vd>
444*06c3fb27SDimitry Andricclass Fmt3R_VVR<bits<32> op, dag outs, dag ins, string opnstr,
445*06c3fb27SDimitry Andric                list<dag> pattern = []>
446*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
447*06c3fb27SDimitry Andric  bits<5> rk;
448*06c3fb27SDimitry Andric  bits<5> vj;
449*06c3fb27SDimitry Andric  bits<5> vd;
450*06c3fb27SDimitry Andric
451*06c3fb27SDimitry Andric  let Inst{31-0} = op;
452*06c3fb27SDimitry Andric  let Inst{14-10} = rk;
453*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
454*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
455*06c3fb27SDimitry Andric}
456*06c3fb27SDimitry Andric
457*06c3fb27SDimitry Andric// <opcode | rk | rj | vd>
458*06c3fb27SDimitry Andricclass Fmt3R_VRR<bits<32> op, dag outs, dag ins, string opnstr,
459*06c3fb27SDimitry Andric                list<dag> pattern = []>
460*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
461*06c3fb27SDimitry Andric  bits<5> rk;
462*06c3fb27SDimitry Andric  bits<5> rj;
463*06c3fb27SDimitry Andric  bits<5> vd;
464*06c3fb27SDimitry Andric
465*06c3fb27SDimitry Andric  let Inst{31-0} = op;
466*06c3fb27SDimitry Andric  let Inst{14-10} = rk;
467*06c3fb27SDimitry Andric  let Inst{9-5} = rj;
468*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
469*06c3fb27SDimitry Andric}
470*06c3fb27SDimitry Andric
471*06c3fb27SDimitry Andric// 4R-type
472*06c3fb27SDimitry Andric// <opcode | va | vk | vj | vd>
473*06c3fb27SDimitry Andricclass Fmt4R_VVVV<bits<32> op, dag outs, dag ins, string opnstr,
474*06c3fb27SDimitry Andric                 list<dag> pattern = []>
475*06c3fb27SDimitry Andric    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
476*06c3fb27SDimitry Andric  bits<5> va;
477*06c3fb27SDimitry Andric  bits<5> vk;
478*06c3fb27SDimitry Andric  bits<5> vj;
479*06c3fb27SDimitry Andric  bits<5> vd;
480*06c3fb27SDimitry Andric
481*06c3fb27SDimitry Andric  let Inst{31-0} = op;
482*06c3fb27SDimitry Andric  let Inst{19-15} = va;
483*06c3fb27SDimitry Andric  let Inst{14-10} = vk;
484*06c3fb27SDimitry Andric  let Inst{9-5} = vj;
485*06c3fb27SDimitry Andric  let Inst{4-0} = vd;
486*06c3fb27SDimitry Andric}
487