@samitouri / QOSamiQemu / commits / 7a1cca6360

disas/riscv: Split ventana_opcode_data

Move the table to riscv-xventana-op.c.inc and massage the lines into OP() form. Drop vt.illegal as unused. Return pointers to objects directly. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260812223142.349142-42-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Richard Henderson committed Aug 12, 2026 at 15:31 UTC 7a1cca6360e39cc26b9e31d7af613270d6a0cf25
2 files changed +8 -15
disas/riscv-xventana-op.c.inc new
+2
@@ -0,0 +1,2 @@
1 +OP(vt_maskc, "vt.maskc", rv_codec_r, rv_fmt_rd_rs1_rs2)
2 +OP(vt_maskcn, "vt.maskcn", rv_codec_r, rv_fmt_rd_rs1_rs2)
disas/riscv-xventana.c
+6 -15
@@ -8,35 +8,26 @@
8 #include "disas/riscv.h"
9 #include "disas/riscv-xventana.h"
10
11 -typedef enum {
12 - /* 0 is reserved for rv_op_illegal. */
13 - ventana_op_vt_maskc = 1,
14 - ventana_op_vt_maskcn = 2,
15 -} rv_ventana_op;
16 -
17 -static const rv_opcode_data ventana_opcode_data[] = {
18 - { "vt.illegal", rv_codec_illegal, rv_fmt_none },
19 - { "vt.maskc", rv_codec_r, rv_fmt_rd_rs1_rs2 },
20 - { "vt.maskcn", rv_codec_r, rv_fmt_rd_rs1_rs2 },
21 -};
11 +#define OP(N, ...) static const rv_opcode_data op_##N = { __VA_ARGS__ };
12 +#include "riscv-xventana-op.c.inc"
13 +#undef OP
14
15 const rv_opcode_data *decode_xventanacondops(rv_decode *dec, rv_isa isa)
16 {
17 rv_inst inst = dec->inst;
26 - rv_opcode op = rv_op_illegal;
18
19 switch (((inst >> 0) & 0b11)) {
20 case 3:
21 switch (((inst >> 2) & 0b11111)) {
22 case 30:
23 switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {
33 - case 6: op = ventana_op_vt_maskc; break;
34 - case 7: op = ventana_op_vt_maskcn; break;
24 + case 6: return &op_vt_maskc;
25 + case 7: return &op_vt_maskcn;
26 }
27 break;
28 }
29 break;
30 }
31
41 - return op == rv_op_illegal ? NULL : &ventana_opcode_data[op];
32 + return NULL;
33 }