[PULL v2 34/96] disas/riscv: Move operand extractors earlier in file
[email protected] Mon, 24 Aug 2026 15:47:04 +1000
Newsgroups
org.nongnu.qemu-devel
Message-ID
<[email protected] >
From: Richard Henderson <[email protected] >
Reviewed-by: Alistair Francis <[email protected] >
Signed-off-by: Richard Henderson <[email protected] >
Message-ID: <[email protected] >
Signed-off-by: Alistair Francis <[email protected] >
---
disas/riscv.c | 870 +++++++++++++++++++++++++-------------------------
1 file changed, 435 insertions(+), 435 deletions(-)
diff --git a/disas/riscv.c b/disas/riscv.c
index 2ba0a6a73a..e3fbc26626 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -1259,6 +1259,401 @@ static const rv_comp_data rvcp_fsgnjx_q[] = {
{ rv_op_illegal, NULL }
};
+/* operand extractors */
+
+static uint32_t operand_rd(rv_inst inst)
+{
+ return extract32(inst, 7, 5);
+}
+
+static uint32_t operand_rs1(rv_inst inst)
+{
+ return extract32(inst, 15, 5);
+}
+
+static uint32_t operand_rs2(rv_inst inst)
+{
+ return extract32(inst, 20, 5);
+}
+
+static uint32_t operand_rs3(rv_inst inst)
+{
+ return extract32(inst, 27, 5);
+}
+
+static uint32_t operand_aq(rv_inst inst)
+{
+ return extract32(inst, 26, 1);
+}
+
+static uint32_t operand_rl(rv_inst inst)
+{
+ return extract32(inst, 25, 1);
+}
+
+static uint32_t operand_pred(rv_inst inst)
+{
+ return extract32(inst, 24, 4);
+}
+
+static uint32_t operand_succ(rv_inst inst)
+{
+ return extract32(inst, 20, 4);
+}
+
+static uint32_t operand_rm(rv_inst inst)
+{
+ return extract32(inst, 12, 3);
+}
+
+static uint32_t operand_shamt5(rv_inst inst)
+{
+ return extract32(inst, 20, 5);
+}
+
+static uint32_t operand_shamt6(rv_inst inst)
+{
+ return extract32(inst, 20, 6);
+}
+
+static uint32_t operand_shamt7(rv_inst inst)
+{
+ return extract32(inst, 20, 7);
+}
+
+static uint32_t operand_crdq(rv_inst inst)
+{
+ return extract32(inst, 2, 3);
+}
+
+static uint32_t operand_crs1q(rv_inst inst)
+{
+ return extract32(inst, 7, 3);
+}
+
+static uint32_t operand_crs1rdq(rv_inst inst)
+{
+ return extract32(inst, 7, 3);
+}
+
+static uint32_t operand_crs2q(rv_inst inst)
+{
+ return extract32(inst, 2, 3);
+}
+
+static uint32_t calculate_xreg(uint32_t sreg)
+{
+ return sreg < 2 ? sreg + 8 : sreg + 16;
+}
+
+static uint32_t operand_sreg1(rv_inst inst)
+{
+ return calculate_xreg(extract32(inst, 7, 3));
+}
+
+static uint32_t operand_sreg2(rv_inst inst)
+{
+ return calculate_xreg(extract32(inst, 2, 3));
+}
+
+static uint32_t operand_crd(rv_inst inst)
+{
+ return extract32(inst, 7, 5);
+}
+
+static uint32_t operand_crs1(rv_inst inst)
+{
+ return extract32(inst, 7, 5);
+}
+
+static uint32_t operand_crs1rd(rv_inst inst)
+{
+ return extract32(inst, 7, 5);
+}
+
+static uint32_t operand_crs2(rv_inst inst)
+{
+ return extract32(inst, 2, 5);
+}
+
+static uint32_t operand_cimmsh5(rv_inst inst)
+{
+ return extract32(inst, 2, 5);
+}
+
+static uint32_t operand_csr12(rv_inst inst)
+{
+ return extract32(inst, 20, 12);
+}
+
+static int32_t operand_imm12(rv_inst inst)
+{
+ return sextract32(inst, 20, 12);
+}
+
+static int32_t operand_imm20(rv_inst inst)
+{
+ return sextract32(inst, 12, 20) << 12;
+}
+
+static int32_t operand_jimm20(rv_inst inst)
+{
+ return sextract32(inst, 31, 1) << 20 |
+ extract32(inst, 21, 10) << 1 |
+ extract32(inst, 20, 1) << 11 |
+ extract32(inst, 12, 8) << 12;
+}
+
+static int32_t operand_simm12(rv_inst inst)
+{
+ return sextract32(inst, 25, 7) << 5 |
+ extract32(inst, 7, 5);
+}
+
+static int32_t operand_sbimm12(rv_inst inst)
+{
+ return sextract32(inst, 31, 1) << 12 |
+ extract32(inst, 25, 6) << 5 |
+ extract32(inst, 8, 4) << 1 |
+ extract32(inst, 7, 1) << 11;
+}
+
+static uint32_t operand_cimmshl6(rv_inst inst, rv_isa isa)
+{
+ int imm = extract32(inst, 12, 1) << 5 |
+ extract32(inst, 2, 5);
+ if (isa == rv128) {
+ imm = imm ? imm : 64;
+ }
+ return imm;
+}
+
+static uint32_t operand_cimmshr6(rv_inst inst, rv_isa isa)
+{
+ int imm = extract32(inst, 12, 1) << 5 |
+ extract32(inst, 2, 5);
+ if (isa == rv128) {
+ imm = imm | (imm & 32) << 1;
+ imm = imm ? imm : 64;
+ }
+ return imm;
+}
+
+static int32_t operand_cimmi(rv_inst inst)
+{
+ return sextract32(inst, 12, 1) << 5 |
+ extract32(inst, 2, 5);
+}
+
+static int32_t operand_cimmui(rv_inst inst)
+{
+ return sextract32(inst, 12, 1) << 17 |
+ extract32(inst, 2, 5) << 12;
+}
+
+static uint32_t operand_cimmlwsp(rv_inst inst)
+{
+ return extract32(inst, 12, 1) << 5 |
+ extract32(inst, 4, 3) << 2 |
+ extract32(inst, 2, 2) << 6;
+}
+
+static uint32_t operand_cimmldsp(rv_inst inst)
+{
+ return extract32(inst, 12, 1) << 5 |
+ extract32(inst, 5, 2) << 3 |
+ extract32(inst, 2, 3) << 6;
+}
+
+static uint32_t operand_cimmlqsp(rv_inst inst)
+{
+ return extract32(inst, 12, 1) << 5 |
+ extract32(inst, 6, 1) << 4 |
+ extract32(inst, 2, 4) << 6;
+}
+
+static int32_t operand_cimm16sp(rv_inst inst)
+{
+ return sextract32(inst, 12, 1) << 9 |
+ extract32(inst, 6, 1) << 4 |
+ extract32(inst, 5, 1) << 6 |
+ extract32(inst, 3, 2) << 7 |
+ extract32(inst, 2, 1) << 5;
+}
+
+static int32_t operand_cimmj(rv_inst inst)
+{
+ return sextract32(inst, 12, 1) << 11 |
+ extract32(inst, 11, 1) << 4 |
+ extract32(inst, 9, 2) << 8 |
+ extract32(inst, 8, 1) << 10 |
+ extract32(inst, 7, 1) << 6 |
+ extract32(inst, 6, 1) << 7 |
+ extract32(inst, 3, 3) << 1 |
+ extract32(inst, 2, 1) << 5;
+}
+
+static int32_t operand_cimmb(rv_inst inst)
+{
+ return sextract32(inst, 12, 1) << 8 |
+ extract32(inst, 10, 2) << 3 |
+ extract32(inst, 5, 2) << 6 |
+ extract32(inst, 3, 2) << 1 |
+ extract32(inst, 2, 1) << 5;
+}
+
+static uint32_t operand_cimmswsp(rv_inst inst)
+{
+ return extract32(inst, 9, 4) << 2 |
+ extract32(inst, 7, 2) << 6;
+}
+
+static uint32_t operand_cimmsdsp(rv_inst inst)
+{
+ return extract32(inst, 10, 3) << 3 |
+ extract32(inst, 7, 3) << 6;
+}
+
+static uint32_t operand_cimmsqsp(rv_inst inst)
+{
+ return extract32(inst, 11, 2) << 4 |
+ extract32(inst, 7, 4) << 6;
+}
+
+static uint32_t operand_cimm4spn(rv_inst inst)
+{
+ return extract32(inst, 11, 2) << 4 |
+ extract32(inst, 7, 4) << 6 |
+ extract32(inst, 6, 1) << 2 |
+ extract32(inst, 5, 1) << 3;
+}
+
+static uint32_t operand_cimmw(rv_inst inst)
+{
+ return extract32(inst, 10, 3) << 3 |
+ extract32(inst, 6, 1) << 2 |
+ extract32(inst, 5, 1) << 6;
+}
+
+static uint32_t operand_cimmd(rv_inst inst)
+{
+ return extract32(inst, 10, 3) << 3 |
+ extract32(inst, 5, 2) << 6;
+}
+
+static uint32_t operand_cimmq(rv_inst inst)
+{
+ return extract32(inst, 11, 2) << 4 |
+ extract32(inst, 10, 1) << 8 |
+ extract32(inst, 5, 2) << 6;
+}
+
+static int32_t operand_vimm(rv_inst inst)
+{
+ return sextract32(inst, 15, 5);
+}
+
+static uint32_t operand_vuimm(rv_inst inst)
+{
+ return extract32(inst, 15, 5);
+}
+
+static uint32_t operand_vzimm11(rv_inst inst)
+{
+ return extract32(inst, 20, 11);
+}
+
+static uint32_t operand_vzimm10(rv_inst inst)
+{
+ return extract32(inst, 20, 10);
+}
+
+static uint32_t operand_vzimm6(rv_inst inst)
+{
+ return extract32(inst, 26, 1) << 5 |
+ extract32(inst, 15, 5);
+}
+
+static uint32_t operand_bs(rv_inst inst)
+{
+ return extract32(inst, 30, 2);
+}
+
+static uint32_t operand_rnum(rv_inst inst)
+{
+ return extract32(inst, 20, 4);
+}
+
+static uint32_t operand_vm(rv_inst inst)
+{
+ return extract32(inst, 25, 1);
+}
+
+static uint32_t operand_uimm_c_lb(rv_inst inst)
+{
+ return extract32(inst, 5, 1) << 1 |
+ extract32(inst, 6, 1);
+}
+
+static uint32_t operand_uimm_c_lh(rv_inst inst)
+{
+ return extract32(inst, 5, 1) << 1;
+}
+
+static uint32_t operand_zcmp_spimm(rv_inst inst)
+{
+ return extract32(inst, 2, 2) << 4;
+}
+
+static uint32_t operand_zcmp_rlist(rv_inst inst)
+{
+ return extract32(inst, 4, 4);
+}
+
+static uint32_t operand_imm6(rv_inst inst)
+{
+ return extract32(inst, 20, 6);
+}
+
+static uint32_t operand_imm2(rv_inst inst)
+{
+ return extract32(inst, 25, 2);
+}
+
+static uint32_t operand_immh(rv_inst inst)
+{
+ return extract32(inst, 26, 6);
+}
+
+static uint32_t operand_imml(rv_inst inst)
+{
+ return extract32(inst, 20, 6);
+}
+
+static uint32_t calculate_stack_adj(rv_isa isa, uint32_t rlist, uint32_t spimm)
+{
+ int xlen_bytes_log2 = isa == rv64 ? 3 : 2;
+ int regs = rlist == 15 ? 13 : rlist - 3;
+ uint32_t stack_adj_base = ROUND_UP(regs << xlen_bytes_log2, 16);
+ return stack_adj_base + spimm;
+}
+
+static uint32_t operand_zcmp_stack_adj(rv_inst inst, rv_isa isa)
+{
+ return calculate_stack_adj(isa, operand_zcmp_rlist(inst),
+ operand_zcmp_spimm(inst));
+}
+
+static uint32_t operand_tbl_index(rv_inst inst)
+{
+ return extract32(inst, 2, 8);
+}
+
+static uint32_t operand_lpl(rv_inst inst)
+{
+ return extract32(inst, 12, 20);
+}
+
/* instruction metadata */
const rv_opcode_data rvi_opcode_data[] = {
@@ -4155,442 +4550,47 @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
case 2: op = rv_op_vaesem_vv; break;
case 3: op = rv_op_vaesef_vv; break;
case 16: op = rv_op_vsm4r_vv; break;
- case 17: op = rv_op_vgmul_vv; break;
- }
- break;
- case 41:
- switch ((inst >> 15) & 0b11111) {
- case 0: op = rv_op_vaesdm_vs; break;
- case 1: op = rv_op_vaesdf_vs; break;
- case 2: op = rv_op_vaesem_vs; break;
- case 3: op = rv_op_vaesef_vs; break;
- case 7: op = rv_op_vaesz_vs; break;
- case 16: op = rv_op_vsm4r_vs; break;
- }
- break;
- case 42: op = rv_op_vaeskf2_vi; break;
- case 43: op = rv_op_vsm3c_vi; break;
- case 44: op = rv_op_vghsh_vv; break;
- case 45: op = rv_op_vsha2ms_vv; break;
- case 46: op = rv_op_vsha2ch_vv; break;
- case 47: op = rv_op_vsha2cl_vv; break;
- }
- }
- break;
- case 30:
- switch (((inst >> 22) & 0b1111111000) |
- ((inst >> 12) & 0b0000000111)) {
- case 0: op = rv_op_addd; break;
- case 1: op = rv_op_slld; break;
- case 5: op = rv_op_srld; break;
- case 8: op = rv_op_muld; break;
- case 12: op = rv_op_divd; break;
- case 13: op = rv_op_divud; break;
- case 14: op = rv_op_remd; break;
- case 15: op = rv_op_remud; break;
- case 256: op = rv_op_subd; break;
- case 261: op = rv_op_srad; break;
- }
- break;
- }
- break;
- }
- dec->op = op;
-}
-
-/* operand extractors */
-
-static uint32_t operand_rd(rv_inst inst)
-{
- return extract32(inst, 7, 5);
-}
-
-static uint32_t operand_rs1(rv_inst inst)
-{
- return extract32(inst, 15, 5);
-}
-
-static uint32_t operand_rs2(rv_inst inst)
-{
- return extract32(inst, 20, 5);
-}
-
-static uint32_t operand_rs3(rv_inst inst)
-{
- return extract32(inst, 27, 5);
-}
-
-static uint32_t operand_aq(rv_inst inst)
-{
- return extract32(inst, 26, 1);
-}
-
-static uint32_t operand_rl(rv_inst inst)
-{
- return extract32(inst, 25, 1);
-}
-
-static uint32_t operand_pred(rv_inst inst)
-{
- return extract32(inst, 24, 4);
-}
-
-static uint32_t operand_succ(rv_inst inst)
-{
- return extract32(inst, 20, 4);
-}
-
-static uint32_t operand_rm(rv_inst inst)
-{
- return extract32(inst, 12, 3);
-}
-
-static uint32_t operand_shamt5(rv_inst inst)
-{
- return extract32(inst, 20, 5);
-}
-
-static uint32_t operand_shamt6(rv_inst inst)
-{
- return extract32(inst, 20, 6);
-}
-
-static uint32_t operand_shamt7(rv_inst inst)
-{
- return extract32(inst, 20, 7);
-}
-
-static uint32_t operand_crdq(rv_inst inst)
-{
- return extract32(inst, 2, 3);
-}
-
-static uint32_t operand_crs1q(rv_inst inst)
-{
- return extract32(inst, 7, 3);
-}
-
-static uint32_t operand_crs1rdq(rv_inst inst)
-{
- return extract32(inst, 7, 3);
-}
-
-static uint32_t operand_crs2q(rv_inst inst)
-{
- return extract32(inst, 2, 3);
-}
-
-static uint32_t calculate_xreg(uint32_t sreg)
-{
- return sreg < 2 ? sreg + 8 : sreg + 16;
-}
-
-static uint32_t operand_sreg1(rv_inst inst)
-{
- return calculate_xreg(extract32(inst, 7, 3));
-}
-
-static uint32_t operand_sreg2(rv_inst inst)
-{
- return calculate_xreg(extract32(inst, 2, 3));
-}
-
-static uint32_t operand_crd(rv_inst inst)
-{
- return extract32(inst, 7, 5);
-}
-
-static uint32_t operand_crs1(rv_inst inst)
-{
- return extract32(inst, 7, 5);
-}
-
-static uint32_t operand_crs1rd(rv_inst inst)
-{
- return extract32(inst, 7, 5);
-}
-
-static uint32_t operand_crs2(rv_inst inst)
-{
- return extract32(inst, 2, 5);
-}
-
-static uint32_t operand_cimmsh5(rv_inst inst)
-{
- return extract32(inst, 2, 5);
-}
-
-static uint32_t operand_csr12(rv_inst inst)
-{
- return extract32(inst, 20, 12);
-}
-
-static int32_t operand_imm12(rv_inst inst)
-{
- return sextract32(inst, 20, 12);
-}
-
-static int32_t operand_imm20(rv_inst inst)
-{
- return sextract32(inst, 12, 20) << 12;
-}
-
-static int32_t operand_jimm20(rv_inst inst)
-{
- return sextract32(inst, 31, 1) << 20 |
- extract32(inst, 21, 10) << 1 |
- extract32(inst, 20, 1) << 11 |
- extract32(inst, 12, 8) << 12;
-}
-
-static int32_t operand_simm12(rv_inst inst)
-{
- return sextract32(inst, 25, 7) << 5 |
- extract32(inst, 7, 5);
-}
-
-static int32_t operand_sbimm12(rv_inst inst)
-{
- return sextract32(inst, 31, 1) << 12 |
- extract32(inst, 25, 6) << 5 |
- extract32(inst, 8, 4) << 1 |
- extract32(inst, 7, 1) << 11;
-}
-
-static uint32_t operand_cimmshl6(rv_inst inst, rv_isa isa)
-{
- int imm = extract32(inst, 12, 1) << 5 |
- extract32(inst, 2, 5);
- if (isa == rv128) {
- imm = imm ? imm : 64;
- }
- return imm;
-}
-
-static uint32_t operand_cimmshr6(rv_inst inst, rv_isa isa)
-{
- int imm = extract32(inst, 12, 1) << 5 |
- extract32(inst, 2, 5);
- if (isa == rv128) {
- imm = imm | (imm & 32) << 1;
- imm = imm ? imm : 64;
+ case 17: op = rv_op_vgmul_vv; break;
+ }
+ break;
+ case 41:
+ switch ((inst >> 15) & 0b11111) {
+ case 0: op = rv_op_vaesdm_vs; break;
+ case 1: op = rv_op_vaesdf_vs; break;
+ case 2: op = rv_op_vaesem_vs; break;
+ case 3: op = rv_op_vaesef_vs; break;
+ case 7: op = rv_op_vaesz_vs; break;
+ case 16: op = rv_op_vsm4r_vs; break;
+ }
+ break;
+ case 42: op = rv_op_vaeskf2_vi; break;
+ case 43: op = rv_op_vsm3c_vi; break;
+ case 44: op = rv_op_vghsh_vv; break;
+ case 45: op = rv_op_vsha2ms_vv; break;
+ case 46: op = rv_op_vsha2ch_vv; break;
+ case 47: op = rv_op_vsha2cl_vv; break;
+ }
+ }
+ break;
+ case 30:
+ switch (((inst >> 22) & 0b1111111000) |
+ ((inst >> 12) & 0b0000000111)) {
+ case 0: op = rv_op_addd; break;
+ case 1: op = rv_op_slld; break;
+ case 5: op = rv_op_srld; break;
+ case 8: op = rv_op_muld; break;
+ case 12: op = rv_op_divd; break;
+ case 13: op = rv_op_divud; break;
+ case 14: op = rv_op_remd; break;
+ case 15: op = rv_op_remud; break;
+ case 256: op = rv_op_subd; break;
+ case 261: op = rv_op_srad; break;
+ }
+ break;
+ }
+ break;
}
- return imm;
-}
-
-static int32_t operand_cimmi(rv_inst inst)
-{
- return sextract32(inst, 12, 1) << 5 |
- extract32(inst, 2, 5);
-}
-
-static int32_t operand_cimmui(rv_inst inst)
-{
- return sextract32(inst, 12, 1) << 17 |
- extract32(inst, 2, 5) << 12;
-}
-
-static uint32_t operand_cimmlwsp(rv_inst inst)
-{
- return extract32(inst, 12, 1) << 5 |
- extract32(inst, 4, 3) << 2 |
- extract32(inst, 2, 2) << 6;
-}
-
-static uint32_t operand_cimmldsp(rv_inst inst)
-{
- return extract32(inst, 12, 1) << 5 |
- extract32(inst, 5, 2) << 3 |
- extract32(inst, 2, 3) << 6;
-}
-
-static uint32_t operand_cimmlqsp(rv_inst inst)
-{
- return extract32(inst, 12, 1) << 5 |
- extract32(inst, 6, 1) << 4 |
- extract32(inst, 2, 4) << 6;
-}
-
-static int32_t operand_cimm16sp(rv_inst inst)
-{
- return sextract32(inst, 12, 1) << 9 |
- extract32(inst, 6, 1) << 4 |
- extract32(inst, 5, 1) << 6 |
- extract32(inst, 3, 2) << 7 |
- extract32(inst, 2, 1) << 5;
-}
-
-static int32_t operand_cimmj(rv_inst inst)
-{
- return sextract32(inst, 12, 1) << 11 |
- extract32(inst, 11, 1) << 4 |
- extract32(inst, 9, 2) << 8 |
- extract32(inst, 8, 1) << 10 |
- extract32(inst, 7, 1) << 6 |
- extract32(inst, 6, 1) << 7 |
- extract32(inst, 3, 3) << 1 |
- extract32(inst, 2, 1) << 5;
-}
-
-static int32_t operand_cimmb(rv_inst inst)
-{
- return sextract32(inst, 12, 1) << 8 |
- extract32(inst, 10, 2) << 3 |
- extract32(inst, 5, 2) << 6 |
- extract32(inst, 3, 2) << 1 |
- extract32(inst, 2, 1) << 5;
-}
-
-static uint32_t operand_cimmswsp(rv_inst inst)
-{
- return extract32(inst, 9, 4) << 2 |
- extract32(inst, 7, 2) << 6;
-}
-
-static uint32_t operand_cimmsdsp(rv_inst inst)
-{
- return extract32(inst, 10, 3) << 3 |
- extract32(inst, 7, 3) << 6;
-}
-
-static uint32_t operand_cimmsqsp(rv_inst inst)
-{
- return extract32(inst, 11, 2) << 4 |
- extract32(inst, 7, 4) << 6;
-}
-
-static uint32_t operand_cimm4spn(rv_inst inst)
-{
- return extract32(inst, 11, 2) << 4 |
- extract32(inst, 7, 4) << 6 |
- extract32(inst, 6, 1) << 2 |
- extract32(inst, 5, 1) << 3;
-}
-
-static uint32_t operand_cimmw(rv_inst inst)
-{
- return extract32(inst, 10, 3) << 3 |
- extract32(inst, 6, 1) << 2 |
- extract32(inst, 5, 1) << 6;
-}
-
-static uint32_t operand_cimmd(rv_inst inst)
-{
- return extract32(inst, 10, 3) << 3 |
- extract32(inst, 5, 2) << 6;
-}
-
-static uint32_t operand_cimmq(rv_inst inst)
-{
- return extract32(inst, 11, 2) << 4 |
- extract32(inst, 10, 1) << 8 |
- extract32(inst, 5, 2) << 6;
-}
-
-static int32_t operand_vimm(rv_inst inst)
-{
- return sextract32(inst, 15, 5);
-}
-
-static uint32_t operand_vuimm(rv_inst inst)
-{
- return extract32(inst, 15, 5);
-}
-
-static uint32_t operand_vzimm11(rv_inst inst)
-{
- return extract32(inst, 20, 11);
-}
-
-static uint32_t operand_vzimm10(rv_inst inst)
-{
- return extract32(inst, 20, 10);
-}
-
-static uint32_t operand_vzimm6(rv_inst inst)
-{
- return extract32(inst, 26, 1) << 5 |
- extract32(inst, 15, 5);
-}
-
-static uint32_t operand_bs(rv_inst inst)
-{
- return extract32(inst, 30, 2);
-}
-
-static uint32_t operand_rnum(rv_inst inst)
-{
- return extract32(inst, 20, 4);
-}
-
-static uint32_t operand_vm(rv_inst inst)
-{
- return extract32(inst, 25, 1);
-}
-
-static uint32_t operand_uimm_c_lb(rv_inst inst)
-{
- return extract32(inst, 5, 1) << 1 |
- extract32(inst, 6, 1);
-}
-
-static uint32_t operand_uimm_c_lh(rv_inst inst)
-{
- return extract32(inst, 5, 1) << 1;
-}
-
-static uint32_t operand_zcmp_spimm(rv_inst inst)
-{
- return extract32(inst, 2, 2) << 4;
-}
-
-static uint32_t operand_zcmp_rlist(rv_inst inst)
-{
- return extract32(inst, 4, 4);
-}
-
-static uint32_t operand_imm6(rv_inst inst)
-{
- return extract32(inst, 20, 6);
-}
-
-static uint32_t operand_imm2(rv_inst inst)
-{
- return extract32(inst, 25, 2);
-}
-
-static uint32_t operand_immh(rv_inst inst)
-{
- return extract32(inst, 26, 6);
-}
-
-static uint32_t operand_imml(rv_inst inst)
-{
- return extract32(inst, 20, 6);
-}
-
-static uint32_t calculate_stack_adj(rv_isa isa, uint32_t rlist, uint32_t spimm)
-{
- int xlen_bytes_log2 = isa == rv64 ? 3 : 2;
- int regs = rlist == 15 ? 13 : rlist - 3;
- uint32_t stack_adj_base = ROUND_UP(regs << xlen_bytes_log2, 16);
- return stack_adj_base + spimm;
-}
-
-static uint32_t operand_zcmp_stack_adj(rv_inst inst, rv_isa isa)
-{
- return calculate_stack_adj(isa, operand_zcmp_rlist(inst),
- operand_zcmp_spimm(inst));
-}
-
-static uint32_t operand_tbl_index(rv_inst inst)
-{
- return extract32(inst, 2, 8);
-}
-
-static uint32_t operand_lpl(rv_inst inst)
-{
- return extract32(inst, 12, 20);
+ dec->op = op;
}
/* decode operands */
--
2.54.0