1//===-- RISCVInstrFormats.td - RISC-V Instruction Formats --*- tablegen -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10//
11//  These instruction format definitions are structured to match the
12//  description in the RISC-V User-Level ISA specification as closely as
13//  possible. For instance, the specification describes instructions with the
14//  MSB (31st bit) on the left and the LSB (0th bit) on the right. This is
15//  reflected in the order of parameters to each instruction class.
16//
17//  One area of divergence is in the description of immediates. The
18//  specification describes immediate encoding in terms of bit-slicing
19//  operations on the logical value represented. The immediate argument to
20//  these instruction formats instead represents the bit sequence that will be
21//  inserted into the instruction. e.g. although JAL's immediate is logically
22//  a 21-bit value (where the LSB is always zero), we describe it as an imm20
23//  to match how it is encoded.
24//
25//===----------------------------------------------------------------------===//
26
27// Format specifies the encoding used by the instruction. This is used by
28// RISCVMCCodeEmitter to determine which form of fixup to use. These
29// definitions must be kept in-sync with RISCVBaseInfo.h.
30class InstFormat<bits<5> val> {
31  bits<5> Value = val;
32}
33def InstFormatPseudo : InstFormat<0>;
34def InstFormatR      : InstFormat<1>;
35def InstFormatR4     : InstFormat<2>;
36def InstFormatI      : InstFormat<3>;
37def InstFormatS      : InstFormat<4>;
38def InstFormatB      : InstFormat<5>;
39def InstFormatU      : InstFormat<6>;
40def InstFormatJ      : InstFormat<7>;
41def InstFormatCR     : InstFormat<8>;
42def InstFormatCI     : InstFormat<9>;
43def InstFormatCSS    : InstFormat<10>;
44def InstFormatCIW    : InstFormat<11>;
45def InstFormatCL     : InstFormat<12>;
46def InstFormatCS     : InstFormat<13>;
47def InstFormatCA     : InstFormat<14>;
48def InstFormatCB     : InstFormat<15>;
49def InstFormatCJ     : InstFormat<16>;
50def InstFormatCU     : InstFormat<17>;
51def InstFormatCLB    : InstFormat<18>;
52def InstFormatCLH    : InstFormat<19>;
53def InstFormatCSB    : InstFormat<20>;
54def InstFormatCSH    : InstFormat<21>;
55def InstFormatOther  : InstFormat<22>;
56
57class RISCVVConstraint<bits<3> val> {
58  bits<3> Value = val;
59}
60def NoConstraint  : RISCVVConstraint<0b000>;
61def VS2Constraint : RISCVVConstraint<0b001>;
62def VS1Constraint : RISCVVConstraint<0b010>;
63def VMConstraint  : RISCVVConstraint<0b100>;
64
65// Illegal instructions:
66//
67// * The destination vector register group for a masked vector instruction
68// cannot overlap the source mask register (v0), unless the destination vector
69// register is being written with a mask value (e.g., comparisons) or the
70// scalar result of a reduction.
71//
72// * Widening: The destination EEW is greater than the source EEW, the source
73// EMUL is at least 1. The destination vector register group cannot overlap
74// with the source vector register groups besides the highest-numbered part of
75// the destination register group.
76//
77// * Narrowing: The destination EEW is smaller than the source EEW. The
78// destination vector register group cannot overlap with the source vector
79// register groups besides the lowest-numbered part of the source register
80// group.
81//
82// * vmsbf.m/vmsif.m/vmsof.m: The destination register cannot overlap the
83// source register and, if masked, cannot overlap the mask register ('v0').
84//
85// * viota: The destination register cannot overlap the source register and,
86// if masked, cannot overlap the mask register ('v0').
87//
88// * v[f]slide[1]up: The destination vector register group for vslideup cannot
89// overlap the source vector register group.
90//
91// * vrgather: The destination vector register group cannot overlap with the
92// source vector register groups.
93//
94// * vcompress: The destination vector register group cannot overlap the
95// source vector register group or the source mask register
96def WidenV       : RISCVVConstraint<!or(VS2Constraint.Value,
97                                        VS1Constraint.Value,
98                                        VMConstraint.Value)>;
99def WidenW       : RISCVVConstraint<!or(VS1Constraint.Value,
100                                        VMConstraint.Value)>;
101def WidenCvt     : RISCVVConstraint<!or(VS2Constraint.Value,
102                                        VMConstraint.Value)>;
103def Iota         : RISCVVConstraint<!or(VS2Constraint.Value,
104                                        VMConstraint.Value)>;
105def SlideUp      : RISCVVConstraint<!or(VS2Constraint.Value,
106                                        VMConstraint.Value)>;
107def Vrgather     : RISCVVConstraint<!or(VS2Constraint.Value,
108                                        VS1Constraint.Value,
109                                        VMConstraint.Value)>;
110def Vcompress    : RISCVVConstraint<!or(VS2Constraint.Value,
111                                        VS1Constraint.Value)>;
112
113// The following opcode names match those given in Table 19.1 in the
114// RISC-V User-level ISA specification ("RISC-V base opcode map").
115class RISCVOpcode<string name, bits<7> val> {
116  string Name = name;
117  bits<7> Value = val;
118}
119def RISCVOpcodesList : GenericTable {
120  let FilterClass = "RISCVOpcode";
121  let Fields = [
122    "Name", "Value"
123  ];
124  let PrimaryKey = [ "Value" ];
125  let PrimaryKeyName = "lookupRISCVOpcodeByValue";
126}
127def lookupRISCVOpcodeByName : SearchIndex {
128  let Table = RISCVOpcodesList;
129  let Key = [ "Name" ];
130}
131def OPC_LOAD      : RISCVOpcode<"LOAD",      0b0000011>;
132def OPC_LOAD_FP   : RISCVOpcode<"LOAD_FP",   0b0000111>;
133def OPC_CUSTOM_0  : RISCVOpcode<"CUSTOM_0",  0b0001011>;
134def OPC_MISC_MEM  : RISCVOpcode<"MISC_MEM",  0b0001111>;
135def OPC_OP_IMM    : RISCVOpcode<"OP_IMM",    0b0010011>;
136def OPC_AUIPC     : RISCVOpcode<"AUIPC",     0b0010111>;
137def OPC_OP_IMM_32 : RISCVOpcode<"OP_IMM_32", 0b0011011>;
138def OPC_STORE     : RISCVOpcode<"STORE",     0b0100011>;
139def OPC_STORE_FP  : RISCVOpcode<"STORE_FP",  0b0100111>;
140def OPC_CUSTOM_1  : RISCVOpcode<"CUSTOM_1",  0b0101011>;
141def OPC_AMO       : RISCVOpcode<"AMO",       0b0101111>;
142def OPC_OP        : RISCVOpcode<"OP",        0b0110011>;
143def OPC_LUI       : RISCVOpcode<"LUI",       0b0110111>;
144def OPC_OP_32     : RISCVOpcode<"OP_32",     0b0111011>;
145def OPC_MADD      : RISCVOpcode<"MADD",      0b1000011>;
146def OPC_MSUB      : RISCVOpcode<"MSUB",      0b1000111>;
147def OPC_NMSUB     : RISCVOpcode<"NMSUB",     0b1001011>;
148def OPC_NMADD     : RISCVOpcode<"NMADD",     0b1001111>;
149def OPC_OP_FP     : RISCVOpcode<"OP_FP",     0b1010011>;
150def OPC_OP_V      : RISCVOpcode<"OP_V",      0b1010111>;
151def OPC_CUSTOM_2  : RISCVOpcode<"CUSTOM_2",  0b1011011>;
152def OPC_BRANCH    : RISCVOpcode<"BRANCH",    0b1100011>;
153def OPC_JALR      : RISCVOpcode<"JALR",      0b1100111>;
154def OPC_JAL       : RISCVOpcode<"JAL",       0b1101111>;
155def OPC_SYSTEM    : RISCVOpcode<"SYSTEM",    0b1110011>;
156def OPC_OP_P      : RISCVOpcode<"OP_P",      0b1110111>;
157def OPC_CUSTOM_3  : RISCVOpcode<"CUSTOM_3",  0b1111011>;
158
159class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
160                   list<dag> pattern, InstFormat format> : Instruction {
161  let Namespace = "RISCV";
162
163  dag OutOperandList = outs;
164  dag InOperandList = ins;
165  let AsmString = opcodestr # !if(!empty(argstr), "", "\t" # argstr);
166  let Pattern = pattern;
167
168  let TSFlags{4-0} = format.Value;
169
170  // Defaults
171  RISCVVConstraint RVVConstraint = NoConstraint;
172  let TSFlags{7-5} = RVVConstraint.Value;
173
174  bits<3> VLMul = 0;
175  let TSFlags{10-8} = VLMul;
176
177  bit ForceTailAgnostic = false;
178  let TSFlags{11} = ForceTailAgnostic;
179
180  bit IsTiedPseudo = 0;
181  let TSFlags{12} = IsTiedPseudo;
182
183  bit HasSEWOp = 0;
184  let TSFlags{13} = HasSEWOp;
185
186  bit HasVLOp = 0;
187  let TSFlags{14} = HasVLOp;
188
189  bit HasVecPolicyOp = 0;
190  let TSFlags{15} = HasVecPolicyOp;
191
192  bit IsRVVWideningReduction = 0;
193  let TSFlags{16} = IsRVVWideningReduction;
194
195  bit UsesMaskPolicy = 0;
196  let TSFlags{17} = UsesMaskPolicy;
197
198  // Indicates that the result can be considered sign extended from bit 31. Some
199  // instructions with this flag aren't W instructions, but are either sign
200  // extended from a smaller size, always outputs a small integer, or put zeros
201  // in bits 63:31. Used by the SExtWRemoval pass.
202  bit IsSignExtendingOpW = 0;
203  let TSFlags{18} = IsSignExtendingOpW;
204
205  bit HasRoundModeOp = 0;
206  let TSFlags{19} =  HasRoundModeOp;
207
208  // This is only valid when HasRoundModeOp is set to 1. HasRoundModeOp is set
209  // to 1 for vector fixed-point or floating-point intrinsics. This bit is
210  // processed under pass 'RISCVInsertReadWriteCSR' pass to distinguish between
211  // fixed-point / floating-point instructions and emit appropriate read/write
212  // to the correct CSR.
213  bit UsesVXRM = 0;
214  let TSFlags{20} =  UsesVXRM;
215
216  // Indicates whther these instructions can partially overlap between source
217  // registers and destination registers according to the vector spec.
218  // 0 -> not a vector pseudo
219  // 1 -> default value for vector pseudos. not widening or narrowing.
220  // 2 -> narrowing case
221  // 3 -> widening case
222  bits<2> TargetOverlapConstraintType = 0;
223  let TSFlags{22-21} = TargetOverlapConstraintType;
224}
225
226class RVInst<dag outs, dag ins, string opcodestr, string argstr,
227             list<dag> pattern, InstFormat format>
228    : RVInstCommon<outs, ins, opcodestr, argstr, pattern, format> {
229  field bits<32> Inst;
230  // SoftFail is a field the disassembler can use to provide a way for
231  // instructions to not match without killing the whole decode process. It is
232  // mainly used for ARM, but Tablegen expects this field to exist or it fails
233  // to build the decode table.
234  field bits<32> SoftFail = 0;
235  let Size = 4;
236}
237
238// Pseudo instructions
239class Pseudo<dag outs, dag ins, list<dag> pattern, string opcodestr = "", string argstr = "">
240    : RVInst<outs, ins, opcodestr, argstr, pattern, InstFormatPseudo> {
241  let isPseudo = 1;
242  let isCodeGenOnly = 1;
243}
244
245class PseudoQuietFCMP<DAGOperand Ty>
246    : Pseudo<(outs GPR:$rd), (ins Ty:$rs1, Ty:$rs2), []> {
247  let hasSideEffects = 1;
248  let mayLoad = 0;
249  let mayStore = 0;
250}
251
252// Pseudo load instructions.
253class PseudoLoad<string opcodestr>
254    : Pseudo<(outs GPR:$rd), (ins bare_symbol:$addr), [], opcodestr, "$rd, $addr"> {
255  let hasSideEffects = 0;
256  let mayLoad = 1;
257  let mayStore = 0;
258  let isCodeGenOnly = 0;
259  let isAsmParserOnly = 1;
260}
261
262class PseudoFloatLoad<string opcodestr, RegisterClass rdty>
263    : Pseudo<(outs GPR:$tmp, rdty:$rd), (ins bare_symbol:$addr), [], opcodestr, "$rd, $addr, $tmp"> {
264  let hasSideEffects = 0;
265  let mayLoad = 1;
266  let mayStore = 0;
267  let isCodeGenOnly = 0;
268  let isAsmParserOnly = 1;
269}
270
271// Pseudo store instructions.
272class PseudoStore<string opcodestr, RegisterClass rsty = GPR>
273    : Pseudo<(outs GPR:$tmp), (ins rsty:$rs, bare_symbol:$addr), [], opcodestr, "$rs, $addr, $tmp"> {
274  let hasSideEffects = 0;
275  let mayLoad = 0;
276  let mayStore = 1;
277  let isCodeGenOnly = 0;
278  let isAsmParserOnly = 1;
279}
280
281// Instruction formats are listed in the order they appear in the RISC-V
282// instruction set manual (R, R4, I, S, B, U, J).
283
284// Common base class for R format instructions. Bits {31-25} should be set by
285// the subclasses.
286class RVInstRBase<bits<3> funct3, RISCVOpcode opcode, dag outs,
287                  dag ins, string opcodestr, string argstr>
288    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> {
289  bits<5> rs2;
290  bits<5> rs1;
291  bits<5> rd;
292
293  let Inst{24-20} = rs2;
294  let Inst{19-15} = rs1;
295  let Inst{14-12} = funct3;
296  let Inst{11-7} = rd;
297  let Inst{6-0} = opcode.Value;
298}
299
300class RVInstR<bits<7> funct7, bits<3> funct3, RISCVOpcode opcode, dag outs,
301              dag ins, string opcodestr, string argstr>
302    : RVInstRBase<funct3, opcode, outs, ins, opcodestr, argstr> {
303  let Inst{31-25} = funct7;
304}
305
306class RVInstRAtomic<bits<5> funct5, bit aq, bit rl, bits<3> funct3,
307                    RISCVOpcode opcode, dag outs, dag ins, string opcodestr,
308                    string argstr>
309    : RVInstRBase<funct3, opcode, outs, ins, opcodestr, argstr> {
310  let Inst{31-27} = funct5;
311  let Inst{26} = aq;
312  let Inst{25} = rl;
313}
314
315class RVInstRFrm<bits<7> funct7, RISCVOpcode opcode, dag outs, dag ins,
316                 string opcodestr, string argstr>
317    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> {
318  bits<5> rs2;
319  bits<5> rs1;
320  bits<3> frm;
321  bits<5> rd;
322
323  let Inst{31-25} = funct7;
324  let Inst{24-20} = rs2;
325  let Inst{19-15} = rs1;
326  let Inst{14-12} = frm;
327  let Inst{11-7} = rd;
328  let Inst{6-0} = opcode.Value;
329}
330
331class RVInstR4<bits<2> funct2, bits<3> funct3, RISCVOpcode opcode, dag outs,
332               dag ins, string opcodestr, string argstr>
333    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR4> {
334  bits<5> rs3;
335  bits<5> rs2;
336  bits<5> rs1;
337  bits<5> rd;
338
339  let Inst{31-27} = rs3;
340  let Inst{26-25} = funct2;
341  let Inst{24-20} = rs2;
342  let Inst{19-15} = rs1;
343  let Inst{14-12} = funct3;
344  let Inst{11-7} = rd;
345  let Inst{6-0} = opcode.Value;
346}
347
348class RVInstR4Frm<bits<2> funct2, RISCVOpcode opcode, dag outs, dag ins,
349                  string opcodestr, string argstr>
350    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR4> {
351  bits<5> rs3;
352  bits<5> rs2;
353  bits<5> rs1;
354  bits<3> frm;
355  bits<5> rd;
356
357  let Inst{31-27} = rs3;
358  let Inst{26-25} = funct2;
359  let Inst{24-20} = rs2;
360  let Inst{19-15} = rs1;
361  let Inst{14-12} = frm;
362  let Inst{11-7} = rd;
363  let Inst{6-0} = opcode.Value;
364}
365
366// Common base class for I format instructions. Bits {31-20} should be set by
367// the subclasses.
368class RVInstIBase<bits<3> funct3, RISCVOpcode opcode, dag outs, dag ins,
369                  string opcodestr, string argstr>
370    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
371  bits<5> rs1;
372  bits<5> rd;
373
374  let Inst{19-15} = rs1;
375  let Inst{14-12} = funct3;
376  let Inst{11-7} = rd;
377  let Inst{6-0} = opcode.Value;
378}
379
380class RVInstI<bits<3> funct3, RISCVOpcode opcode, dag outs, dag ins,
381              string opcodestr, string argstr>
382    : RVInstIBase<funct3, opcode, outs, ins, opcodestr, argstr> {
383  bits<12> imm12;
384
385  let Inst{31-20} = imm12;
386}
387
388class RVInstIShift<bits<5> imm11_7, bits<3> funct3, RISCVOpcode opcode,
389                   dag outs, dag ins, string opcodestr, string argstr>
390    : RVInstIBase<funct3, opcode, outs, ins, opcodestr, argstr> {
391  bits<6> shamt;
392
393  let Inst{31-27} = imm11_7;
394  let Inst{26} = 0;
395  let Inst{25-20} = shamt;
396}
397
398class RVInstIShiftW<bits<7> imm11_5, bits<3> funct3, RISCVOpcode opcode,
399                    dag outs, dag ins, string opcodestr, string argstr>
400    : RVInstIBase<funct3, opcode, outs, ins, opcodestr, argstr> {
401  bits<5> shamt;
402
403  let Inst{31-25} = imm11_5;
404  let Inst{24-20} = shamt;
405}
406
407class RVInstIUnary<bits<12> imm12, bits<3> funct3, RISCVOpcode opcode,
408                   dag outs, dag ins, string opcodestr, string argstr>
409    : RVInstIBase<funct3, opcode, outs, ins, opcodestr, argstr> {
410  let Inst{31-20} = imm12;
411}
412
413class RVInstS<bits<3> funct3, RISCVOpcode opcode, dag outs, dag ins,
414              string opcodestr, string argstr>
415    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatS> {
416  bits<12> imm12;
417  bits<5> rs2;
418  bits<5> rs1;
419
420  let Inst{31-25} = imm12{11-5};
421  let Inst{24-20} = rs2;
422  let Inst{19-15} = rs1;
423  let Inst{14-12} = funct3;
424  let Inst{11-7} = imm12{4-0};
425  let Inst{6-0} = opcode.Value;
426}
427
428class RVInstB<bits<3> funct3, RISCVOpcode opcode, dag outs, dag ins,
429              string opcodestr, string argstr>
430    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatB> {
431  bits<12> imm12;
432  bits<5> rs2;
433  bits<5> rs1;
434
435  let Inst{31} = imm12{11};
436  let Inst{30-25} = imm12{9-4};
437  let Inst{24-20} = rs2;
438  let Inst{19-15} = rs1;
439  let Inst{14-12} = funct3;
440  let Inst{11-8} = imm12{3-0};
441  let Inst{7} = imm12{10};
442  let Inst{6-0} = opcode.Value;
443}
444
445class RVInstU<RISCVOpcode opcode, dag outs, dag ins, string opcodestr,
446              string argstr>
447    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatU> {
448  bits<20> imm20;
449  bits<5> rd;
450
451  let Inst{31-12} = imm20;
452  let Inst{11-7} = rd;
453  let Inst{6-0} = opcode.Value;
454}
455
456class RVInstJ<RISCVOpcode opcode, dag outs, dag ins, string opcodestr,
457              string argstr>
458    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatJ> {
459  bits<20> imm20;
460  bits<5> rd;
461
462  let Inst{31} = imm20{19};
463  let Inst{30-21} = imm20{9-0};
464  let Inst{20} = imm20{10};
465  let Inst{19-12} = imm20{18-11};
466  let Inst{11-7} = rd;
467  let Inst{6-0} = opcode.Value;
468}
469
470//===----------------------------------------------------------------------===//
471// Instruction classes for .insn directives
472//===----------------------------------------------------------------------===//
473
474class DirectiveInsnR<dag outs, dag ins, string argstr>
475  : RVInst<outs, ins, "", "", [], InstFormatR> {
476  bits<7> opcode;
477  bits<7> funct7;
478  bits<3> funct3;
479
480  bits<5> rs2;
481  bits<5> rs1;
482  bits<5> rd;
483
484  let Inst{31-25} = funct7;
485  let Inst{24-20} = rs2;
486  let Inst{19-15} = rs1;
487  let Inst{14-12} = funct3;
488  let Inst{11-7} = rd;
489  let Inst{6-0} = opcode;
490
491  let AsmString = ".insn r " # argstr;
492}
493
494class DirectiveInsnR4<dag outs, dag ins, string argstr>
495  : RVInst<outs, ins, "", "", [], InstFormatR4> {
496  bits<7> opcode;
497  bits<2> funct2;
498  bits<3> funct3;
499
500  bits<5> rs3;
501  bits<5> rs2;
502  bits<5> rs1;
503  bits<5> rd;
504
505  let Inst{31-27} = rs3;
506  let Inst{26-25} = funct2;
507  let Inst{24-20} = rs2;
508  let Inst{19-15} = rs1;
509  let Inst{14-12} = funct3;
510  let Inst{11-7} = rd;
511  let Inst{6-0} = opcode;
512
513  let AsmString = ".insn r4 " # argstr;
514}
515
516class DirectiveInsnI<dag outs, dag ins, string argstr>
517  : RVInst<outs, ins, "", "", [], InstFormatI> {
518  bits<7> opcode;
519  bits<3> funct3;
520
521  bits<12> imm12;
522  bits<5> rs1;
523  bits<5> rd;
524
525  let Inst{31-20} = imm12;
526  let Inst{19-15} = rs1;
527  let Inst{14-12} = funct3;
528  let Inst{11-7} = rd;
529  let Inst{6-0} = opcode;
530
531  let AsmString = ".insn i " # argstr;
532}
533
534class DirectiveInsnS<dag outs, dag ins, string argstr>
535  : RVInst<outs, ins, "", "", [], InstFormatS> {
536  bits<7> opcode;
537  bits<3> funct3;
538
539  bits<12> imm12;
540  bits<5> rs2;
541  bits<5> rs1;
542
543  let Inst{31-25} = imm12{11-5};
544  let Inst{24-20} = rs2;
545  let Inst{19-15} = rs1;
546  let Inst{14-12} = funct3;
547  let Inst{11-7} = imm12{4-0};
548  let Inst{6-0} = opcode;
549
550  let AsmString = ".insn s " # argstr;
551}
552
553class DirectiveInsnB<dag outs, dag ins, string argstr>
554  : RVInst<outs, ins, "", "", [], InstFormatB> {
555  bits<7> opcode;
556  bits<3> funct3;
557
558  bits<12> imm12;
559  bits<5> rs2;
560  bits<5> rs1;
561
562  let Inst{31} = imm12{11};
563  let Inst{30-25} = imm12{9-4};
564  let Inst{24-20} = rs2;
565  let Inst{19-15} = rs1;
566  let Inst{14-12} = funct3;
567  let Inst{11-8} = imm12{3-0};
568  let Inst{7} = imm12{10};
569  let Inst{6-0} = opcode;
570
571  let AsmString = ".insn b " # argstr;
572}
573
574class DirectiveInsnU<dag outs, dag ins, string argstr>
575  : RVInst<outs, ins, "", "", [], InstFormatU> {
576  bits<7> opcode;
577
578  bits<20> imm20;
579  bits<5> rd;
580
581  let Inst{31-12} = imm20;
582  let Inst{11-7} = rd;
583  let Inst{6-0} = opcode;
584
585  let AsmString = ".insn u " # argstr;
586}
587
588class DirectiveInsnJ<dag outs, dag ins, string argstr>
589  : RVInst<outs, ins, "", "", [], InstFormatJ> {
590  bits<7> opcode;
591
592  bits<20> imm20;
593  bits<5> rd;
594
595  let Inst{31-12} = imm20;
596  let Inst{11-7} = rd;
597  let Inst{6-0} = opcode;
598
599  let AsmString = ".insn j " # argstr;
600}
601