1 // LoongArchLASXInstrFormats.td - LoongArch LASX Instr Formats - tablegen -*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
10 // Describe LoongArch LASX instructions format
12 // opcode - operation code.
13 // xd/rd/cd - destination register operand.
14 // {r/x}{j/k} - source register operand.
15 // immN - immediate data operand.
17 //===----------------------------------------------------------------------===//
20 // <opcode | I13 | xd>
21 class Fmt1RI13_XI<bits<32> op, dag outs, dag ins, string opnstr,
22 list<dag> pattern = []>
23 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
28 let Inst{17-5} = imm13;
34 class Fmt2R_XX<bits<32> op, dag outs, dag ins, string opnstr,
35 list<dag> pattern = []>
36 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
46 class Fmt2R_XR<bits<32> op, dag outs, dag ins, string opnstr,
47 list<dag> pattern = []>
48 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
58 class Fmt2R_CX<bits<32> op, dag outs, dag ins, string opnstr,
59 list<dag> pattern = []>
60 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
70 // <opcode | I1 | xj | xd>
71 class Fmt2RI1_XXI<bits<32> op, dag outs, dag ins, string opnstr,
72 list<dag> pattern = []>
73 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
85 // <opcode | I2 | xj | xd>
86 class Fmt2RI2_XXI<bits<32> op, dag outs, dag ins, string opnstr,
87 list<dag> pattern = []>
88 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
94 let Inst{11-10} = imm2;
99 // <opcode | I2 | rj | xd>
100 class Fmt2RI2_XRI<bits<32> op, dag outs, dag ins, string opnstr,
101 list<dag> pattern = []>
102 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
108 let Inst{11-10} = imm2;
113 // <opcode | I2 | xj | rd>
114 class Fmt2RI2_RXI<bits<32> op, dag outs, dag ins, string opnstr,
115 list<dag> pattern = []>
116 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
122 let Inst{11-10} = imm2;
128 // <opcode | I3 | xj | xd>
129 class Fmt2RI3_XXI<bits<32> op, dag outs, dag ins, string opnstr,
130 list<dag> pattern = []>
131 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
137 let Inst{12-10} = imm3;
142 // <opcode | I3 | rj | xd>
143 class Fmt2RI3_XRI<bits<32> op, dag outs, dag ins, string opnstr,
144 list<dag> pattern = []>
145 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
151 let Inst{12-10} = imm3;
156 // <opcode | I3 | xj | rd>
157 class Fmt2RI3_RXI<bits<32> op, dag outs, dag ins, string opnstr,
158 list<dag> pattern = []>
159 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
165 let Inst{12-10} = imm3;
171 // <opcode | I4 | xj | xd>
172 class Fmt2RI4_XXI<bits<32> op, dag outs, dag ins, string opnstr,
173 list<dag> pattern = []>
174 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
180 let Inst{13-10} = imm4;
185 // <opcode | I4 | rj | xd>
186 class Fmt2RI4_XRI<bits<32> op, dag outs, dag ins, string opnstr,
187 list<dag> pattern = []>
188 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
194 let Inst{13-10} = imm4;
199 // <opcode | I4 | xj | rd>
200 class Fmt2RI4_RXI<bits<32> op, dag outs, dag ins, string opnstr,
201 list<dag> pattern = []>
202 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
208 let Inst{13-10} = imm4;
214 // <opcode | I5 | xj | xd>
215 class Fmt2RI5_XXI<bits<32> op, dag outs, dag ins, string opnstr,
216 list<dag> pattern = []>
217 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
223 let Inst{14-10} = imm5;
229 // <opcode | I6 | xj | xd>
230 class Fmt2RI6_XXI<bits<32> op, dag outs, dag ins, string opnstr,
231 list<dag> pattern = []>
232 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
238 let Inst{15-10} = imm6;
244 // <opcode | I7 | xj | xd>
245 class Fmt2RI7_XXI<bits<32> op, dag outs, dag ins, string opnstr,
246 list<dag> pattern = []>
247 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
253 let Inst{16-10} = imm7;
259 // <opcode | I8 | xj | xd>
260 class Fmt2RI8_XXI<bits<32> op, dag outs, dag ins, string opnstr,
261 list<dag> pattern = []>
262 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
268 let Inst{17-10} = imm8;
274 // <opcode | I2 | I8 | xj | xd>
275 class Fmt2RI8I2_XRII<bits<32> op, dag outs, dag ins, string opnstr,
276 list<dag> pattern = []>
277 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
284 let Inst{19-18} = imm2;
285 let Inst{17-10} = imm8;
291 // <opcode | I3 | I8 | xj | xd>
292 class Fmt2RI8I3_XRII<bits<32> op, dag outs, dag ins, string opnstr,
293 list<dag> pattern = []>
294 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
301 let Inst{20-18} = imm3;
302 let Inst{17-10} = imm8;
308 // <opcode | I4 | I8 | xj | xd>
309 class Fmt2RI8I4_XRII<bits<32> op, dag outs, dag ins, string opnstr,
310 list<dag> pattern = []>
311 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
318 let Inst{21-18} = imm4;
319 let Inst{17-10} = imm8;
325 // <opcode | I5 | I8 | xj | xd>
326 class Fmt2RI8I5_XRII<bits<32> op, dag outs, dag ins, string opnstr,
327 list<dag> pattern = []>
328 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
335 let Inst{22-18} = imm5;
336 let Inst{17-10} = imm8;
342 // <opcode | I9 | rj | xd>
343 class Fmt2RI9_XRI<bits<32> op, dag outs, dag ins, string opnstr,
344 list<dag> pattern = []>
345 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
351 let Inst{18-10} = imm9;
357 // <opcode | I10 | rj | xd>
358 class Fmt2RI10_XRI<bits<32> op, dag outs, dag ins, string opnstr,
359 list<dag> pattern = []>
360 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
366 let Inst{19-10} = imm10;
372 // <opcode | I11 | rj | xd>
373 class Fmt2RI11_XRI<bits<32> op, dag outs, dag ins, string opnstr,
374 list<dag> pattern = []>
375 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
381 let Inst{20-10} = imm11;
387 // <opcode | I12 | rj | xd>
388 class Fmt2RI12_XRI<bits<32> op, dag outs, dag ins, string opnstr,
389 list<dag> pattern = []>
390 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
396 let Inst{21-10} = imm12;
402 // <opcode | xk | xj | xd>
403 class Fmt3R_XXX<bits<32> op, dag outs, dag ins, string opnstr,
404 list<dag> pattern = []>
405 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
411 let Inst{14-10} = xk;
416 // <opcode | rk | xj | xd>
417 class Fmt3R_XXR<bits<32> op, dag outs, dag ins, string opnstr,
418 list<dag> pattern = []>
419 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
425 let Inst{14-10} = rk;
430 // <opcode | rk | rj | xd>
431 class Fmt3R_XRR<bits<32> op, dag outs, dag ins, string opnstr,
432 list<dag> pattern = []>
433 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
439 let Inst{14-10} = rk;
445 // <opcode | xa | xk | xj | xd>
446 class Fmt4R_XXXX<bits<32> op, dag outs, dag ins, string opnstr,
447 list<dag> pattern = []>
448 : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
455 let Inst{19-15} = xa;
456 let Inst{14-10} = xk;