File: LoongArchLASXInstrFormats.td

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (459 lines) | stat: -rw-r--r-- 11,503 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
// LoongArchLASXInstrFormats.td - LoongArch LASX Instr Formats - tablegen -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
//  Describe LoongArch LASX instructions format
//
//  opcode       - operation code.
//  xd/rd/cd     - destination register operand.
//  {r/x}{j/k}   - source register operand.
//  immN         - immediate data operand.
//
//===----------------------------------------------------------------------===//

// 1RI13-type
// <opcode | I13 | xd>
class Fmt1RI13_XI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<13> imm13;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{17-5} = imm13;
  let Inst{4-0} = xd;
}

// 2R-type
// <opcode | xj | xd>
class Fmt2R_XX<bits<32> op, dag outs, dag ins, string opnstr,
               list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | rj | xd>
class Fmt2R_XR<bits<32> op, dag outs, dag ins, string opnstr,
               list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// <opcode | xj | cd>
class Fmt2R_CX<bits<32> op, dag outs, dag ins, string opnstr,
               list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> xj;
  bits<3> cd;

  let Inst{31-0} = op;
  let Inst{9-5} = xj;
  let Inst{2-0} = cd;
}

// 2RI1-type
// <opcode | I1 | xj | xd>
class Fmt2RI1_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<1> imm1;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{10} = imm1;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// 2RI2-type
// <opcode | I2 | xj | xd>
class Fmt2RI2_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<2> imm2;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{11-10} = imm2;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | I2 | rj | xd>
class Fmt2RI2_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<2> imm2;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{11-10} = imm2;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// <opcode | I2 | xj | rd>
class Fmt2RI2_RXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<2> imm2;
  bits<5> xj;
  bits<5> rd;

  let Inst{31-0} = op;
  let Inst{11-10} = imm2;
  let Inst{9-5} = xj;
  let Inst{4-0} = rd;
}

// 2RI3-type
// <opcode | I3 | xj | xd>
class Fmt2RI3_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<3> imm3;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{12-10} = imm3;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | I3 | rj | xd>
class Fmt2RI3_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<3> imm3;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{12-10} = imm3;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// <opcode | I3 | xj | rd>
class Fmt2RI3_RXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<3> imm3;
  bits<5> xj;
  bits<5> rd;

  let Inst{31-0} = op;
  let Inst{12-10} = imm3;
  let Inst{9-5} = xj;
  let Inst{4-0} = rd;
}

// 2RI4-type
// <opcode | I4 | xj | xd>
class Fmt2RI4_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<4> imm4;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{13-10} = imm4;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | I4 | rj | xd>
class Fmt2RI4_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<4> imm4;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{13-10} = imm4;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// <opcode | I4 | xj | rd>
class Fmt2RI4_RXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<4> imm4;
  bits<5> xj;
  bits<5> rd;

  let Inst{31-0} = op;
  let Inst{13-10} = imm4;
  let Inst{9-5} = xj;
  let Inst{4-0} = rd;
}

// 2RI5-type
// <opcode | I5 | xj | xd>
class Fmt2RI5_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> imm5;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{14-10} = imm5;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// 2RI6-type
// <opcode | I6 | xj | xd>
class Fmt2RI6_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<6> imm6;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{15-10} = imm6;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// 2RI7-type
// <opcode | I7 | xj | xd>
class Fmt2RI7_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<7> imm7;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{16-10} = imm7;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// 2RI8-type
// <opcode | I8 | xj | xd>
class Fmt2RI8_XXI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<8> imm8;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{17-10} = imm8;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// 2RI8I2-type
// <opcode | I2 | I8 | xj | xd>
class Fmt2RI8I2_XRII<bits<32> op, dag outs, dag ins, string opnstr,
                     list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<2> imm2;
  bits<8> imm8;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{19-18} = imm2;
  let Inst{17-10} = imm8;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI8I3-type
// <opcode | I3 | I8 | xj | xd>
class Fmt2RI8I3_XRII<bits<32> op, dag outs, dag ins, string opnstr,
                     list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<3> imm3;
  bits<8> imm8;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{20-18} = imm3;
  let Inst{17-10} = imm8;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI8I4-type
// <opcode | I4 | I8 | xj | xd>
class Fmt2RI8I4_XRII<bits<32> op, dag outs, dag ins, string opnstr,
                     list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<4> imm4;
  bits<8> imm8;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{21-18} = imm4;
  let Inst{17-10} = imm8;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI8I5-type
// <opcode | I5 | I8 | xj | xd>
class Fmt2RI8I5_XRII<bits<32> op, dag outs, dag ins, string opnstr,
                     list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> imm5;
  bits<8> imm8;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{22-18} = imm5;
  let Inst{17-10} = imm8;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI9-type
// <opcode | I9 | rj | xd>
class Fmt2RI9_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<9> imm9;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{18-10} = imm9;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI10-type
// <opcode | I10 | rj | xd>
class Fmt2RI10_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<10> imm10;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{19-10} = imm10;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI11-type
// <opcode | I11 | rj | xd>
class Fmt2RI11_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<11> imm11;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{20-10} = imm11;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 2RI12-type
// <opcode | I12 | rj | xd>
class Fmt2RI12_XRI<bits<32> op, dag outs, dag ins, string opnstr,
                  list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<12> imm12;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{21-10} = imm12;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 3R-type
// <opcode | xk | xj | xd>
class Fmt3R_XXX<bits<32> op, dag outs, dag ins, string opnstr,
                list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> xk;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{14-10} = xk;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | rk | xj | xd>
class Fmt3R_XXR<bits<32> op, dag outs, dag ins, string opnstr,
                list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> rk;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{14-10} = rk;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}

// <opcode | rk | rj | xd>
class Fmt3R_XRR<bits<32> op, dag outs, dag ins, string opnstr,
                list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> rk;
  bits<5> rj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{14-10} = rk;
  let Inst{9-5} = rj;
  let Inst{4-0} = xd;
}

// 4R-type
// <opcode | xa | xk | xj | xd>
class Fmt4R_XXXX<bits<32> op, dag outs, dag ins, string opnstr,
                 list<dag> pattern = []>
    : LAInst<outs, ins, deriveInsnMnemonic<NAME>.ret, opnstr, pattern> {
  bits<5> xa;
  bits<5> xk;
  bits<5> xj;
  bits<5> xd;

  let Inst{31-0} = op;
  let Inst{19-15} = xa;
  let Inst{14-10} = xk;
  let Inst{9-5} = xj;
  let Inst{4-0} = xd;
}