Add missing changelogs for previous commits.
[binutils-gdb.git] / opcodes / riscv-opc.c
blobbd652590b5823af9aa0e18d134893360b9902b77
1 /* RISC-V opcode list
2 Copyright (C) 2011-2019 Free Software Foundation, Inc.
4 Contributed by Andrew Waterman (andrew@sifive.com).
5 Based on MIPS target.
7 This file is part of the GNU opcodes library.
9 This library is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; see the file COPYING3. If not,
21 see <http://www.gnu.org/licenses/>. */
23 #include "sysdep.h"
24 #include "opcode/riscv.h"
25 #include <stdio.h>
27 /* Register names used by gas and objdump. */
29 const char * const riscv_gpr_names_numeric[NGPR] =
31 "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
32 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
33 "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
34 "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31"
37 const char * const riscv_gpr_names_abi[NGPR] = {
38 "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2",
39 "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5",
40 "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7",
41 "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6"
44 const char * const riscv_fpr_names_numeric[NFPR] =
46 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
47 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
48 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
49 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
52 const char * const riscv_fpr_names_abi[NFPR] = {
53 "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7",
54 "fs0", "fs1", "fa0", "fa1", "fa2", "fa3", "fa4", "fa5",
55 "fa6", "fa7", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
56 "fs8", "fs9", "fs10", "fs11", "ft8", "ft9", "ft10", "ft11"
59 /* The order of overloaded instructions matters. Label arguments and
60 register arguments look the same. Instructions that can have either
61 for arguments must apear in the correct order in this table for the
62 assembler to pick the right one. In other words, entries with
63 immediate operands must apear after the same instruction with
64 registers.
66 Because of the lookup algorithm used, entries with the same opcode
67 name must be contiguous. */
69 #define MASK_RS1 (OP_MASK_RS1 << OP_SH_RS1)
70 #define MASK_RS2 (OP_MASK_RS2 << OP_SH_RS2)
71 #define MASK_RD (OP_MASK_RD << OP_SH_RD)
72 #define MASK_CRS2 (OP_MASK_CRS2 << OP_SH_CRS2)
73 #define MASK_IMM ENCODE_ITYPE_IMM (-1U)
74 #define MASK_RVC_IMM ENCODE_RVC_IMM (-1U)
75 #define MASK_UIMM ENCODE_UTYPE_IMM (-1U)
76 #define MASK_RM (OP_MASK_RM << OP_SH_RM)
77 #define MASK_PRED (OP_MASK_PRED << OP_SH_PRED)
78 #define MASK_SUCC (OP_MASK_SUCC << OP_SH_SUCC)
79 #define MASK_AQ (OP_MASK_AQ << OP_SH_AQ)
80 #define MASK_RL (OP_MASK_RL << OP_SH_RL)
81 #define MASK_AQRL (MASK_AQ | MASK_RL)
83 static int
84 match_opcode (const struct riscv_opcode *op, insn_t insn)
86 return ((insn ^ op->match) & op->mask) == 0;
89 static int
90 match_never (const struct riscv_opcode *op ATTRIBUTE_UNUSED,
91 insn_t insn ATTRIBUTE_UNUSED)
93 return 0;
96 static int
97 match_rs1_eq_rs2 (const struct riscv_opcode *op, insn_t insn)
99 int rs1 = (insn & MASK_RS1) >> OP_SH_RS1;
100 int rs2 = (insn & MASK_RS2) >> OP_SH_RS2;
101 return match_opcode (op, insn) && rs1 == rs2;
104 static int
105 match_rd_nonzero (const struct riscv_opcode *op, insn_t insn)
107 return match_opcode (op, insn) && ((insn & MASK_RD) != 0);
110 static int
111 match_c_add (const struct riscv_opcode *op, insn_t insn)
113 return match_rd_nonzero (op, insn) && ((insn & MASK_CRS2) != 0);
116 /* We don't allow mv zero,X to become a c.mv hint, so we need a separate
117 matching function for this. */
119 static int
120 match_c_add_with_hint (const struct riscv_opcode *op, insn_t insn)
122 return match_opcode (op, insn) && ((insn & MASK_CRS2) != 0);
125 static int
126 match_c_nop (const struct riscv_opcode *op, insn_t insn)
128 return (match_opcode (op, insn)
129 && (((insn & MASK_RD) >> OP_SH_RD) == 0));
132 static int
133 match_c_addi16sp (const struct riscv_opcode *op, insn_t insn)
135 return (match_opcode (op, insn)
136 && (((insn & MASK_RD) >> OP_SH_RD) == 2)
137 && EXTRACT_RVC_ADDI16SP_IMM (insn) != 0);
140 static int
141 match_c_lui (const struct riscv_opcode *op, insn_t insn)
143 return (match_rd_nonzero (op, insn)
144 && (((insn & MASK_RD) >> OP_SH_RD) != 2)
145 && EXTRACT_RVC_LUI_IMM (insn) != 0);
148 /* We don't allow lui zero,X to become a c.lui hint, so we need a separate
149 matching function for this. */
151 static int
152 match_c_lui_with_hint (const struct riscv_opcode *op, insn_t insn)
154 return (match_opcode (op, insn)
155 && (((insn & MASK_RD) >> OP_SH_RD) != 2)
156 && EXTRACT_RVC_LUI_IMM (insn) != 0);
159 static int
160 match_c_addi4spn (const struct riscv_opcode *op, insn_t insn)
162 return match_opcode (op, insn) && EXTRACT_RVC_ADDI4SPN_IMM (insn) != 0;
165 /* This requires a non-zero shift. A zero rd is a hint, so is allowed. */
167 static int
168 match_c_slli (const struct riscv_opcode *op, insn_t insn)
170 return match_opcode (op, insn) && EXTRACT_RVC_IMM (insn) != 0;
173 /* This requires a non-zero rd, and a non-zero shift. */
175 static int
176 match_slli_as_c_slli (const struct riscv_opcode *op, insn_t insn)
178 return match_rd_nonzero (op, insn) && EXTRACT_RVC_IMM (insn) != 0;
181 /* This requires a zero shift. A zero rd is a hint, so is allowed. */
183 static int
184 match_c_slli64 (const struct riscv_opcode *op, insn_t insn)
186 return match_opcode (op, insn) && EXTRACT_RVC_IMM (insn) == 0;
189 /* This is used for both srli and srai. This requires a non-zero shift.
190 A zero rd is not possible. */
192 static int
193 match_srxi_as_c_srxi (const struct riscv_opcode *op, insn_t insn)
195 return match_opcode (op, insn) && EXTRACT_RVC_IMM (insn) != 0;
198 const struct riscv_opcode riscv_opcodes[] =
200 /* name, xlen, isa, operands, match, mask, match_func, pinfo. */
201 {"unimp", 0, {"C", 0}, "", 0, 0xffffU, match_opcode, INSN_ALIAS },
202 {"unimp", 0, {"I", 0}, "", MATCH_CSRRW | (CSR_CYCLE << OP_SH_CSR), 0xffffffffU, match_opcode, 0 }, /* csrw cycle, x0 */
203 {"ebreak", 0, {"C", 0}, "", MATCH_C_EBREAK, MASK_C_EBREAK, match_opcode, INSN_ALIAS },
204 {"ebreak", 0, {"I", 0}, "", MATCH_EBREAK, MASK_EBREAK, match_opcode, 0 },
205 {"sbreak", 0, {"C", 0}, "", MATCH_C_EBREAK, MASK_C_EBREAK, match_opcode, INSN_ALIAS },
206 {"sbreak", 0, {"I", 0}, "", MATCH_EBREAK, MASK_EBREAK, match_opcode, INSN_ALIAS },
207 {"ret", 0, {"C", 0}, "", MATCH_C_JR | (X_RA << OP_SH_RD), MASK_C_JR | MASK_RD, match_opcode, INSN_ALIAS|INSN_BRANCH },
208 {"ret", 0, {"I", 0}, "", MATCH_JALR | (X_RA << OP_SH_RS1), MASK_JALR | MASK_RD | MASK_RS1 | MASK_IMM, match_opcode, INSN_ALIAS|INSN_BRANCH },
209 {"jr", 0, {"C", 0}, "d", MATCH_C_JR, MASK_C_JR, match_rd_nonzero, INSN_ALIAS|INSN_BRANCH },
210 {"jr", 0, {"I", 0}, "s", MATCH_JALR, MASK_JALR | MASK_RD | MASK_IMM, match_opcode, INSN_ALIAS|INSN_BRANCH },
211 {"jr", 0, {"I", 0}, "o(s)", MATCH_JALR, MASK_JALR | MASK_RD, match_opcode, INSN_ALIAS|INSN_BRANCH },
212 {"jr", 0, {"I", 0}, "s,j", MATCH_JALR, MASK_JALR | MASK_RD, match_opcode, INSN_ALIAS|INSN_BRANCH },
213 {"jalr", 0, {"C", 0}, "d", MATCH_C_JALR, MASK_C_JALR, match_rd_nonzero, INSN_ALIAS|INSN_JSR },
214 {"jalr", 0, {"I", 0}, "s", MATCH_JALR | (X_RA << OP_SH_RD), MASK_JALR | MASK_RD | MASK_IMM, match_opcode, INSN_ALIAS|INSN_JSR },
215 {"jalr", 0, {"I", 0}, "o(s)", MATCH_JALR | (X_RA << OP_SH_RD), MASK_JALR | MASK_RD, match_opcode, INSN_ALIAS|INSN_JSR },
216 {"jalr", 0, {"I", 0}, "s,j", MATCH_JALR | (X_RA << OP_SH_RD), MASK_JALR | MASK_RD, match_opcode, INSN_ALIAS|INSN_JSR },
217 {"jalr", 0, {"I", 0}, "d,s", MATCH_JALR, MASK_JALR | MASK_IMM, match_opcode, INSN_ALIAS|INSN_JSR },
218 {"jalr", 0, {"I", 0}, "d,o(s)", MATCH_JALR, MASK_JALR, match_opcode, INSN_JSR },
219 {"jalr", 0, {"I", 0}, "d,s,j", MATCH_JALR, MASK_JALR, match_opcode, INSN_JSR },
220 {"j", 0, {"C", 0}, "Ca", MATCH_C_J, MASK_C_J, match_opcode, INSN_ALIAS|INSN_BRANCH },
221 {"j", 0, {"I", 0}, "a", MATCH_JAL, MASK_JAL | MASK_RD, match_opcode, INSN_ALIAS|INSN_BRANCH },
222 {"jal", 0, {"I", 0}, "d,a", MATCH_JAL, MASK_JAL, match_opcode, INSN_JSR },
223 {"jal", 32, {"C", 0}, "Ca", MATCH_C_JAL, MASK_C_JAL, match_opcode, INSN_ALIAS|INSN_JSR },
224 {"jal", 0, {"I", 0}, "a", MATCH_JAL | (X_RA << OP_SH_RD), MASK_JAL | MASK_RD, match_opcode, INSN_ALIAS|INSN_JSR },
225 {"call", 0, {"I", 0}, "d,c", (X_T1 << OP_SH_RS1), (int) M_CALL, match_never, INSN_MACRO },
226 {"call", 0, {"I", 0}, "c", (X_RA << OP_SH_RS1) | (X_RA << OP_SH_RD), (int) M_CALL, match_never, INSN_MACRO },
227 {"tail", 0, {"I", 0}, "c", (X_T1 << OP_SH_RS1), (int) M_CALL, match_never, INSN_MACRO },
228 {"jump", 0, {"I", 0}, "c,s", 0, (int) M_CALL, match_never, INSN_MACRO },
229 {"nop", 0, {"C", 0}, "", MATCH_C_ADDI, 0xffff, match_opcode, INSN_ALIAS },
230 {"nop", 0, {"I", 0}, "", MATCH_ADDI, MASK_ADDI | MASK_RD | MASK_RS1 | MASK_IMM, match_opcode, INSN_ALIAS },
231 {"lui", 0, {"C", 0}, "d,Cu", MATCH_C_LUI, MASK_C_LUI, match_c_lui, INSN_ALIAS },
232 {"lui", 0, {"I", 0}, "d,u", MATCH_LUI, MASK_LUI, match_opcode, 0 },
233 {"li", 0, {"C", 0}, "d,Cv", MATCH_C_LUI, MASK_C_LUI, match_c_lui, INSN_ALIAS },
234 {"li", 0, {"C", 0}, "d,Co", MATCH_C_LI, MASK_C_LI, match_rd_nonzero, INSN_ALIAS },
235 {"li", 0, {"I", 0}, "d,j", MATCH_ADDI, MASK_ADDI | MASK_RS1, match_opcode, INSN_ALIAS }, /* addi */
236 {"li", 0, {"I", 0}, "d,I", 0, (int) M_LI, match_never, INSN_MACRO },
237 {"mv", 0, {"C", 0}, "d,CV", MATCH_C_MV, MASK_C_MV, match_c_add, INSN_ALIAS },
238 {"mv", 0, {"I", 0}, "d,s", MATCH_ADDI, MASK_ADDI | MASK_IMM, match_opcode, INSN_ALIAS },
239 {"move", 0, {"C", 0}, "d,CV", MATCH_C_MV, MASK_C_MV, match_c_add, INSN_ALIAS },
240 {"move", 0, {"I", 0}, "d,s", MATCH_ADDI, MASK_ADDI | MASK_IMM, match_opcode, INSN_ALIAS },
241 {"andi", 0, {"C", 0}, "Cs,Cw,Co", MATCH_C_ANDI, MASK_C_ANDI, match_opcode, INSN_ALIAS },
242 {"andi", 0, {"I", 0}, "d,s,j", MATCH_ANDI, MASK_ANDI, match_opcode, 0 },
243 {"and", 0, {"C", 0}, "Cs,Cw,Ct", MATCH_C_AND, MASK_C_AND, match_opcode, INSN_ALIAS },
244 {"and", 0, {"C", 0}, "Cs,Ct,Cw", MATCH_C_AND, MASK_C_AND, match_opcode, INSN_ALIAS },
245 {"and", 0, {"C", 0}, "Cs,Cw,Co", MATCH_C_ANDI, MASK_C_ANDI, match_opcode, INSN_ALIAS },
246 {"and", 0, {"I", 0}, "d,s,t", MATCH_AND, MASK_AND, match_opcode, 0 },
247 {"and", 0, {"I", 0}, "d,s,j", MATCH_ANDI, MASK_ANDI, match_opcode, INSN_ALIAS },
248 {"beqz", 0, {"C", 0}, "Cs,Cp", MATCH_C_BEQZ, MASK_C_BEQZ, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
249 {"beqz", 0, {"I", 0}, "s,p", MATCH_BEQ, MASK_BEQ | MASK_RS2, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
250 {"beq", 0, {"C", 0}, "Cs,Cz,Cp", MATCH_C_BEQZ, MASK_C_BEQZ, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
251 {"beq", 0, {"I", 0}, "s,t,p", MATCH_BEQ, MASK_BEQ, match_opcode, INSN_CONDBRANCH },
252 {"blez", 0, {"I", 0}, "t,p", MATCH_BGE, MASK_BGE | MASK_RS1, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
253 {"bgez", 0, {"I", 0}, "s,p", MATCH_BGE, MASK_BGE | MASK_RS2, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
254 {"bge", 0, {"I", 0}, "s,t,p", MATCH_BGE, MASK_BGE, match_opcode, INSN_CONDBRANCH },
255 {"bgeu", 0, {"I", 0}, "s,t,p", MATCH_BGEU, MASK_BGEU, match_opcode, INSN_CONDBRANCH },
256 {"ble", 0, {"I", 0}, "t,s,p", MATCH_BGE, MASK_BGE, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
257 {"bleu", 0, {"I", 0}, "t,s,p", MATCH_BGEU, MASK_BGEU, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
258 {"bltz", 0, {"I", 0}, "s,p", MATCH_BLT, MASK_BLT | MASK_RS2, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
259 {"bgtz", 0, {"I", 0}, "t,p", MATCH_BLT, MASK_BLT | MASK_RS1, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
260 {"blt", 0, {"I", 0}, "s,t,p", MATCH_BLT, MASK_BLT, match_opcode, INSN_CONDBRANCH },
261 {"bltu", 0, {"I", 0}, "s,t,p", MATCH_BLTU, MASK_BLTU, match_opcode, INSN_CONDBRANCH },
262 {"bgt", 0, {"I", 0}, "t,s,p", MATCH_BLT, MASK_BLT, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
263 {"bgtu", 0, {"I", 0}, "t,s,p", MATCH_BLTU, MASK_BLTU, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
264 {"bnez", 0, {"C", 0}, "Cs,Cp", MATCH_C_BNEZ, MASK_C_BNEZ, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
265 {"bnez", 0, {"I", 0}, "s,p", MATCH_BNE, MASK_BNE | MASK_RS2, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
266 {"bne", 0, {"C", 0}, "Cs,Cz,Cp", MATCH_C_BNEZ, MASK_C_BNEZ, match_opcode, INSN_ALIAS|INSN_CONDBRANCH },
267 {"bne", 0, {"I", 0}, "s,t,p", MATCH_BNE, MASK_BNE, match_opcode, INSN_CONDBRANCH },
268 {"addi", 0, {"C", 0}, "Ct,Cc,CK", MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN, match_c_addi4spn, INSN_ALIAS },
269 {"addi", 0, {"C", 0}, "d,CU,Cj", MATCH_C_ADDI, MASK_C_ADDI, match_rd_nonzero, INSN_ALIAS },
270 {"addi", 0, {"C", 0}, "d,CU,z", MATCH_C_NOP, MASK_C_ADDI | MASK_RVC_IMM, match_c_nop, INSN_ALIAS },
271 {"addi", 0, {"C", 0}, "Cc,Cc,CL", MATCH_C_ADDI16SP, MASK_C_ADDI16SP, match_c_addi16sp, INSN_ALIAS },
272 {"addi", 0, {"I", 0}, "d,s,j", MATCH_ADDI, MASK_ADDI, match_opcode, 0 },
273 {"add", 0, {"C", 0}, "d,CU,CV", MATCH_C_ADD, MASK_C_ADD, match_c_add, INSN_ALIAS },
274 {"add", 0, {"C", 0}, "d,CV,CU", MATCH_C_ADD, MASK_C_ADD, match_c_add, INSN_ALIAS },
275 {"add", 0, {"C", 0}, "d,CU,Co", MATCH_C_ADDI, MASK_C_ADDI, match_rd_nonzero, INSN_ALIAS },
276 {"add", 0, {"C", 0}, "Ct,Cc,CK", MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN, match_c_addi4spn, INSN_ALIAS },
277 {"add", 0, {"C", 0}, "Cc,Cc,CL", MATCH_C_ADDI16SP, MASK_C_ADDI16SP, match_c_addi16sp, INSN_ALIAS },
278 {"add", 0, {"I", 0}, "d,s,t", MATCH_ADD, MASK_ADD, match_opcode, 0 },
279 /* This is used for TLS, where the fourth arg is %tprel_add, to get a reloc
280 applied to an add instruction, for relaxation to use. */
281 {"add", 0, {"I", 0}, "d,s,t,1",MATCH_ADD, MASK_ADD, match_opcode, 0 },
282 {"add", 0, {"I", 0}, "d,s,j", MATCH_ADDI, MASK_ADDI, match_opcode, INSN_ALIAS },
283 {"la", 0, {"I", 0}, "d,B", 0, (int) M_LA, match_never, INSN_MACRO },
284 {"lla", 0, {"I", 0}, "d,B", 0, (int) M_LLA, match_never, INSN_MACRO },
285 {"la.tls.gd", 0, {"I", 0}, "d,A", 0, (int) M_LA_TLS_GD, match_never, INSN_MACRO },
286 {"la.tls.ie", 0, {"I", 0}, "d,A", 0, (int) M_LA_TLS_IE, match_never, INSN_MACRO },
287 {"neg", 0, {"I", 0}, "d,t", MATCH_SUB, MASK_SUB | MASK_RS1, match_opcode, INSN_ALIAS }, /* sub 0 */
288 {"slli", 0, {"C", 0}, "d,CU,C>", MATCH_C_SLLI, MASK_C_SLLI, match_slli_as_c_slli, INSN_ALIAS },
289 {"slli", 0, {"I", 0}, "d,s,>", MATCH_SLLI, MASK_SLLI, match_opcode, 0 },
290 {"sll", 0, {"C", 0}, "d,CU,C>", MATCH_C_SLLI, MASK_C_SLLI, match_slli_as_c_slli, INSN_ALIAS },
291 {"sll", 0, {"I", 0}, "d,s,t", MATCH_SLL, MASK_SLL, match_opcode, 0 },
292 {"sll", 0, {"I", 0}, "d,s,>", MATCH_SLLI, MASK_SLLI, match_opcode, INSN_ALIAS },
293 {"srli", 0, {"C", 0}, "Cs,Cw,C>", MATCH_C_SRLI, MASK_C_SRLI, match_srxi_as_c_srxi, INSN_ALIAS },
294 {"srli", 0, {"I", 0}, "d,s,>", MATCH_SRLI, MASK_SRLI, match_opcode, 0 },
295 {"srl", 0, {"C", 0}, "Cs,Cw,C>", MATCH_C_SRLI, MASK_C_SRLI, match_srxi_as_c_srxi, INSN_ALIAS },
296 {"srl", 0, {"I", 0}, "d,s,t", MATCH_SRL, MASK_SRL, match_opcode, 0 },
297 {"srl", 0, {"I", 0}, "d,s,>", MATCH_SRLI, MASK_SRLI, match_opcode, INSN_ALIAS },
298 {"srai", 0, {"C", 0}, "Cs,Cw,C>", MATCH_C_SRAI, MASK_C_SRAI, match_srxi_as_c_srxi, INSN_ALIAS },
299 {"srai", 0, {"I", 0}, "d,s,>", MATCH_SRAI, MASK_SRAI, match_opcode, 0 },
300 {"sra", 0, {"C", 0}, "Cs,Cw,C>", MATCH_C_SRAI, MASK_C_SRAI, match_srxi_as_c_srxi, INSN_ALIAS },
301 {"sra", 0, {"I", 0}, "d,s,t", MATCH_SRA, MASK_SRA, match_opcode, 0 },
302 {"sra", 0, {"I", 0}, "d,s,>", MATCH_SRAI, MASK_SRAI, match_opcode, INSN_ALIAS },
303 {"sub", 0, {"C", 0}, "Cs,Cw,Ct", MATCH_C_SUB, MASK_C_SUB, match_opcode, INSN_ALIAS },
304 {"sub", 0, {"I", 0}, "d,s,t", MATCH_SUB, MASK_SUB, match_opcode, 0 },
305 {"lb", 0, {"I", 0}, "d,o(s)", MATCH_LB, MASK_LB, match_opcode, INSN_DREF|INSN_1_BYTE },
306 {"lb", 0, {"I", 0}, "d,A", 0, (int) M_LB, match_never, INSN_MACRO },
307 {"lbu", 0, {"I", 0}, "d,o(s)", MATCH_LBU, MASK_LBU, match_opcode, INSN_DREF|INSN_1_BYTE },
308 {"lbu", 0, {"I", 0}, "d,A", 0, (int) M_LBU, match_never, INSN_MACRO },
309 {"lh", 0, {"I", 0}, "d,o(s)", MATCH_LH, MASK_LH, match_opcode, INSN_DREF|INSN_2_BYTE },
310 {"lh", 0, {"I", 0}, "d,A", 0, (int) M_LH, match_never, INSN_MACRO },
311 {"lhu", 0, {"I", 0}, "d,o(s)", MATCH_LHU, MASK_LHU, match_opcode, INSN_DREF|INSN_2_BYTE },
312 {"lhu", 0, {"I", 0}, "d,A", 0, (int) M_LHU, match_never, INSN_MACRO },
313 {"lw", 0, {"C", 0}, "d,Cm(Cc)", MATCH_C_LWSP, MASK_C_LWSP, match_rd_nonzero, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
314 {"lw", 0, {"C", 0}, "Ct,Ck(Cs)", MATCH_C_LW, MASK_C_LW, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
315 {"lw", 0, {"I", 0}, "d,o(s)", MATCH_LW, MASK_LW, match_opcode, INSN_DREF|INSN_4_BYTE },
316 {"lw", 0, {"I", 0}, "d,A", 0, (int) M_LW, match_never, INSN_MACRO },
317 {"not", 0, {"I", 0}, "d,s", MATCH_XORI | MASK_IMM, MASK_XORI | MASK_IMM, match_opcode, INSN_ALIAS },
318 {"ori", 0, {"I", 0}, "d,s,j", MATCH_ORI, MASK_ORI, match_opcode, 0 },
319 {"or", 0, {"C", 0}, "Cs,Cw,Ct", MATCH_C_OR, MASK_C_OR, match_opcode, INSN_ALIAS },
320 {"or", 0, {"C", 0}, "Cs,Ct,Cw", MATCH_C_OR, MASK_C_OR, match_opcode, INSN_ALIAS },
321 {"or", 0, {"I", 0}, "d,s,t", MATCH_OR, MASK_OR, match_opcode, 0 },
322 {"or", 0, {"I", 0}, "d,s,j", MATCH_ORI, MASK_ORI, match_opcode, INSN_ALIAS },
323 {"auipc", 0, {"I", 0}, "d,u", MATCH_AUIPC, MASK_AUIPC, match_opcode, 0 },
324 {"seqz", 0, {"I", 0}, "d,s", MATCH_SLTIU | ENCODE_ITYPE_IMM (1), MASK_SLTIU | MASK_IMM, match_opcode, INSN_ALIAS },
325 {"snez", 0, {"I", 0}, "d,t", MATCH_SLTU, MASK_SLTU | MASK_RS1, match_opcode, INSN_ALIAS },
326 {"sltz", 0, {"I", 0}, "d,s", MATCH_SLT, MASK_SLT | MASK_RS2, match_opcode, INSN_ALIAS },
327 {"sgtz", 0, {"I", 0}, "d,t", MATCH_SLT, MASK_SLT | MASK_RS1, match_opcode, INSN_ALIAS },
328 {"slti", 0, {"I", 0}, "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, 0 },
329 {"slt", 0, {"I", 0}, "d,s,t", MATCH_SLT, MASK_SLT, match_opcode, 0 },
330 {"slt", 0, {"I", 0}, "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, INSN_ALIAS },
331 {"sltiu", 0, {"I", 0}, "d,s,j", MATCH_SLTIU, MASK_SLTIU, match_opcode, 0 },
332 {"sltu", 0, {"I", 0}, "d,s,t", MATCH_SLTU, MASK_SLTU, match_opcode, 0 },
333 {"sltu", 0, {"I", 0}, "d,s,j", MATCH_SLTIU, MASK_SLTIU, match_opcode, INSN_ALIAS },
334 {"sgt", 0, {"I", 0}, "d,t,s", MATCH_SLT, MASK_SLT, match_opcode, INSN_ALIAS },
335 {"sgtu", 0, {"I", 0}, "d,t,s", MATCH_SLTU, MASK_SLTU, match_opcode, INSN_ALIAS },
336 {"sb", 0, {"I", 0}, "t,q(s)", MATCH_SB, MASK_SB, match_opcode, INSN_DREF|INSN_1_BYTE },
337 {"sb", 0, {"I", 0}, "t,A,s", 0, (int) M_SB, match_never, INSN_MACRO },
338 {"sh", 0, {"I", 0}, "t,q(s)", MATCH_SH, MASK_SH, match_opcode, INSN_DREF|INSN_2_BYTE },
339 {"sh", 0, {"I", 0}, "t,A,s", 0, (int) M_SH, match_never, INSN_MACRO },
340 {"sw", 0, {"C", 0}, "CV,CM(Cc)", MATCH_C_SWSP, MASK_C_SWSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
341 {"sw", 0, {"C", 0}, "Ct,Ck(Cs)", MATCH_C_SW, MASK_C_SW, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
342 {"sw", 0, {"I", 0}, "t,q(s)", MATCH_SW, MASK_SW, match_opcode, INSN_DREF|INSN_4_BYTE },
343 {"sw", 0, {"I", 0}, "t,A,s", 0, (int) M_SW, match_never, INSN_MACRO },
344 {"fence", 0, {"I", 0}, "", MATCH_FENCE | MASK_PRED | MASK_SUCC, MASK_FENCE | MASK_RD | MASK_RS1 | MASK_IMM, match_opcode, INSN_ALIAS },
345 {"fence", 0, {"I", 0}, "P,Q", MATCH_FENCE, MASK_FENCE | MASK_RD | MASK_RS1 | (MASK_IMM & ~MASK_PRED & ~MASK_SUCC), match_opcode, 0 },
346 {"fence.i", 0, {"I", 0}, "", MATCH_FENCE_I, MASK_FENCE | MASK_RD | MASK_RS1 | MASK_IMM, match_opcode, 0 },
347 {"fence.tso", 0, {"I", 0}, "", MATCH_FENCE_TSO, MASK_FENCE_TSO | MASK_RD | MASK_RS1, match_opcode, INSN_ALIAS },
348 {"rdcycle", 0, {"I", 0}, "d", MATCH_RDCYCLE, MASK_RDCYCLE, match_opcode, INSN_ALIAS },
349 {"rdinstret", 0, {"I", 0}, "d", MATCH_RDINSTRET, MASK_RDINSTRET, match_opcode, INSN_ALIAS },
350 {"rdtime", 0, {"I", 0}, "d", MATCH_RDTIME, MASK_RDTIME, match_opcode, INSN_ALIAS },
351 {"rdcycleh", 32, {"I", 0}, "d", MATCH_RDCYCLEH, MASK_RDCYCLEH, match_opcode, INSN_ALIAS },
352 {"rdinstreth", 32, {"I", 0}, "d", MATCH_RDINSTRETH, MASK_RDINSTRETH, match_opcode, INSN_ALIAS },
353 {"rdtimeh", 32, {"I", 0}, "d", MATCH_RDTIMEH, MASK_RDTIMEH, match_opcode, INSN_ALIAS },
354 {"ecall", 0, {"I", 0}, "", MATCH_SCALL, MASK_SCALL, match_opcode, 0 },
355 {"scall", 0, {"I", 0}, "", MATCH_SCALL, MASK_SCALL, match_opcode, 0 },
356 {"xori", 0, {"I", 0}, "d,s,j", MATCH_XORI, MASK_XORI, match_opcode, 0 },
357 {"xor", 0, {"C", 0}, "Cs,Cw,Ct", MATCH_C_XOR, MASK_C_XOR, match_opcode, INSN_ALIAS },
358 {"xor", 0, {"C", 0}, "Cs,Ct,Cw", MATCH_C_XOR, MASK_C_XOR, match_opcode, INSN_ALIAS },
359 {"xor", 0, {"I", 0}, "d,s,t", MATCH_XOR, MASK_XOR, match_opcode, 0 },
360 {"xor", 0, {"I", 0}, "d,s,j", MATCH_XORI, MASK_XORI, match_opcode, INSN_ALIAS },
361 {"lwu", 64, {"I", 0}, "d,o(s)", MATCH_LWU, MASK_LWU, match_opcode, INSN_DREF|INSN_4_BYTE },
362 {"lwu", 64, {"I", 0}, "d,A", 0, (int) M_LWU, match_never, INSN_MACRO },
363 {"ld", 64, {"C", 0}, "d,Cn(Cc)", MATCH_C_LDSP, MASK_C_LDSP, match_rd_nonzero, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
364 {"ld", 64, {"C", 0}, "Ct,Cl(Cs)", MATCH_C_LD, MASK_C_LD, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
365 {"ld", 64, {"I", 0}, "d,o(s)", MATCH_LD, MASK_LD, match_opcode, INSN_DREF|INSN_8_BYTE },
366 {"ld", 64, {"I", 0}, "d,A", 0, (int) M_LD, match_never, INSN_MACRO },
367 {"sd", 64, {"C", 0}, "CV,CN(Cc)", MATCH_C_SDSP, MASK_C_SDSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
368 {"sd", 64, {"C", 0}, "Ct,Cl(Cs)", MATCH_C_SD, MASK_C_SD, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
369 {"sd", 64, {"I", 0}, "t,q(s)", MATCH_SD, MASK_SD, match_opcode, INSN_DREF|INSN_8_BYTE },
370 {"sd", 64, {"I", 0}, "t,A,s", 0, (int) M_SD, match_never, INSN_MACRO },
371 {"sext.w", 64, {"C", 0}, "d,CU", MATCH_C_ADDIW, MASK_C_ADDIW | MASK_RVC_IMM, match_rd_nonzero, INSN_ALIAS },
372 {"sext.w", 64, {"I", 0}, "d,s", MATCH_ADDIW, MASK_ADDIW | MASK_IMM, match_opcode, INSN_ALIAS },
373 {"addiw", 64, {"C", 0}, "d,CU,Co", MATCH_C_ADDIW, MASK_C_ADDIW, match_rd_nonzero, INSN_ALIAS },
374 {"addiw", 64, {"I", 0}, "d,s,j", MATCH_ADDIW, MASK_ADDIW, match_opcode, 0 },
375 {"addw", 64, {"C", 0}, "Cs,Cw,Ct", MATCH_C_ADDW, MASK_C_ADDW, match_opcode, INSN_ALIAS },
376 {"addw", 64, {"C", 0}, "Cs,Ct,Cw", MATCH_C_ADDW, MASK_C_ADDW, match_opcode, INSN_ALIAS },
377 {"addw", 64, {"C", 0}, "d,CU,Co", MATCH_C_ADDIW, MASK_C_ADDIW, match_rd_nonzero, INSN_ALIAS },
378 {"addw", 64, {"I", 0}, "d,s,t", MATCH_ADDW, MASK_ADDW, match_opcode, 0 },
379 {"addw", 64, {"I", 0}, "d,s,j", MATCH_ADDIW, MASK_ADDIW, match_opcode, INSN_ALIAS },
380 {"negw", 64, {"I", 0}, "d,t", MATCH_SUBW, MASK_SUBW | MASK_RS1, match_opcode, INSN_ALIAS }, /* sub 0 */
381 {"slliw", 64, {"I", 0}, "d,s,<", MATCH_SLLIW, MASK_SLLIW, match_opcode, 0 },
382 {"sllw", 64, {"I", 0}, "d,s,t", MATCH_SLLW, MASK_SLLW, match_opcode, 0 },
383 {"sllw", 64, {"I", 0}, "d,s,<", MATCH_SLLIW, MASK_SLLIW, match_opcode, INSN_ALIAS },
384 {"srliw", 64, {"I", 0}, "d,s,<", MATCH_SRLIW, MASK_SRLIW, match_opcode, 0 },
385 {"srlw", 64, {"I", 0}, "d,s,t", MATCH_SRLW, MASK_SRLW, match_opcode, 0 },
386 {"srlw", 64, {"I", 0}, "d,s,<", MATCH_SRLIW, MASK_SRLIW, match_opcode, INSN_ALIAS },
387 {"sraiw", 64, {"I", 0}, "d,s,<", MATCH_SRAIW, MASK_SRAIW, match_opcode, 0 },
388 {"sraw", 64, {"I", 0}, "d,s,t", MATCH_SRAW, MASK_SRAW, match_opcode, 0 },
389 {"sraw", 64, {"I", 0}, "d,s,<", MATCH_SRAIW, MASK_SRAIW, match_opcode, INSN_ALIAS },
390 {"subw", 64, {"C", 0}, "Cs,Cw,Ct", MATCH_C_SUBW, MASK_C_SUBW, match_opcode, INSN_ALIAS },
391 {"subw", 64, {"I", 0}, "d,s,t", MATCH_SUBW, MASK_SUBW, match_opcode, 0 },
393 /* Atomic memory operation instruction subset */
394 {"lr.w", 0, {"A", 0}, "d,0(s)", MATCH_LR_W, MASK_LR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
395 {"sc.w", 0, {"A", 0}, "d,t,0(s)", MATCH_SC_W, MASK_SC_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
396 {"amoadd.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOADD_W, MASK_AMOADD_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
397 {"amoswap.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOSWAP_W, MASK_AMOSWAP_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
398 {"amoand.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOAND_W, MASK_AMOAND_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
399 {"amoor.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOOR_W, MASK_AMOOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
400 {"amoxor.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOXOR_W, MASK_AMOXOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
401 {"amomax.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAX_W, MASK_AMOMAX_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
402 {"amomaxu.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAXU_W, MASK_AMOMAXU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
403 {"amomin.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMIN_W, MASK_AMOMIN_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
404 {"amominu.w", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMINU_W, MASK_AMOMINU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
405 {"lr.w.aq", 0, {"A", 0}, "d,0(s)", MATCH_LR_W | MASK_AQ, MASK_LR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
406 {"sc.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_SC_W | MASK_AQ, MASK_SC_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
407 {"amoadd.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOADD_W | MASK_AQ, MASK_AMOADD_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
408 {"amoswap.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOSWAP_W | MASK_AQ, MASK_AMOSWAP_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
409 {"amoand.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOAND_W | MASK_AQ, MASK_AMOAND_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
410 {"amoor.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOOR_W | MASK_AQ, MASK_AMOOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
411 {"amoxor.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOXOR_W | MASK_AQ, MASK_AMOXOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
412 {"amomax.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAX_W | MASK_AQ, MASK_AMOMAX_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
413 {"amomaxu.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAXU_W | MASK_AQ, MASK_AMOMAXU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
414 {"amomin.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMIN_W | MASK_AQ, MASK_AMOMIN_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
415 {"amominu.w.aq", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMINU_W | MASK_AQ, MASK_AMOMINU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
416 {"lr.w.rl", 0, {"A", 0}, "d,0(s)", MATCH_LR_W | MASK_RL, MASK_LR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
417 {"sc.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_SC_W | MASK_RL, MASK_SC_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
418 {"amoadd.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOADD_W | MASK_RL, MASK_AMOADD_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
419 {"amoswap.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOSWAP_W | MASK_RL, MASK_AMOSWAP_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
420 {"amoand.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOAND_W | MASK_RL, MASK_AMOAND_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
421 {"amoor.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOOR_W | MASK_RL, MASK_AMOOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
422 {"amoxor.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOXOR_W | MASK_RL, MASK_AMOXOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
423 {"amomax.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAX_W | MASK_RL, MASK_AMOMAX_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
424 {"amomaxu.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAXU_W | MASK_RL, MASK_AMOMAXU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
425 {"amomin.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMIN_W | MASK_RL, MASK_AMOMIN_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
426 {"amominu.w.rl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMINU_W | MASK_RL, MASK_AMOMINU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
427 {"lr.w.aqrl", 0, {"A", 0}, "d,0(s)", MATCH_LR_W | MASK_AQRL, MASK_LR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
428 {"sc.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_SC_W | MASK_AQRL, MASK_SC_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
429 {"amoadd.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOADD_W | MASK_AQRL, MASK_AMOADD_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
430 {"amoswap.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOSWAP_W | MASK_AQRL, MASK_AMOSWAP_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
431 {"amoand.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOAND_W | MASK_AQRL, MASK_AMOAND_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
432 {"amoor.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOOR_W | MASK_AQRL, MASK_AMOOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
433 {"amoxor.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOXOR_W | MASK_AQRL, MASK_AMOXOR_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
434 {"amomax.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAX_W | MASK_AQRL, MASK_AMOMAX_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
435 {"amomaxu.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMAXU_W | MASK_AQRL, MASK_AMOMAXU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
436 {"amomin.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMIN_W | MASK_AQRL, MASK_AMOMIN_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
437 {"amominu.w.aqrl", 0, {"A", 0}, "d,t,0(s)", MATCH_AMOMINU_W | MASK_AQRL, MASK_AMOMINU_W | MASK_AQRL, match_opcode, INSN_DREF|INSN_4_BYTE },
438 {"lr.d", 64, {"A", 0} , "d,0(s)", MATCH_LR_D, MASK_LR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
439 {"sc.d", 64, {"A", 0} , "d,t,0(s)", MATCH_SC_D, MASK_SC_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
440 {"amoadd.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOADD_D, MASK_AMOADD_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
441 {"amoswap.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOSWAP_D, MASK_AMOSWAP_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
442 {"amoand.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOAND_D, MASK_AMOAND_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
443 {"amoor.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOOR_D, MASK_AMOOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
444 {"amoxor.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOXOR_D, MASK_AMOXOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
445 {"amomax.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAX_D, MASK_AMOMAX_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
446 {"amomaxu.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAXU_D, MASK_AMOMAXU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
447 {"amomin.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMIN_D, MASK_AMOMIN_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
448 {"amominu.d", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMINU_D, MASK_AMOMINU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
449 {"lr.d.aq", 64, {"A", 0} , "d,0(s)", MATCH_LR_D | MASK_AQ, MASK_LR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
450 {"sc.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_SC_D | MASK_AQ, MASK_SC_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
451 {"amoadd.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOADD_D | MASK_AQ, MASK_AMOADD_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
452 {"amoswap.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOSWAP_D | MASK_AQ, MASK_AMOSWAP_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
453 {"amoand.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOAND_D | MASK_AQ, MASK_AMOAND_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
454 {"amoor.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOOR_D | MASK_AQ, MASK_AMOOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
455 {"amoxor.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOXOR_D | MASK_AQ, MASK_AMOXOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
456 {"amomax.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAX_D | MASK_AQ, MASK_AMOMAX_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
457 {"amomaxu.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAXU_D | MASK_AQ, MASK_AMOMAXU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
458 {"amomin.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMIN_D | MASK_AQ, MASK_AMOMIN_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
459 {"amominu.d.aq", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMINU_D | MASK_AQ, MASK_AMOMINU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
460 {"lr.d.rl", 64, {"A", 0} , "d,0(s)", MATCH_LR_D | MASK_RL, MASK_LR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
461 {"sc.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_SC_D | MASK_RL, MASK_SC_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
462 {"amoadd.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOADD_D | MASK_RL, MASK_AMOADD_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
463 {"amoswap.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOSWAP_D | MASK_RL, MASK_AMOSWAP_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
464 {"amoand.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOAND_D | MASK_RL, MASK_AMOAND_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
465 {"amoor.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOOR_D | MASK_RL, MASK_AMOOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
466 {"amoxor.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOXOR_D | MASK_RL, MASK_AMOXOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
467 {"amomax.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAX_D | MASK_RL, MASK_AMOMAX_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
468 {"amomaxu.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAXU_D | MASK_RL, MASK_AMOMAXU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
469 {"amomin.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMIN_D | MASK_RL, MASK_AMOMIN_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
470 {"amominu.d.rl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMINU_D | MASK_RL, MASK_AMOMINU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
471 {"lr.d.aqrl", 64, {"A", 0} , "d,0(s)", MATCH_LR_D | MASK_AQRL, MASK_LR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
472 {"sc.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_SC_D | MASK_AQRL, MASK_SC_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
473 {"amoadd.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOADD_D | MASK_AQRL, MASK_AMOADD_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
474 {"amoswap.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOSWAP_D | MASK_AQRL, MASK_AMOSWAP_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
475 {"amoand.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOAND_D | MASK_AQRL, MASK_AMOAND_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
476 {"amoor.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOOR_D | MASK_AQRL, MASK_AMOOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
477 {"amoxor.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOXOR_D | MASK_AQRL, MASK_AMOXOR_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
478 {"amomax.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAX_D | MASK_AQRL, MASK_AMOMAX_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
479 {"amomaxu.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMAXU_D | MASK_AQRL, MASK_AMOMAXU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
480 {"amomin.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMIN_D | MASK_AQRL, MASK_AMOMIN_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
481 {"amominu.d.aqrl", 64, {"A", 0} , "d,t,0(s)", MATCH_AMOMINU_D | MASK_AQRL, MASK_AMOMINU_D | MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
483 /* Multiply/Divide instruction subset */
484 {"mul", 0, {"M", 0}, "d,s,t", MATCH_MUL, MASK_MUL, match_opcode, 0 },
485 {"mulh", 0, {"M", 0}, "d,s,t", MATCH_MULH, MASK_MULH, match_opcode, 0 },
486 {"mulhu", 0, {"M", 0}, "d,s,t", MATCH_MULHU, MASK_MULHU, match_opcode, 0 },
487 {"mulhsu", 0, {"M", 0}, "d,s,t", MATCH_MULHSU, MASK_MULHSU, match_opcode, 0 },
488 {"div", 0, {"M", 0}, "d,s,t", MATCH_DIV, MASK_DIV, match_opcode, 0 },
489 {"divu", 0, {"M", 0}, "d,s,t", MATCH_DIVU, MASK_DIVU, match_opcode, 0 },
490 {"rem", 0, {"M", 0}, "d,s,t", MATCH_REM, MASK_REM, match_opcode, 0 },
491 {"remu", 0, {"M", 0}, "d,s,t", MATCH_REMU, MASK_REMU, match_opcode, 0 },
492 {"mulw", 64, {"M", 0}, "d,s,t", MATCH_MULW, MASK_MULW, match_opcode, 0 },
493 {"divw", 64, {"M", 0}, "d,s,t", MATCH_DIVW, MASK_DIVW, match_opcode, 0 },
494 {"divuw", 64, {"M", 0}, "d,s,t", MATCH_DIVUW, MASK_DIVUW, match_opcode, 0 },
495 {"remw", 64, {"M", 0}, "d,s,t", MATCH_REMW, MASK_REMW, match_opcode, 0 },
496 {"remuw", 64, {"M", 0}, "d,s,t", MATCH_REMUW, MASK_REMUW, match_opcode, 0 },
498 /* Single-precision floating-point instruction subset */
499 {"frsr", 0, {"F", 0}, "d", MATCH_FRCSR, MASK_FRCSR, match_opcode, 0 },
500 {"fssr", 0, {"F", 0}, "s", MATCH_FSCSR, MASK_FSCSR | MASK_RD, match_opcode, 0 },
501 {"fssr", 0, {"F", 0}, "d,s", MATCH_FSCSR, MASK_FSCSR, match_opcode, 0 },
502 {"frcsr", 0, {"F", 0}, "d", MATCH_FRCSR, MASK_FRCSR, match_opcode, 0 },
503 {"fscsr", 0, {"F", 0}, "s", MATCH_FSCSR, MASK_FSCSR | MASK_RD, match_opcode, 0 },
504 {"fscsr", 0, {"F", 0}, "d,s", MATCH_FSCSR, MASK_FSCSR, match_opcode, 0 },
505 {"frrm", 0, {"F", 0}, "d", MATCH_FRRM, MASK_FRRM, match_opcode, 0 },
506 {"fsrm", 0, {"F", 0}, "s", MATCH_FSRM, MASK_FSRM | MASK_RD, match_opcode, 0 },
507 {"fsrm", 0, {"F", 0}, "d,s", MATCH_FSRM, MASK_FSRM, match_opcode, 0 },
508 {"fsrmi", 0, {"F", 0}, "d,Z", MATCH_FSRMI, MASK_FSRMI, match_opcode, 0 },
509 {"fsrmi", 0, {"F", 0}, "Z", MATCH_FSRMI, MASK_FSRMI | MASK_RD, match_opcode, 0 },
510 {"frflags", 0, {"F", 0}, "d", MATCH_FRFLAGS, MASK_FRFLAGS, match_opcode, 0 },
511 {"fsflags", 0, {"F", 0}, "s", MATCH_FSFLAGS, MASK_FSFLAGS | MASK_RD, match_opcode, 0 },
512 {"fsflags", 0, {"F", 0}, "d,s", MATCH_FSFLAGS, MASK_FSFLAGS, match_opcode, 0 },
513 {"fsflagsi", 0, {"F", 0}, "d,Z", MATCH_FSFLAGSI, MASK_FSFLAGSI, match_opcode, 0 },
514 {"fsflagsi", 0, {"F", 0}, "Z", MATCH_FSFLAGSI, MASK_FSFLAGSI | MASK_RD, match_opcode, 0 },
515 {"flw", 32, {"F", "C", 0}, "D,Cm(Cc)", MATCH_C_FLWSP, MASK_C_FLWSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
516 {"flw", 32, {"F", "C", 0}, "CD,Ck(Cs)", MATCH_C_FLW, MASK_C_FLW, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
517 {"flw", 0, {"F", 0}, "D,o(s)", MATCH_FLW, MASK_FLW, match_opcode, INSN_DREF|INSN_4_BYTE },
518 {"flw", 0, {"F", 0}, "D,A,s", 0, (int) M_FLW, match_never, INSN_MACRO },
519 {"fsw", 32, {"F", "C", 0}, "CT,CM(Cc)", MATCH_C_FSWSP, MASK_C_FSWSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
520 {"fsw", 32, {"F", "C", 0}, "CD,Ck(Cs)", MATCH_C_FSW, MASK_C_FSW, match_opcode, INSN_ALIAS|INSN_DREF|INSN_4_BYTE },
521 {"fsw", 0, {"F", 0}, "T,q(s)", MATCH_FSW, MASK_FSW, match_opcode, INSN_DREF|INSN_4_BYTE },
522 {"fsw", 0, {"F", 0}, "T,A,s", 0, (int) M_FSW, match_never, INSN_MACRO },
524 {"fmv.x.w", 0, {"F", 0}, "d,S", MATCH_FMV_X_S, MASK_FMV_X_S, match_opcode, 0 },
525 {"fmv.w.x", 0, {"F", 0}, "D,s", MATCH_FMV_S_X, MASK_FMV_S_X, match_opcode, 0 },
527 {"fmv.x.s", 0, {"F", 0}, "d,S", MATCH_FMV_X_S, MASK_FMV_X_S, match_opcode, 0 },
528 {"fmv.s.x", 0, {"F", 0}, "D,s", MATCH_FMV_S_X, MASK_FMV_S_X, match_opcode, 0 },
530 {"fmv.s", 0, {"F", 0}, "D,U", MATCH_FSGNJ_S, MASK_FSGNJ_S, match_rs1_eq_rs2, INSN_ALIAS },
531 {"fneg.s", 0, {"F", 0}, "D,U", MATCH_FSGNJN_S, MASK_FSGNJN_S, match_rs1_eq_rs2, INSN_ALIAS },
532 {"fabs.s", 0, {"F", 0}, "D,U", MATCH_FSGNJX_S, MASK_FSGNJX_S, match_rs1_eq_rs2, INSN_ALIAS },
533 {"fsgnj.s", 0, {"F", 0}, "D,S,T", MATCH_FSGNJ_S, MASK_FSGNJ_S, match_opcode, 0 },
534 {"fsgnjn.s", 0, {"F", 0}, "D,S,T", MATCH_FSGNJN_S, MASK_FSGNJN_S, match_opcode, 0 },
535 {"fsgnjx.s", 0, {"F", 0}, "D,S,T", MATCH_FSGNJX_S, MASK_FSGNJX_S, match_opcode, 0 },
536 {"fadd.s", 0, {"F", 0}, "D,S,T", MATCH_FADD_S | MASK_RM, MASK_FADD_S | MASK_RM, match_opcode, 0 },
537 {"fadd.s", 0, {"F", 0}, "D,S,T,m", MATCH_FADD_S, MASK_FADD_S, match_opcode, 0 },
538 {"fsub.s", 0, {"F", 0}, "D,S,T", MATCH_FSUB_S | MASK_RM, MASK_FSUB_S | MASK_RM, match_opcode, 0 },
539 {"fsub.s", 0, {"F", 0}, "D,S,T,m", MATCH_FSUB_S, MASK_FSUB_S, match_opcode, 0 },
540 {"fmul.s", 0, {"F", 0}, "D,S,T", MATCH_FMUL_S | MASK_RM, MASK_FMUL_S | MASK_RM, match_opcode, 0 },
541 {"fmul.s", 0, {"F", 0}, "D,S,T,m", MATCH_FMUL_S, MASK_FMUL_S, match_opcode, 0 },
542 {"fdiv.s", 0, {"F", 0}, "D,S,T", MATCH_FDIV_S | MASK_RM, MASK_FDIV_S | MASK_RM, match_opcode, 0 },
543 {"fdiv.s", 0, {"F", 0}, "D,S,T,m", MATCH_FDIV_S, MASK_FDIV_S, match_opcode, 0 },
544 {"fsqrt.s", 0, {"F", 0}, "D,S", MATCH_FSQRT_S | MASK_RM, MASK_FSQRT_S | MASK_RM, match_opcode, 0 },
545 {"fsqrt.s", 0, {"F", 0}, "D,S,m", MATCH_FSQRT_S, MASK_FSQRT_S, match_opcode, 0 },
546 {"fmin.s", 0, {"F", 0}, "D,S,T", MATCH_FMIN_S, MASK_FMIN_S, match_opcode, 0 },
547 {"fmax.s", 0, {"F", 0}, "D,S,T", MATCH_FMAX_S, MASK_FMAX_S, match_opcode, 0 },
548 {"fmadd.s", 0, {"F", 0}, "D,S,T,R", MATCH_FMADD_S | MASK_RM, MASK_FMADD_S | MASK_RM, match_opcode, 0 },
549 {"fmadd.s", 0, {"F", 0}, "D,S,T,R,m", MATCH_FMADD_S, MASK_FMADD_S, match_opcode, 0 },
550 {"fnmadd.s", 0, {"F", 0}, "D,S,T,R", MATCH_FNMADD_S | MASK_RM, MASK_FNMADD_S | MASK_RM, match_opcode, 0 },
551 {"fnmadd.s", 0, {"F", 0}, "D,S,T,R,m", MATCH_FNMADD_S, MASK_FNMADD_S, match_opcode, 0 },
552 {"fmsub.s", 0, {"F", 0}, "D,S,T,R", MATCH_FMSUB_S | MASK_RM, MASK_FMSUB_S | MASK_RM, match_opcode, 0 },
553 {"fmsub.s", 0, {"F", 0}, "D,S,T,R,m", MATCH_FMSUB_S, MASK_FMSUB_S, match_opcode, 0 },
554 {"fnmsub.s", 0, {"F", 0}, "D,S,T,R", MATCH_FNMSUB_S | MASK_RM, MASK_FNMSUB_S | MASK_RM, match_opcode, 0 },
555 {"fnmsub.s", 0, {"F", 0}, "D,S,T,R,m", MATCH_FNMSUB_S, MASK_FNMSUB_S, match_opcode, 0 },
556 {"fcvt.w.s", 0, {"F", 0}, "d,S", MATCH_FCVT_W_S | MASK_RM, MASK_FCVT_W_S | MASK_RM, match_opcode, 0 },
557 {"fcvt.w.s", 0, {"F", 0}, "d,S,m", MATCH_FCVT_W_S, MASK_FCVT_W_S, match_opcode, 0 },
558 {"fcvt.wu.s", 0, {"F", 0}, "d,S", MATCH_FCVT_WU_S | MASK_RM, MASK_FCVT_WU_S | MASK_RM, match_opcode, 0 },
559 {"fcvt.wu.s", 0, {"F", 0}, "d,S,m", MATCH_FCVT_WU_S, MASK_FCVT_WU_S, match_opcode, 0 },
560 {"fcvt.s.w", 0, {"F", 0}, "D,s", MATCH_FCVT_S_W | MASK_RM, MASK_FCVT_S_W | MASK_RM, match_opcode, 0 },
561 {"fcvt.s.w", 0, {"F", 0}, "D,s,m", MATCH_FCVT_S_W, MASK_FCVT_S_W, match_opcode, 0 },
562 {"fcvt.s.wu", 0, {"F", 0}, "D,s", MATCH_FCVT_S_WU | MASK_RM, MASK_FCVT_S_W | MASK_RM, match_opcode, 0 },
563 {"fcvt.s.wu", 0, {"F", 0}, "D,s,m", MATCH_FCVT_S_WU, MASK_FCVT_S_WU, match_opcode, 0 },
564 {"fclass.s", 0, {"F", 0}, "d,S", MATCH_FCLASS_S, MASK_FCLASS_S, match_opcode, 0 },
565 {"feq.s", 0, {"F", 0}, "d,S,T", MATCH_FEQ_S, MASK_FEQ_S, match_opcode, 0 },
566 {"flt.s", 0, {"F", 0}, "d,S,T", MATCH_FLT_S, MASK_FLT_S, match_opcode, 0 },
567 {"fle.s", 0, {"F", 0}, "d,S,T", MATCH_FLE_S, MASK_FLE_S, match_opcode, 0 },
568 {"fgt.s", 0, {"F", 0}, "d,T,S", MATCH_FLT_S, MASK_FLT_S, match_opcode, 0 },
569 {"fge.s", 0, {"F", 0}, "d,T,S", MATCH_FLE_S, MASK_FLE_S, match_opcode, 0 },
570 {"fcvt.l.s", 64, {"F", 0}, "d,S", MATCH_FCVT_L_S | MASK_RM, MASK_FCVT_L_S | MASK_RM, match_opcode, 0 },
571 {"fcvt.l.s", 64, {"F", 0}, "d,S,m", MATCH_FCVT_L_S, MASK_FCVT_L_S, match_opcode, 0 },
572 {"fcvt.lu.s", 64, {"F", 0}, "d,S", MATCH_FCVT_LU_S | MASK_RM, MASK_FCVT_LU_S | MASK_RM, match_opcode, 0 },
573 {"fcvt.lu.s", 64, {"F", 0}, "d,S,m", MATCH_FCVT_LU_S, MASK_FCVT_LU_S, match_opcode, 0 },
574 {"fcvt.s.l", 64, {"F", 0}, "D,s", MATCH_FCVT_S_L | MASK_RM, MASK_FCVT_S_L | MASK_RM, match_opcode, 0 },
575 {"fcvt.s.l", 64, {"F", 0}, "D,s,m", MATCH_FCVT_S_L, MASK_FCVT_S_L, match_opcode, 0 },
576 {"fcvt.s.lu", 64, {"F", 0}, "D,s", MATCH_FCVT_S_LU | MASK_RM, MASK_FCVT_S_L | MASK_RM, match_opcode, 0 },
577 {"fcvt.s.lu", 64, {"F", 0}, "D,s,m", MATCH_FCVT_S_LU, MASK_FCVT_S_LU, match_opcode, 0 },
579 /* Double-precision floating-point instruction subset */
580 {"fld", 0, {"D", "C", 0}, "D,Cn(Cc)", MATCH_C_FLDSP, MASK_C_FLDSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
581 {"fld", 0, {"D", "C", 0}, "CD,Cl(Cs)", MATCH_C_FLD, MASK_C_FLD, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
582 {"fld", 0, {"D", 0}, "D,o(s)", MATCH_FLD, MASK_FLD, match_opcode, INSN_DREF|INSN_8_BYTE },
583 {"fld", 0, {"D", 0}, "D,A,s", 0, (int) M_FLD, match_never, INSN_MACRO },
584 {"fsd", 0, {"D", "C", 0}, "CT,CN(Cc)", MATCH_C_FSDSP, MASK_C_FSDSP, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
585 {"fsd", 0, {"D", "C", 0}, "CD,Cl(Cs)", MATCH_C_FSD, MASK_C_FSD, match_opcode, INSN_ALIAS|INSN_DREF|INSN_8_BYTE },
586 {"fsd", 0, {"D", 0}, "T,q(s)", MATCH_FSD, MASK_FSD, match_opcode, INSN_DREF|INSN_8_BYTE },
587 {"fsd", 0, {"D", 0}, "T,A,s", 0, (int) M_FSD, match_never, INSN_MACRO },
588 {"fmv.d", 0, {"D", 0}, "D,U", MATCH_FSGNJ_D, MASK_FSGNJ_D, match_rs1_eq_rs2, INSN_ALIAS },
589 {"fneg.d", 0, {"D", 0}, "D,U", MATCH_FSGNJN_D, MASK_FSGNJN_D, match_rs1_eq_rs2, INSN_ALIAS },
590 {"fabs.d", 0, {"D", 0}, "D,U", MATCH_FSGNJX_D, MASK_FSGNJX_D, match_rs1_eq_rs2, INSN_ALIAS },
591 {"fsgnj.d", 0, {"D", 0}, "D,S,T", MATCH_FSGNJ_D, MASK_FSGNJ_D, match_opcode, 0 },
592 {"fsgnjn.d", 0, {"D", 0}, "D,S,T", MATCH_FSGNJN_D, MASK_FSGNJN_D, match_opcode, 0 },
593 {"fsgnjx.d", 0, {"D", 0}, "D,S,T", MATCH_FSGNJX_D, MASK_FSGNJX_D, match_opcode, 0 },
594 {"fadd.d", 0, {"D", 0}, "D,S,T", MATCH_FADD_D | MASK_RM, MASK_FADD_D | MASK_RM, match_opcode, 0 },
595 {"fadd.d", 0, {"D", 0}, "D,S,T,m", MATCH_FADD_D, MASK_FADD_D, match_opcode, 0 },
596 {"fsub.d", 0, {"D", 0}, "D,S,T", MATCH_FSUB_D | MASK_RM, MASK_FSUB_D | MASK_RM, match_opcode, 0 },
597 {"fsub.d", 0, {"D", 0}, "D,S,T,m", MATCH_FSUB_D, MASK_FSUB_D, match_opcode, 0 },
598 {"fmul.d", 0, {"D", 0}, "D,S,T", MATCH_FMUL_D | MASK_RM, MASK_FMUL_D | MASK_RM, match_opcode, 0 },
599 {"fmul.d", 0, {"D", 0}, "D,S,T,m", MATCH_FMUL_D, MASK_FMUL_D, match_opcode, 0 },
600 {"fdiv.d", 0, {"D", 0}, "D,S,T", MATCH_FDIV_D | MASK_RM, MASK_FDIV_D | MASK_RM, match_opcode, 0 },
601 {"fdiv.d", 0, {"D", 0}, "D,S,T,m", MATCH_FDIV_D, MASK_FDIV_D, match_opcode, 0 },
602 {"fsqrt.d", 0, {"D", 0}, "D,S", MATCH_FSQRT_D | MASK_RM, MASK_FSQRT_D | MASK_RM, match_opcode, 0 },
603 {"fsqrt.d", 0, {"D", 0}, "D,S,m", MATCH_FSQRT_D, MASK_FSQRT_D, match_opcode, 0 },
604 {"fmin.d", 0, {"D", 0}, "D,S,T", MATCH_FMIN_D, MASK_FMIN_D, match_opcode, 0 },
605 {"fmax.d", 0, {"D", 0}, "D,S,T", MATCH_FMAX_D, MASK_FMAX_D, match_opcode, 0 },
606 {"fmadd.d", 0, {"D", 0}, "D,S,T,R", MATCH_FMADD_D | MASK_RM, MASK_FMADD_D | MASK_RM, match_opcode, 0 },
607 {"fmadd.d", 0, {"D", 0}, "D,S,T,R,m", MATCH_FMADD_D, MASK_FMADD_D, match_opcode, 0 },
608 {"fnmadd.d", 0, {"D", 0}, "D,S,T,R", MATCH_FNMADD_D | MASK_RM, MASK_FNMADD_D | MASK_RM, match_opcode, 0 },
609 {"fnmadd.d", 0, {"D", 0}, "D,S,T,R,m", MATCH_FNMADD_D, MASK_FNMADD_D, match_opcode, 0 },
610 {"fmsub.d", 0, {"D", 0}, "D,S,T,R", MATCH_FMSUB_D | MASK_RM, MASK_FMSUB_D | MASK_RM, match_opcode, 0 },
611 {"fmsub.d", 0, {"D", 0}, "D,S,T,R,m", MATCH_FMSUB_D, MASK_FMSUB_D, match_opcode, 0 },
612 {"fnmsub.d", 0, {"D", 0}, "D,S,T,R", MATCH_FNMSUB_D | MASK_RM, MASK_FNMSUB_D | MASK_RM, match_opcode, 0 },
613 {"fnmsub.d", 0, {"D", 0}, "D,S,T,R,m", MATCH_FNMSUB_D, MASK_FNMSUB_D, match_opcode, 0 },
614 {"fcvt.w.d", 0, {"D", 0}, "d,S", MATCH_FCVT_W_D | MASK_RM, MASK_FCVT_W_D | MASK_RM, match_opcode, 0 },
615 {"fcvt.w.d", 0, {"D", 0}, "d,S,m", MATCH_FCVT_W_D, MASK_FCVT_W_D, match_opcode, 0 },
616 {"fcvt.wu.d", 0, {"D", 0}, "d,S", MATCH_FCVT_WU_D | MASK_RM, MASK_FCVT_WU_D | MASK_RM, match_opcode, 0 },
617 {"fcvt.wu.d", 0, {"D", 0}, "d,S,m", MATCH_FCVT_WU_D, MASK_FCVT_WU_D, match_opcode, 0 },
618 {"fcvt.d.w", 0, {"D", 0}, "D,s", MATCH_FCVT_D_W, MASK_FCVT_D_W | MASK_RM, match_opcode, 0 },
619 {"fcvt.d.wu", 0, {"D", 0}, "D,s", MATCH_FCVT_D_WU, MASK_FCVT_D_WU | MASK_RM, match_opcode, 0 },
620 {"fcvt.d.s", 0, {"D", 0}, "D,S", MATCH_FCVT_D_S, MASK_FCVT_D_S | MASK_RM, match_opcode, 0 },
621 {"fcvt.s.d", 0, {"D", 0}, "D,S", MATCH_FCVT_S_D | MASK_RM, MASK_FCVT_S_D | MASK_RM, match_opcode, 0 },
622 {"fcvt.s.d", 0, {"D", 0}, "D,S,m", MATCH_FCVT_S_D, MASK_FCVT_S_D, match_opcode, 0 },
623 {"fclass.d", 0, {"D", 0}, "d,S", MATCH_FCLASS_D, MASK_FCLASS_D, match_opcode, 0 },
624 {"feq.d", 0, {"D", 0}, "d,S,T", MATCH_FEQ_D, MASK_FEQ_D, match_opcode, 0 },
625 {"flt.d", 0, {"D", 0}, "d,S,T", MATCH_FLT_D, MASK_FLT_D, match_opcode, 0 },
626 {"fle.d", 0, {"D", 0}, "d,S,T", MATCH_FLE_D, MASK_FLE_D, match_opcode, 0 },
627 {"fgt.d", 0, {"D", 0}, "d,T,S", MATCH_FLT_D, MASK_FLT_D, match_opcode, 0 },
628 {"fge.d", 0, {"D", 0}, "d,T,S", MATCH_FLE_D, MASK_FLE_D, match_opcode, 0 },
629 {"fmv.x.d", 64, {"D", 0}, "d,S", MATCH_FMV_X_D, MASK_FMV_X_D, match_opcode, 0 },
630 {"fmv.d.x", 64, {"D", 0}, "D,s", MATCH_FMV_D_X, MASK_FMV_D_X, match_opcode, 0 },
631 {"fcvt.l.d", 64, {"D", 0}, "d,S", MATCH_FCVT_L_D | MASK_RM, MASK_FCVT_L_D | MASK_RM, match_opcode, 0 },
632 {"fcvt.l.d", 64, {"D", 0}, "d,S,m", MATCH_FCVT_L_D, MASK_FCVT_L_D, match_opcode, 0 },
633 {"fcvt.lu.d", 64, {"D", 0}, "d,S", MATCH_FCVT_LU_D | MASK_RM, MASK_FCVT_LU_D | MASK_RM, match_opcode, 0 },
634 {"fcvt.lu.d", 64, {"D", 0}, "d,S,m", MATCH_FCVT_LU_D, MASK_FCVT_LU_D, match_opcode, 0 },
635 {"fcvt.d.l", 64, {"D", 0}, "D,s", MATCH_FCVT_D_L | MASK_RM, MASK_FCVT_D_L | MASK_RM, match_opcode, 0 },
636 {"fcvt.d.l", 64, {"D", 0}, "D,s,m", MATCH_FCVT_D_L, MASK_FCVT_D_L, match_opcode, 0 },
637 {"fcvt.d.lu", 64, {"D", 0}, "D,s", MATCH_FCVT_D_LU | MASK_RM, MASK_FCVT_D_L | MASK_RM, match_opcode, 0 },
638 {"fcvt.d.lu", 64, {"D", 0}, "D,s,m", MATCH_FCVT_D_LU, MASK_FCVT_D_LU, match_opcode, 0 },
640 /* Quad-precision floating-point instruction subset */
641 {"flq", 0, {"Q", 0}, "D,o(s)", MATCH_FLQ, MASK_FLQ, match_opcode, INSN_DREF|INSN_16_BYTE },
642 {"flq", 0, {"Q", 0}, "D,A,s", 0, (int) M_FLQ, match_never, INSN_MACRO },
643 {"fsq", 0, {"Q", 0}, "T,q(s)", MATCH_FSQ, MASK_FSQ, match_opcode, INSN_DREF|INSN_16_BYTE },
644 {"fsq", 0, {"Q", 0}, "T,A,s", 0, (int) M_FSQ, match_never, INSN_MACRO },
645 {"fmv.q", 0, {"Q", 0}, "D,U", MATCH_FSGNJ_Q, MASK_FSGNJ_Q, match_rs1_eq_rs2, INSN_ALIAS },
646 {"fneg.q", 0, {"Q", 0}, "D,U", MATCH_FSGNJN_Q, MASK_FSGNJN_Q, match_rs1_eq_rs2, INSN_ALIAS },
647 {"fabs.q", 0, {"Q", 0}, "D,U", MATCH_FSGNJX_Q, MASK_FSGNJX_Q, match_rs1_eq_rs2, INSN_ALIAS },
648 {"fsgnj.q", 0, {"Q", 0}, "D,S,T", MATCH_FSGNJ_Q, MASK_FSGNJ_Q, match_opcode, 0 },
649 {"fsgnjn.q", 0, {"Q", 0}, "D,S,T", MATCH_FSGNJN_Q, MASK_FSGNJN_Q, match_opcode, 0 },
650 {"fsgnjx.q", 0, {"Q", 0}, "D,S,T", MATCH_FSGNJX_Q, MASK_FSGNJX_Q, match_opcode, 0 },
651 {"fadd.q", 0, {"Q", 0}, "D,S,T", MATCH_FADD_Q | MASK_RM, MASK_FADD_Q | MASK_RM, match_opcode, 0 },
652 {"fadd.q", 0, {"Q", 0}, "D,S,T,m", MATCH_FADD_Q, MASK_FADD_Q, match_opcode, 0 },
653 {"fsub.q", 0, {"Q", 0}, "D,S,T", MATCH_FSUB_Q | MASK_RM, MASK_FSUB_Q | MASK_RM, match_opcode, 0 },
654 {"fsub.q", 0, {"Q", 0}, "D,S,T,m", MATCH_FSUB_Q, MASK_FSUB_Q, match_opcode, 0 },
655 {"fmul.q", 0, {"Q", 0}, "D,S,T", MATCH_FMUL_Q | MASK_RM, MASK_FMUL_Q | MASK_RM, match_opcode, 0 },
656 {"fmul.q", 0, {"Q", 0}, "D,S,T,m", MATCH_FMUL_Q, MASK_FMUL_Q, match_opcode, 0 },
657 {"fdiv.q", 0, {"Q", 0}, "D,S,T", MATCH_FDIV_Q | MASK_RM, MASK_FDIV_Q | MASK_RM, match_opcode, 0 },
658 {"fdiv.q", 0, {"Q", 0}, "D,S,T,m", MATCH_FDIV_Q, MASK_FDIV_Q, match_opcode, 0 },
659 {"fsqrt.q", 0, {"Q", 0}, "D,S", MATCH_FSQRT_Q | MASK_RM, MASK_FSQRT_Q | MASK_RM, match_opcode, 0 },
660 {"fsqrt.q", 0, {"Q", 0}, "D,S,m", MATCH_FSQRT_Q, MASK_FSQRT_Q, match_opcode, 0 },
661 {"fmin.q", 0, {"Q", 0}, "D,S,T", MATCH_FMIN_Q, MASK_FMIN_Q, match_opcode, 0 },
662 {"fmax.q", 0, {"Q", 0}, "D,S,T", MATCH_FMAX_Q, MASK_FMAX_Q, match_opcode, 0 },
663 {"fmadd.q", 0, {"Q", 0}, "D,S,T,R", MATCH_FMADD_Q | MASK_RM, MASK_FMADD_Q | MASK_RM, match_opcode, 0 },
664 {"fmadd.q", 0, {"Q", 0}, "D,S,T,R,m", MATCH_FMADD_Q, MASK_FMADD_Q, match_opcode, 0 },
665 {"fnmadd.q", 0, {"Q", 0}, "D,S,T,R", MATCH_FNMADD_Q | MASK_RM, MASK_FNMADD_Q | MASK_RM, match_opcode, 0 },
666 {"fnmadd.q", 0, {"Q", 0}, "D,S,T,R,m", MATCH_FNMADD_Q, MASK_FNMADD_Q, match_opcode, 0 },
667 {"fmsub.q", 0, {"Q", 0}, "D,S,T,R", MATCH_FMSUB_Q | MASK_RM, MASK_FMSUB_Q | MASK_RM, match_opcode, 0 },
668 {"fmsub.q", 0, {"Q", 0}, "D,S,T,R,m", MATCH_FMSUB_Q, MASK_FMSUB_Q, match_opcode, 0 },
669 {"fnmsub.q", 0, {"Q", 0}, "D,S,T,R", MATCH_FNMSUB_Q | MASK_RM, MASK_FNMSUB_Q | MASK_RM, match_opcode, 0 },
670 {"fnmsub.q", 0, {"Q", 0}, "D,S,T,R,m", MATCH_FNMSUB_Q, MASK_FNMSUB_Q, match_opcode, 0 },
671 {"fcvt.w.q", 0, {"Q", 0}, "d,S", MATCH_FCVT_W_Q | MASK_RM, MASK_FCVT_W_Q | MASK_RM, match_opcode, 0 },
672 {"fcvt.w.q", 0, {"Q", 0}, "d,S,m", MATCH_FCVT_W_Q, MASK_FCVT_W_Q, match_opcode, 0 },
673 {"fcvt.wu.q", 0, {"Q", 0}, "d,S", MATCH_FCVT_WU_Q | MASK_RM, MASK_FCVT_WU_Q | MASK_RM, match_opcode, 0 },
674 {"fcvt.wu.q", 0, {"Q", 0}, "d,S,m", MATCH_FCVT_WU_Q, MASK_FCVT_WU_Q, match_opcode, 0 },
675 {"fcvt.q.w", 0, {"Q", 0}, "D,s", MATCH_FCVT_Q_W, MASK_FCVT_Q_W | MASK_RM, match_opcode, 0 },
676 {"fcvt.q.wu", 0, {"Q", 0}, "D,s", MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU | MASK_RM, match_opcode, 0 },
677 {"fcvt.q.s", 0, {"Q", 0}, "D,S", MATCH_FCVT_Q_S, MASK_FCVT_Q_S | MASK_RM, match_opcode, 0 },
678 {"fcvt.q.d", 0, {"Q", 0}, "D,S", MATCH_FCVT_Q_D, MASK_FCVT_Q_D | MASK_RM, match_opcode, 0 },
679 {"fcvt.s.q", 0, {"Q", 0}, "D,S", MATCH_FCVT_S_Q | MASK_RM, MASK_FCVT_S_Q | MASK_RM, match_opcode, 0 },
680 {"fcvt.s.q", 0, {"Q", 0}, "D,S,m", MATCH_FCVT_S_Q, MASK_FCVT_S_Q, match_opcode, 0 },
681 {"fcvt.d.q", 0, {"Q", 0}, "D,S", MATCH_FCVT_D_Q | MASK_RM, MASK_FCVT_D_Q | MASK_RM, match_opcode, 0 },
682 {"fcvt.d.q", 0, {"Q", 0}, "D,S,m", MATCH_FCVT_D_Q, MASK_FCVT_D_Q, match_opcode, 0 },
683 {"fclass.q", 0, {"Q", 0}, "d,S", MATCH_FCLASS_Q, MASK_FCLASS_Q, match_opcode, 0 },
684 {"feq.q", 0, {"Q", 0}, "d,S,T", MATCH_FEQ_Q, MASK_FEQ_Q, match_opcode, 0 },
685 {"flt.q", 0, {"Q", 0}, "d,S,T", MATCH_FLT_Q, MASK_FLT_Q, match_opcode, 0 },
686 {"fle.q", 0, {"Q", 0}, "d,S,T", MATCH_FLE_Q, MASK_FLE_Q, match_opcode, 0 },
687 {"fgt.q", 0, {"Q", 0}, "d,T,S", MATCH_FLT_Q, MASK_FLT_Q, match_opcode, 0 },
688 {"fge.q", 0, {"Q", 0}, "d,T,S", MATCH_FLE_Q, MASK_FLE_Q, match_opcode, 0 },
689 {"fmv.x.q", 64, {"Q", 0}, "d,S", MATCH_FMV_X_Q, MASK_FMV_X_Q, match_opcode, 0 },
690 {"fmv.q.x", 64, {"Q", 0}, "D,s", MATCH_FMV_Q_X, MASK_FMV_Q_X, match_opcode, 0 },
691 {"fcvt.l.q", 64, {"Q", 0}, "d,S", MATCH_FCVT_L_Q | MASK_RM, MASK_FCVT_L_Q | MASK_RM, match_opcode, 0 },
692 {"fcvt.l.q", 64, {"Q", 0}, "d,S,m", MATCH_FCVT_L_Q, MASK_FCVT_L_Q, match_opcode, 0 },
693 {"fcvt.lu.q", 64, {"Q", 0}, "d,S", MATCH_FCVT_LU_Q | MASK_RM, MASK_FCVT_LU_Q | MASK_RM, match_opcode, 0 },
694 {"fcvt.lu.q", 64, {"Q", 0}, "d,S,m", MATCH_FCVT_LU_Q, MASK_FCVT_LU_Q, match_opcode, 0 },
695 {"fcvt.q.l", 64, {"Q", 0}, "D,s", MATCH_FCVT_Q_L | MASK_RM, MASK_FCVT_Q_L | MASK_RM, match_opcode, 0 },
696 {"fcvt.q.l", 64, {"Q", 0}, "D,s,m", MATCH_FCVT_Q_L, MASK_FCVT_Q_L, match_opcode, 0 },
697 {"fcvt.q.lu", 64, {"Q", 0}, "D,s", MATCH_FCVT_Q_LU | MASK_RM, MASK_FCVT_Q_L | MASK_RM, match_opcode, 0 },
698 {"fcvt.q.lu", 64, {"Q", 0}, "D,s,m", MATCH_FCVT_Q_LU, MASK_FCVT_Q_LU, match_opcode, 0 },
700 /* Compressed instructions. */
701 {"c.unimp", 0, {"C", 0}, "", 0, 0xffffU, match_opcode, 0 },
702 {"c.ebreak", 0, {"C", 0}, "", MATCH_C_EBREAK, MASK_C_EBREAK, match_opcode, 0 },
703 {"c.jr", 0, {"C", 0}, "d", MATCH_C_JR, MASK_C_JR, match_rd_nonzero, INSN_BRANCH },
704 {"c.jalr", 0, {"C", 0}, "d", MATCH_C_JALR, MASK_C_JALR, match_rd_nonzero, INSN_JSR },
705 {"c.j", 0, {"C", 0}, "Ca", MATCH_C_J, MASK_C_J, match_opcode, INSN_BRANCH },
706 {"c.jal", 32, {"C", 0}, "Ca", MATCH_C_JAL, MASK_C_JAL, match_opcode, INSN_JSR },
707 {"c.beqz", 0, {"C", 0}, "Cs,Cp", MATCH_C_BEQZ, MASK_C_BEQZ, match_opcode, INSN_CONDBRANCH },
708 {"c.bnez", 0, {"C", 0}, "Cs,Cp", MATCH_C_BNEZ, MASK_C_BNEZ, match_opcode, INSN_CONDBRANCH },
709 {"c.lwsp", 0, {"C", 0}, "d,Cm(Cc)", MATCH_C_LWSP, MASK_C_LWSP, match_rd_nonzero, 0 },
710 {"c.lw", 0, {"C", 0}, "Ct,Ck(Cs)", MATCH_C_LW, MASK_C_LW, match_opcode, INSN_DREF|INSN_4_BYTE },
711 {"c.swsp", 0, {"C", 0}, "CV,CM(Cc)", MATCH_C_SWSP, MASK_C_SWSP, match_opcode, INSN_DREF|INSN_4_BYTE },
712 {"c.sw", 0, {"C", 0}, "Ct,Ck(Cs)", MATCH_C_SW, MASK_C_SW, match_opcode, INSN_DREF|INSN_4_BYTE },
713 {"c.nop", 0, {"C", 0}, "", MATCH_C_ADDI, 0xffff, match_opcode, INSN_ALIAS },
714 {"c.nop", 0, {"C", 0}, "Cj", MATCH_C_ADDI, MASK_C_ADDI | MASK_RD, match_opcode, INSN_ALIAS },
715 {"c.mv", 0, {"C", 0}, "d,CV", MATCH_C_MV, MASK_C_MV, match_c_add_with_hint, 0 },
716 {"c.lui", 0, {"C", 0}, "d,Cu", MATCH_C_LUI, MASK_C_LUI, match_c_lui_with_hint, 0 },
717 {"c.li", 0, {"C", 0}, "d,Co", MATCH_C_LI, MASK_C_LI, match_opcode, 0 },
718 {"c.addi4spn", 0, {"C", 0}, "Ct,Cc,CK", MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN, match_c_addi4spn, 0 },
719 {"c.addi16sp", 0, {"C", 0}, "Cc,CL", MATCH_C_ADDI16SP, MASK_C_ADDI16SP, match_c_addi16sp, 0 },
720 {"c.addi", 0, {"C", 0}, "d,Co", MATCH_C_ADDI, MASK_C_ADDI, match_opcode, 0 },
721 {"c.add", 0, {"C", 0}, "d,CV", MATCH_C_ADD, MASK_C_ADD, match_c_add_with_hint, 0 },
722 {"c.sub", 0, {"C", 0}, "Cs,Ct", MATCH_C_SUB, MASK_C_SUB, match_opcode, 0 },
723 {"c.and", 0, {"C", 0}, "Cs,Ct", MATCH_C_AND, MASK_C_AND, match_opcode, 0 },
724 {"c.or", 0, {"C", 0}, "Cs,Ct", MATCH_C_OR, MASK_C_OR, match_opcode, 0 },
725 {"c.xor", 0, {"C", 0}, "Cs,Ct", MATCH_C_XOR, MASK_C_XOR, match_opcode, 0 },
726 {"c.slli", 0, {"C", 0}, "d,C>", MATCH_C_SLLI, MASK_C_SLLI, match_c_slli, 0 },
727 {"c.srli", 0, {"C", 0}, "Cs,C>", MATCH_C_SRLI, MASK_C_SRLI, match_c_slli, 0 },
728 {"c.srai", 0, {"C", 0}, "Cs,C>", MATCH_C_SRAI, MASK_C_SRAI, match_c_slli, 0 },
729 {"c.slli64", 0, {"C", 0}, "d", MATCH_C_SLLI64, MASK_C_SLLI64, match_c_slli64, 0 },
730 {"c.srli64", 0, {"C", 0}, "Cs", MATCH_C_SRLI64, MASK_C_SRLI64, match_c_slli64, 0 },
731 {"c.srai64", 0, {"C", 0}, "Cs", MATCH_C_SRAI64, MASK_C_SRAI64, match_c_slli64, 0 },
732 {"c.andi", 0, {"C", 0}, "Cs,Co", MATCH_C_ANDI, MASK_C_ANDI, match_opcode, 0 },
733 {"c.addiw", 64, {"C", 0}, "d,Co", MATCH_C_ADDIW, MASK_C_ADDIW, match_rd_nonzero, 0 },
734 {"c.addw", 64, {"C", 0}, "Cs,Ct", MATCH_C_ADDW, MASK_C_ADDW, match_opcode, 0 },
735 {"c.subw", 64, {"C", 0}, "Cs,Ct", MATCH_C_SUBW, MASK_C_SUBW, match_opcode, 0 },
736 {"c.ldsp", 64, {"C", 0}, "d,Cn(Cc)", MATCH_C_LDSP, MASK_C_LDSP, match_rd_nonzero, INSN_DREF|INSN_8_BYTE },
737 {"c.ld", 64, {"C", 0}, "Ct,Cl(Cs)", MATCH_C_LD, MASK_C_LD, match_opcode, INSN_DREF|INSN_8_BYTE },
738 {"c.sdsp", 64, {"C", 0}, "CV,CN(Cc)", MATCH_C_SDSP, MASK_C_SDSP, match_opcode, INSN_DREF|INSN_8_BYTE },
739 {"c.sd", 64, {"C", 0}, "Ct,Cl(Cs)", MATCH_C_SD, MASK_C_SD, match_opcode, INSN_DREF|INSN_8_BYTE },
740 {"c.fldsp", 0, {"D", "C", 0}, "D,Cn(Cc)", MATCH_C_FLDSP, MASK_C_FLDSP, match_opcode, INSN_DREF|INSN_8_BYTE },
741 {"c.fld", 0, {"D", "C", 0}, "CD,Cl(Cs)", MATCH_C_FLD, MASK_C_FLD, match_opcode, INSN_DREF|INSN_8_BYTE },
742 {"c.fsdsp", 0, {"D", "C", 0}, "CT,CN(Cc)", MATCH_C_FSDSP, MASK_C_FSDSP, match_opcode, INSN_DREF|INSN_8_BYTE },
743 {"c.fsd", 0, {"D", "C", 0}, "CD,Cl(Cs)", MATCH_C_FSD, MASK_C_FSD, match_opcode, INSN_DREF|INSN_8_BYTE },
744 {"c.flwsp", 32, {"F", "C", 0}, "D,Cm(Cc)", MATCH_C_FLWSP, MASK_C_FLWSP, match_opcode, INSN_DREF|INSN_4_BYTE },
745 {"c.flw", 32, {"F", "C", 0}, "CD,Ck(Cs)", MATCH_C_FLW, MASK_C_FLW, match_opcode, INSN_DREF|INSN_4_BYTE },
746 {"c.fswsp", 32, {"F", "C", 0}, "CT,CM(Cc)", MATCH_C_FSWSP, MASK_C_FSWSP, match_opcode, INSN_DREF|INSN_4_BYTE },
747 {"c.fsw", 32, {"F", "C", 0}, "CD,Ck(Cs)", MATCH_C_FSW, MASK_C_FSW, match_opcode, INSN_DREF|INSN_4_BYTE },
749 /* Supervisor instructions */
750 {"csrr", 0, {"I", 0}, "d,E", MATCH_CSRRS, MASK_CSRRS | MASK_RS1, match_opcode, INSN_ALIAS },
751 {"csrwi", 0, {"I", 0}, "E,Z", MATCH_CSRRWI, MASK_CSRRWI | MASK_RD, match_opcode, INSN_ALIAS },
752 {"csrsi", 0, {"I", 0}, "E,Z", MATCH_CSRRSI, MASK_CSRRSI | MASK_RD, match_opcode, INSN_ALIAS },
753 {"csrci", 0, {"I", 0}, "E,Z", MATCH_CSRRCI, MASK_CSRRCI | MASK_RD, match_opcode, INSN_ALIAS },
754 {"csrw", 0, {"I", 0}, "E,s", MATCH_CSRRW, MASK_CSRRW | MASK_RD, match_opcode, INSN_ALIAS },
755 {"csrw", 0, {"I", 0}, "E,Z", MATCH_CSRRWI, MASK_CSRRWI | MASK_RD, match_opcode, INSN_ALIAS },
756 {"csrs", 0, {"I", 0}, "E,s", MATCH_CSRRS, MASK_CSRRS | MASK_RD, match_opcode, INSN_ALIAS },
757 {"csrs", 0, {"I", 0}, "E,Z", MATCH_CSRRSI, MASK_CSRRSI | MASK_RD, match_opcode, INSN_ALIAS },
758 {"csrc", 0, {"I", 0}, "E,s", MATCH_CSRRC, MASK_CSRRC | MASK_RD, match_opcode, INSN_ALIAS },
759 {"csrc", 0, {"I", 0}, "E,Z", MATCH_CSRRCI, MASK_CSRRCI | MASK_RD, match_opcode, INSN_ALIAS },
760 {"csrrwi", 0, {"I", 0}, "d,E,Z", MATCH_CSRRWI, MASK_CSRRWI, match_opcode, 0 },
761 {"csrrsi", 0, {"I", 0}, "d,E,Z", MATCH_CSRRSI, MASK_CSRRSI, match_opcode, 0 },
762 {"csrrci", 0, {"I", 0}, "d,E,Z", MATCH_CSRRCI, MASK_CSRRCI, match_opcode, 0 },
763 {"csrrw", 0, {"I", 0}, "d,E,s", MATCH_CSRRW, MASK_CSRRW, match_opcode, 0 },
764 {"csrrw", 0, {"I", 0}, "d,E,Z", MATCH_CSRRWI, MASK_CSRRWI, match_opcode, INSN_ALIAS },
765 {"csrrs", 0, {"I", 0}, "d,E,s", MATCH_CSRRS, MASK_CSRRS, match_opcode, 0 },
766 {"csrrs", 0, {"I", 0}, "d,E,Z", MATCH_CSRRSI, MASK_CSRRSI, match_opcode, INSN_ALIAS },
767 {"csrrc", 0, {"I", 0}, "d,E,s", MATCH_CSRRC, MASK_CSRRC, match_opcode, 0 },
768 {"csrrc", 0, {"I", 0}, "d,E,Z", MATCH_CSRRCI, MASK_CSRRCI, match_opcode, INSN_ALIAS },
769 {"uret", 0, {"I", 0}, "", MATCH_URET, MASK_URET, match_opcode, 0 },
770 {"sret", 0, {"I", 0}, "", MATCH_SRET, MASK_SRET, match_opcode, 0 },
771 {"hret", 0, {"I", 0}, "", MATCH_HRET, MASK_HRET, match_opcode, 0 },
772 {"mret", 0, {"I", 0}, "", MATCH_MRET, MASK_MRET, match_opcode, 0 },
773 {"dret", 0, {"I", 0}, "", MATCH_DRET, MASK_DRET, match_opcode, 0 },
774 {"sfence.vm", 0, {"I", 0}, "", MATCH_SFENCE_VM, MASK_SFENCE_VM | MASK_RS1, match_opcode, 0 },
775 {"sfence.vm", 0, {"I", 0}, "s", MATCH_SFENCE_VM, MASK_SFENCE_VM, match_opcode, 0 },
776 {"sfence.vma", 0, {"I", 0}, "", MATCH_SFENCE_VMA, MASK_SFENCE_VMA | MASK_RS1 | MASK_RS2, match_opcode, INSN_ALIAS },
777 {"sfence.vma", 0, {"I", 0}, "s", MATCH_SFENCE_VMA, MASK_SFENCE_VMA | MASK_RS2, match_opcode, INSN_ALIAS },
778 {"sfence.vma", 0, {"I", 0}, "s,t", MATCH_SFENCE_VMA, MASK_SFENCE_VMA, match_opcode, 0 },
779 {"wfi", 0, {"I", 0}, "", MATCH_WFI, MASK_WFI, match_opcode, 0 },
781 /* Terminate the list. */
782 {0, 0, {0}, 0, 0, 0, 0, 0}
785 /* Instruction format for .insn directive. */
786 const struct riscv_opcode riscv_insn_types[] =
788 /* name, xlen, isa, operands, match, mask, match_func, pinfo. */
789 {"r", 0, {"I", 0}, "O4,F3,F7,d,s,t", 0, 0, match_opcode, 0 },
790 {"r", 0, {"I", 0}, "O4,F3,F7,D,s,t", 0, 0, match_opcode, 0 },
791 {"r", 0, {"I", 0}, "O4,F3,F7,d,S,t", 0, 0, match_opcode, 0 },
792 {"r", 0, {"I", 0}, "O4,F3,F7,D,S,t", 0, 0, match_opcode, 0 },
793 {"r", 0, {"I", 0}, "O4,F3,F7,d,s,T", 0, 0, match_opcode, 0 },
794 {"r", 0, {"I", 0}, "O4,F3,F7,D,s,T", 0, 0, match_opcode, 0 },
795 {"r", 0, {"I", 0}, "O4,F3,F7,d,S,T", 0, 0, match_opcode, 0 },
796 {"r", 0, {"I", 0}, "O4,F3,F7,D,S,T", 0, 0, match_opcode, 0 },
798 {"r", 0, {"I", 0}, "O4,F3,F2,d,s,t,r", 0, 0, match_opcode, 0 },
799 {"r", 0, {"I", 0}, "O4,F3,F2,D,s,t,r", 0, 0, match_opcode, 0 },
800 {"r", 0, {"I", 0}, "O4,F3,F2,d,S,t,r", 0, 0, match_opcode, 0 },
801 {"r", 0, {"I", 0}, "O4,F3,F2,D,S,t,r", 0, 0, match_opcode, 0 },
802 {"r", 0, {"I", 0}, "O4,F3,F2,d,s,T,r", 0, 0, match_opcode, 0 },
803 {"r", 0, {"I", 0}, "O4,F3,F2,D,s,T,r", 0, 0, match_opcode, 0 },
804 {"r", 0, {"I", 0}, "O4,F3,F2,d,S,T,r", 0, 0, match_opcode, 0 },
805 {"r", 0, {"I", 0}, "O4,F3,F2,D,S,T,r", 0, 0, match_opcode, 0 },
806 {"r", 0, {"I", 0}, "O4,F3,F2,d,s,t,R", 0, 0, match_opcode, 0 },
807 {"r", 0, {"I", 0}, "O4,F3,F2,D,s,t,R", 0, 0, match_opcode, 0 },
808 {"r", 0, {"I", 0}, "O4,F3,F2,d,S,t,R", 0, 0, match_opcode, 0 },
809 {"r", 0, {"I", 0}, "O4,F3,F2,D,S,t,R", 0, 0, match_opcode, 0 },
810 {"r", 0, {"I", 0}, "O4,F3,F2,d,s,T,R", 0, 0, match_opcode, 0 },
811 {"r", 0, {"I", 0}, "O4,F3,F2,D,s,T,R", 0, 0, match_opcode, 0 },
812 {"r", 0, {"I", 0}, "O4,F3,F2,d,S,T,R", 0, 0, match_opcode, 0 },
813 {"r", 0, {"I", 0}, "O4,F3,F2,D,S,T,R", 0, 0, match_opcode, 0 },
815 {"i", 0, {"I", 0}, "O4,F3,d,s,j", 0, 0, match_opcode, 0 },
816 {"i", 0, {"I", 0}, "O4,F3,D,s,j", 0, 0, match_opcode, 0 },
817 {"i", 0, {"I", 0}, "O4,F3,d,S,j", 0, 0, match_opcode, 0 },
818 {"i", 0, {"I", 0}, "O4,F3,D,S,j", 0, 0, match_opcode, 0 },
820 {"i", 0, {"I", 0}, "O4,F3,d,o(s)", 0, 0, match_opcode, 0 },
821 {"i", 0, {"I", 0}, "O4,F3,D,o(s)", 0, 0, match_opcode, 0 },
823 {"s", 0, {"I", 0}, "O4,F3,d,o(s)", 0, 0, match_opcode, 0 },
824 {"s", 0, {"I", 0}, "O4,F3,D,o(s)", 0, 0, match_opcode, 0 },
826 {"sb", 0, {"I", 0}, "O4,F3,s,t,p", 0, 0, match_opcode, 0 },
827 {"sb", 0, {"I", 0}, "O4,F3,S,t,p", 0, 0, match_opcode, 0 },
828 {"sb", 0, {"I", 0}, "O4,F3,s,T,p", 0, 0, match_opcode, 0 },
829 {"sb", 0, {"I", 0}, "O4,F3,S,T,p", 0, 0, match_opcode, 0 },
831 {"sb", 0, {"I", 0}, "O4,F3,t,q(s)", 0, 0, match_opcode, 0 },
832 {"sb", 0, {"I", 0}, "O4,F3,T,q(s)", 0, 0, match_opcode, 0 },
834 {"u", 0, {"I", 0}, "O4,d,u", 0, 0, match_opcode, 0 },
835 {"u", 0, {"I", 0}, "O4,D,u", 0, 0, match_opcode, 0 },
837 {"uj", 0, {"I", 0}, "O4,d,a", 0, 0, match_opcode, 0 },
838 {"uj", 0, {"I", 0}, "O4,D,a", 0, 0, match_opcode, 0 },
840 {"cr", 0, {"C", 0}, "O2,CF4,d,CV", 0, 0, match_opcode, 0 },
841 {"cr", 0, {"C", 0}, "O2,CF4,D,CV", 0, 0, match_opcode, 0 },
842 {"cr", 0, {"C", 0}, "O2,CF4,d,CT", 0, 0, match_opcode, 0 },
843 {"cr", 0, {"C", 0}, "O2,CF4,D,CT", 0, 0, match_opcode, 0 },
845 {"ci", 0, {"C", 0}, "O2,CF3,d,Co", 0, 0, match_opcode, 0 },
846 {"ci", 0, {"C", 0}, "O2,CF3,D,Co", 0, 0, match_opcode, 0 },
848 {"ciw", 0, {"C", 0}, "O2,CF3,Ct,C8", 0, 0, match_opcode, 0 },
849 {"ciw", 0, {"C", 0}, "O2,CF3,CD,C8", 0, 0, match_opcode, 0 },
851 {"ca", 0, {"C", 0}, "O2,CF6,CF2,Cs,Ct", 0, 0, match_opcode, 0 },
852 {"ca", 0, {"C", 0}, "O2,CF6,CF2,CS,Ct", 0, 0, match_opcode, 0 },
853 {"ca", 0, {"C", 0}, "O2,CF6,CF2,Cs,CD", 0, 0, match_opcode, 0 },
854 {"ca", 0, {"C", 0}, "O2,CF6,CF2,CS,CD", 0, 0, match_opcode, 0 },
856 {"cb", 0, {"C", 0}, "O2,CF3,Cs,Cp", 0, 0, match_opcode, 0 },
857 {"cb", 0, {"C", 0}, "O2,CF3,CS,Cp", 0, 0, match_opcode, 0 },
859 {"cj", 0, {"C", 0}, "O2,CF3,Ca", 0, 0, match_opcode, 0 },
860 /* Terminate the list. */
861 {0, 0, {0}, 0, 0, 0, 0, 0}