Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 908699
Collapse All | Expand All

(-)a/accel/tcg/cpu-exec.c (+3 lines)
Lines 313-318 static void log_cpu_exec(target_ulong pc, CPUState *cpu, Link Here
313
#if defined(TARGET_I386)
313
#if defined(TARGET_I386)
314
                flags |= CPU_DUMP_CCOP;
314
                flags |= CPU_DUMP_CCOP;
315
#endif
315
#endif
316
                if (qemu_loglevel_mask(CPU_LOG_TB_VPU)) {
317
                    flags |= CPU_DUMP_VPU;
318
                }
316
                cpu_dump_state(cpu, logfile, flags);
319
                cpu_dump_state(cpu, logfile, flags);
317
                qemu_log_unlock(logfile);
320
                qemu_log_unlock(logfile);
318
            }
321
            }
(-)a/disas/riscv.c (-548 / +646 lines)
Lines 19-25 Link Here
19
19
20
#include "qemu/osdep.h"
20
#include "qemu/osdep.h"
21
#include "disas/dis-asm.h"
21
#include "disas/dis-asm.h"
22
22
#include "target/riscv/cpu_cfg.h"
23
23
24
/* types */
24
/* types */
25
25
Lines 969-974 typedef enum { Link Here
969
/* structures */
969
/* structures */
970
970
971
typedef struct {
971
typedef struct {
972
    RISCVCPUConfig *cfg;
972
    uint64_t  pc;
973
    uint64_t  pc;
973
    uint64_t  inst;
974
    uint64_t  inst;
974
    int32_t   imm;
975
    int32_t   imm;
Lines 1109-1116 static const char rv_vreg_name_sym[32][4] = { Link Here
1109
/* pseudo-instruction constraints */
1110
/* pseudo-instruction constraints */
1110
1111
1111
static const rvc_constraint rvcc_jal[] = { rvc_rd_eq_ra, rvc_end };
1112
static const rvc_constraint rvcc_jal[] = { rvc_rd_eq_ra, rvc_end };
1112
static const rvc_constraint rvcc_jalr[] = { rvc_rd_eq_ra, rvc_imm_eq_zero, rvc_end };
1113
static const rvc_constraint rvcc_jalr[] = { rvc_rd_eq_ra, rvc_imm_eq_zero,
1113
static const rvc_constraint rvcc_nop[] = { rvc_rd_eq_x0, rvc_rs1_eq_x0, rvc_imm_eq_zero, rvc_end };
1114
                                            rvc_end };
1115
static const rvc_constraint rvcc_nop[] = { rvc_rd_eq_x0, rvc_rs1_eq_x0,
1116
                                           rvc_imm_eq_zero, rvc_end };
1114
static const rvc_constraint rvcc_mv[] = { rvc_imm_eq_zero, rvc_end };
1117
static const rvc_constraint rvcc_mv[] = { rvc_imm_eq_zero, rvc_end };
1115
static const rvc_constraint rvcc_not[] = { rvc_imm_eq_n1, rvc_end };
1118
static const rvc_constraint rvcc_not[] = { rvc_imm_eq_n1, rvc_end };
1116
static const rvc_constraint rvcc_neg[] = { rvc_rs1_eq_x0, rvc_end };
1119
static const rvc_constraint rvcc_neg[] = { rvc_rs1_eq_x0, rvc_end };
Lines 1140-1157 static const rvc_constraint rvcc_bleu[] = { rvc_end }; Link Here
1140
static const rvc_constraint rvcc_bgt[] = { rvc_end };
1143
static const rvc_constraint rvcc_bgt[] = { rvc_end };
1141
static const rvc_constraint rvcc_bgtu[] = { rvc_end };
1144
static const rvc_constraint rvcc_bgtu[] = { rvc_end };
1142
static const rvc_constraint rvcc_j[] = { rvc_rd_eq_x0, rvc_end };
1145
static const rvc_constraint rvcc_j[] = { rvc_rd_eq_x0, rvc_end };
1143
static const rvc_constraint rvcc_ret[] = { rvc_rd_eq_x0, rvc_rs1_eq_ra, rvc_end };
1146
static const rvc_constraint rvcc_ret[] = { rvc_rd_eq_x0, rvc_rs1_eq_ra,
1144
static const rvc_constraint rvcc_jr[] = { rvc_rd_eq_x0, rvc_imm_eq_zero, rvc_end };
1147
                                           rvc_end };
1145
static const rvc_constraint rvcc_rdcycle[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc00, rvc_end };
1148
static const rvc_constraint rvcc_jr[] = { rvc_rd_eq_x0, rvc_imm_eq_zero,
1146
static const rvc_constraint rvcc_rdtime[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc01, rvc_end };
1149
                                          rvc_end };
1147
static const rvc_constraint rvcc_rdinstret[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc02, rvc_end };
1150
static const rvc_constraint rvcc_rdcycle[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc00,
1148
static const rvc_constraint rvcc_rdcycleh[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc80, rvc_end };
1151
                                               rvc_end };
1149
static const rvc_constraint rvcc_rdtimeh[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc81, rvc_end };
1152
static const rvc_constraint rvcc_rdtime[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc01,
1153
                                              rvc_end };
1154
static const rvc_constraint rvcc_rdinstret[] = { rvc_rs1_eq_x0,
1155
                                                 rvc_csr_eq_0xc02, rvc_end };
1156
static const rvc_constraint rvcc_rdcycleh[] = { rvc_rs1_eq_x0,
1157
                                                rvc_csr_eq_0xc80, rvc_end };
1158
static const rvc_constraint rvcc_rdtimeh[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc81,
1159
                                               rvc_end };
1150
static const rvc_constraint rvcc_rdinstreth[] = { rvc_rs1_eq_x0,
1160
static const rvc_constraint rvcc_rdinstreth[] = { rvc_rs1_eq_x0,
1151
                                                  rvc_csr_eq_0xc82, rvc_end };
1161
                                                  rvc_csr_eq_0xc82, rvc_end };
1152
static const rvc_constraint rvcc_frcsr[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x003, rvc_end };
1162
static const rvc_constraint rvcc_frcsr[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x003,
1153
static const rvc_constraint rvcc_frrm[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x002, rvc_end };
1163
                                             rvc_end };
1154
static const rvc_constraint rvcc_frflags[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x001, rvc_end };
1164
static const rvc_constraint rvcc_frrm[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x002,
1165
                                            rvc_end };
1166
static const rvc_constraint rvcc_frflags[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x001,
1167
                                               rvc_end };
1155
static const rvc_constraint rvcc_fscsr[] = { rvc_csr_eq_0x003, rvc_end };
1168
static const rvc_constraint rvcc_fscsr[] = { rvc_csr_eq_0x003, rvc_end };
1156
static const rvc_constraint rvcc_fsrm[] = { rvc_csr_eq_0x002, rvc_end };
1169
static const rvc_constraint rvcc_fsrm[] = { rvc_csr_eq_0x002, rvc_end };
1157
static const rvc_constraint rvcc_fsflags[] = { rvc_csr_eq_0x001, rvc_end };
1170
static const rvc_constraint rvcc_fsflags[] = { rvc_csr_eq_0x001, rvc_end };
Lines 1553-1569 const rv_opcode_data opcode_data[] = { Link Here
1553
    { "fmv.q.x", rv_codec_r, rv_fmt_frd_rs1, NULL, 0, 0, 0 },
1566
    { "fmv.q.x", rv_codec_r, rv_fmt_frd_rs1, NULL, 0, 0, 0 },
1554
    { "c.addi4spn", rv_codec_ciw_4spn, rv_fmt_rd_rs1_imm, NULL, rv_op_addi,
1567
    { "c.addi4spn", rv_codec_ciw_4spn, rv_fmt_rd_rs1_imm, NULL, rv_op_addi,
1555
      rv_op_addi, rv_op_addi, rvcd_imm_nz },
1568
      rv_op_addi, rv_op_addi, rvcd_imm_nz },
1556
    { "c.fld", rv_codec_cl_ld, rv_fmt_frd_offset_rs1, NULL, rv_op_fld, rv_op_fld, 0 },
1569
    { "c.fld", rv_codec_cl_ld, rv_fmt_frd_offset_rs1, NULL, rv_op_fld,
1557
    { "c.lw", rv_codec_cl_lw, rv_fmt_rd_offset_rs1, NULL, rv_op_lw, rv_op_lw, rv_op_lw },
1570
      rv_op_fld, 0 },
1571
    { "c.lw", rv_codec_cl_lw, rv_fmt_rd_offset_rs1, NULL, rv_op_lw, rv_op_lw,
1572
      rv_op_lw },
1558
    { "c.flw", rv_codec_cl_lw, rv_fmt_frd_offset_rs1, NULL, rv_op_flw, 0, 0 },
1573
    { "c.flw", rv_codec_cl_lw, rv_fmt_frd_offset_rs1, NULL, rv_op_flw, 0, 0 },
1559
    { "c.fsd", rv_codec_cs_sd, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd, rv_op_fsd, 0 },
1574
    { "c.fsd", rv_codec_cs_sd, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd,
1560
    { "c.sw", rv_codec_cs_sw, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw, rv_op_sw, rv_op_sw },
1575
      rv_op_fsd, 0 },
1576
    { "c.sw", rv_codec_cs_sw, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw, rv_op_sw,
1577
      rv_op_sw },
1561
    { "c.fsw", rv_codec_cs_sw, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsw, 0, 0 },
1578
    { "c.fsw", rv_codec_cs_sw, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsw, 0, 0 },
1562
    { "c.nop", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_addi, rv_op_addi, rv_op_addi },
1579
    { "c.nop", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_addi, rv_op_addi,
1580
      rv_op_addi },
1563
    { "c.addi", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi,
1581
    { "c.addi", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi,
1564
      rv_op_addi, rvcd_imm_nz },
1582
      rv_op_addi, rvcd_imm_nz },
1565
    { "c.jal", rv_codec_cj_jal, rv_fmt_rd_offset, NULL, rv_op_jal, 0, 0 },
1583
    { "c.jal", rv_codec_cj_jal, rv_fmt_rd_offset, NULL, rv_op_jal, 0, 0 },
1566
    { "c.li", rv_codec_ci_li, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi, rv_op_addi },
1584
    { "c.li", rv_codec_ci_li, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi,
1585
      rv_op_addi },
1567
    { "c.addi16sp", rv_codec_ci_16sp, rv_fmt_rd_rs1_imm, NULL, rv_op_addi,
1586
    { "c.addi16sp", rv_codec_ci_16sp, rv_fmt_rd_rs1_imm, NULL, rv_op_addi,
1568
      rv_op_addi, rv_op_addi, rvcd_imm_nz },
1587
      rv_op_addi, rv_op_addi, rvcd_imm_nz },
1569
    { "c.lui", rv_codec_ci_lui, rv_fmt_rd_imm, NULL, rv_op_lui, rv_op_lui,
1588
    { "c.lui", rv_codec_ci_lui, rv_fmt_rd_imm, NULL, rv_op_lui, rv_op_lui,
Lines 1574-1610 const rv_opcode_data opcode_data[] = { Link Here
1574
      rv_op_srai, rv_op_srai, rvcd_imm_nz },
1593
      rv_op_srai, rv_op_srai, rvcd_imm_nz },
1575
    { "c.andi", rv_codec_cb_imm, rv_fmt_rd_rs1_imm, NULL, rv_op_andi,
1594
    { "c.andi", rv_codec_cb_imm, rv_fmt_rd_rs1_imm, NULL, rv_op_andi,
1576
      rv_op_andi, rv_op_andi },
1595
      rv_op_andi, rv_op_andi },
1577
    { "c.sub", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_sub, rv_op_sub, rv_op_sub },
1596
    { "c.sub", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_sub, rv_op_sub,
1578
    { "c.xor", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_xor, rv_op_xor, rv_op_xor },
1597
      rv_op_sub },
1579
    { "c.or", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_or, rv_op_or, rv_op_or },
1598
    { "c.xor", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_xor, rv_op_xor,
1580
    { "c.and", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_and, rv_op_and, rv_op_and },
1599
      rv_op_xor },
1581
    { "c.subw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_subw, rv_op_subw, rv_op_subw },
1600
    { "c.or", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_or, rv_op_or,
1582
    { "c.addw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_addw, rv_op_addw, rv_op_addw },
1601
      rv_op_or },
1583
    { "c.j", rv_codec_cj, rv_fmt_rd_offset, NULL, rv_op_jal, rv_op_jal, rv_op_jal },
1602
    { "c.and", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_and, rv_op_and,
1584
    { "c.beqz", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_beq, rv_op_beq, rv_op_beq },
1603
      rv_op_and },
1585
    { "c.bnez", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_bne, rv_op_bne, rv_op_bne },
1604
    { "c.subw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_subw, rv_op_subw,
1605
      rv_op_subw },
1606
    { "c.addw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_addw, rv_op_addw,
1607
      rv_op_addw },
1608
    { "c.j", rv_codec_cj, rv_fmt_rd_offset, NULL, rv_op_jal, rv_op_jal,
1609
      rv_op_jal },
1610
    { "c.beqz", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_beq, rv_op_beq,
1611
      rv_op_beq },
1612
    { "c.bnez", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_bne, rv_op_bne,
1613
      rv_op_bne },
1586
    { "c.slli", rv_codec_ci_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_slli,
1614
    { "c.slli", rv_codec_ci_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_slli,
1587
      rv_op_slli, rv_op_slli, rvcd_imm_nz },
1615
      rv_op_slli, rv_op_slli, rvcd_imm_nz },
1588
    { "c.fldsp", rv_codec_ci_ldsp, rv_fmt_frd_offset_rs1, NULL, rv_op_fld, rv_op_fld, rv_op_fld },
1616
    { "c.fldsp", rv_codec_ci_ldsp, rv_fmt_frd_offset_rs1, NULL, rv_op_fld,
1589
    { "c.lwsp", rv_codec_ci_lwsp, rv_fmt_rd_offset_rs1, NULL, rv_op_lw, rv_op_lw, rv_op_lw },
1617
      rv_op_fld, rv_op_fld },
1590
    { "c.flwsp", rv_codec_ci_lwsp, rv_fmt_frd_offset_rs1, NULL, rv_op_flw, 0, 0 },
1618
    { "c.lwsp", rv_codec_ci_lwsp, rv_fmt_rd_offset_rs1, NULL, rv_op_lw,
1591
    { "c.jr", rv_codec_cr_jr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr, rv_op_jalr, rv_op_jalr },
1619
      rv_op_lw, rv_op_lw },
1592
    { "c.mv", rv_codec_cr_mv, rv_fmt_rd_rs1_rs2, NULL, rv_op_addi, rv_op_addi, rv_op_addi },
1620
    { "c.flwsp", rv_codec_ci_lwsp, rv_fmt_frd_offset_rs1, NULL, rv_op_flw, 0,
1593
    { "c.ebreak", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_ebreak, rv_op_ebreak, rv_op_ebreak },
1621
      0 },
1594
    { "c.jalr", rv_codec_cr_jalr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr, rv_op_jalr, rv_op_jalr },
1622
    { "c.jr", rv_codec_cr_jr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr,
1595
    { "c.add", rv_codec_cr, rv_fmt_rd_rs1_rs2, NULL, rv_op_add, rv_op_add, rv_op_add },
1623
      rv_op_jalr, rv_op_jalr },
1596
    { "c.fsdsp", rv_codec_css_sdsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd, rv_op_fsd, rv_op_fsd },
1624
    { "c.mv", rv_codec_cr_mv, rv_fmt_rd_rs1_rs2, NULL, rv_op_addi, rv_op_addi,
1597
    { "c.swsp", rv_codec_css_swsp, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw, rv_op_sw, rv_op_sw },
1625
      rv_op_addi },
1598
    { "c.fswsp", rv_codec_css_swsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsw, 0, 0 },
1626
    { "c.ebreak", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_ebreak,
1599
    { "c.ld", rv_codec_cl_ld, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld, rv_op_ld },
1627
      rv_op_ebreak, rv_op_ebreak },
1600
    { "c.sd", rv_codec_cs_sd, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd, rv_op_sd },
1628
    { "c.jalr", rv_codec_cr_jalr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr,
1601
    { "c.addiw", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, 0, rv_op_addiw, rv_op_addiw },
1629
      rv_op_jalr, rv_op_jalr },
1602
    { "c.ldsp", rv_codec_ci_ldsp, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld, rv_op_ld },
1630
    { "c.add", rv_codec_cr, rv_fmt_rd_rs1_rs2, NULL, rv_op_add, rv_op_add,
1603
    { "c.sdsp", rv_codec_css_sdsp, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd, rv_op_sd },
1631
      rv_op_add },
1632
    { "c.fsdsp", rv_codec_css_sdsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd,
1633
      rv_op_fsd, rv_op_fsd },
1634
    { "c.swsp", rv_codec_css_swsp, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw,
1635
      rv_op_sw, rv_op_sw },
1636
    { "c.fswsp", rv_codec_css_swsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsw, 0,
1637
      0 },
1638
    { "c.ld", rv_codec_cl_ld, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld,
1639
      rv_op_ld },
1640
    { "c.sd", rv_codec_cs_sd, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd,
1641
      rv_op_sd },
1642
    { "c.addiw", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, 0, rv_op_addiw,
1643
      rv_op_addiw },
1644
    { "c.ldsp", rv_codec_ci_ldsp, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld,
1645
      rv_op_ld },
1646
    { "c.sdsp", rv_codec_css_sdsp, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd,
1647
      rv_op_sd },
1604
    { "c.lq", rv_codec_cl_lq, rv_fmt_rd_offset_rs1, NULL, 0, 0, rv_op_lq },
1648
    { "c.lq", rv_codec_cl_lq, rv_fmt_rd_offset_rs1, NULL, 0, 0, rv_op_lq },
1605
    { "c.sq", rv_codec_cs_sq, rv_fmt_rs2_offset_rs1, NULL, 0, 0, rv_op_sq },
1649
    { "c.sq", rv_codec_cs_sq, rv_fmt_rs2_offset_rs1, NULL, 0, 0, rv_op_sq },
1606
    { "c.lqsp", rv_codec_ci_lqsp, rv_fmt_rd_offset_rs1, NULL, 0, 0, rv_op_lq },
1650
    { "c.lqsp", rv_codec_ci_lqsp, rv_fmt_rd_offset_rs1, NULL, 0, 0, rv_op_lq },
1607
    { "c.sqsp", rv_codec_css_sqsp, rv_fmt_rs2_offset_rs1, NULL, 0, 0, rv_op_sq },
1651
    { "c.sqsp", rv_codec_css_sqsp, rv_fmt_rs2_offset_rs1, NULL, 0, 0,
1652
      rv_op_sq },
1608
    { "nop", rv_codec_i, rv_fmt_none, NULL, 0, 0, 0 },
1653
    { "nop", rv_codec_i, rv_fmt_none, NULL, 0, 0, 0 },
1609
    { "mv", rv_codec_i, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1654
    { "mv", rv_codec_i, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1610
    { "not", rv_codec_i, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1655
    { "not", rv_codec_i, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
Lines 1731-2106 const rv_opcode_data opcode_data[] = { Link Here
1731
    { "zip", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1776
    { "zip", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1732
    { "xperm4", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
1777
    { "xperm4", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
1733
    { "xperm8", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1778
    { "xperm8", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
1734
    { "vle8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle8_v, rv_op_vle8_v, 0 },
1779
    { "vle8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1735
    { "vle16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle16_v, rv_op_vle16_v, 0 },
1780
    { "vle16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1736
    { "vle32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle32_v, rv_op_vle32_v, 0 },
1781
    { "vle32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1737
    { "vle64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle64_v, rv_op_vle64_v, 0 },
1782
    { "vle64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1738
    { "vse8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse8_v, rv_op_vse8_v, 0 },
1783
    { "vse8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1739
    { "vse16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse16_v, rv_op_vse16_v, 0 },
1784
    { "vse16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1740
    { "vse32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse32_v, rv_op_vse32_v, 0 },
1785
    { "vse32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1741
    { "vse64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse64_v, rv_op_vse64_v, 0 },
1786
    { "vse64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1742
    { "vlm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vlm_v, rv_op_vlm_v, 0 },
1787
    { "vlm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1743
    { "vsm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vsm_v, rv_op_vsm_v, 0 },
1788
    { "vsm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1744
    { "vlse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse8_v, rv_op_vlse8_v, 0 },
1789
    { "vlse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1745
    { "vlse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse16_v, rv_op_vlse16_v, 0 },
1790
    { "vlse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1746
    { "vlse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse32_v, rv_op_vlse32_v, 0 },
1791
    { "vlse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1747
    { "vlse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse64_v, rv_op_vlse64_v, 0 },
1792
    { "vlse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1748
    { "vsse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse8_v, rv_op_vsse8_v, 0 },
1793
    { "vsse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1749
    { "vsse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse16_v, rv_op_vsse16_v, 0 },
1794
    { "vsse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1750
    { "vsse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse32_v, rv_op_vsse32_v, 0 },
1795
    { "vsse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1751
    { "vsse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse64_v, rv_op_vsse64_v, 0 },
1796
    { "vsse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, 0, 0, 0 },
1752
    { "vluxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei8_v, rv_op_vluxei8_v, 0 },
1797
    { "vluxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1753
    { "vluxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei16_v, rv_op_vluxei16_v, 0 },
1798
    { "vluxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1754
    { "vluxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei32_v, rv_op_vluxei32_v, 0 },
1799
    { "vluxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1755
    { "vluxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei64_v, rv_op_vluxei64_v, 0 },
1800
    { "vluxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1756
    { "vloxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei8_v, rv_op_vloxei8_v, 0 },
1801
    { "vloxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1757
    { "vloxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei16_v, rv_op_vloxei16_v, 0 },
1802
    { "vloxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1758
    { "vloxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei32_v, rv_op_vloxei32_v, 0 },
1803
    { "vloxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1759
    { "vloxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei64_v, rv_op_vloxei64_v, 0 },
1804
    { "vloxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1760
    { "vsuxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei8_v, rv_op_vsuxei8_v, 0 },
1805
    { "vsuxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1761
    { "vsuxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei16_v, rv_op_vsuxei16_v, 0 },
1806
    { "vsuxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1762
    { "vsuxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei32_v, rv_op_vsuxei32_v, 0 },
1807
    { "vsuxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1763
    { "vsuxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei64_v, rv_op_vsuxei64_v, 0 },
1808
    { "vsuxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1764
    { "vsoxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei8_v, rv_op_vsoxei8_v, 0 },
1809
    { "vsoxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1765
    { "vsoxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei16_v, rv_op_vsoxei16_v, 0 },
1810
    { "vsoxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1766
    { "vsoxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei32_v, rv_op_vsoxei32_v, 0 },
1811
    { "vsoxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1767
    { "vsoxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei64_v, rv_op_vsoxei64_v, 0 },
1812
    { "vsoxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1768
    { "vle8ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle8ff_v, rv_op_vle8ff_v, 0 },
1813
    { "vle8ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1769
    { "vle16ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle16ff_v, rv_op_vle16ff_v, 0 },
1814
    { "vle16ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1770
    { "vle32ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle32ff_v, rv_op_vle32ff_v, 0 },
1815
    { "vle32ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1771
    { "vle64ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle64ff_v, rv_op_vle64ff_v, 0 },
1816
    { "vle64ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1772
    { "vl1re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re8_v, rv_op_vl1re8_v, 0 },
1817
    { "vl1re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1773
    { "vl1re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re16_v, rv_op_vl1re16_v, 0 },
1818
    { "vl1re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1774
    { "vl1re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re32_v, rv_op_vl1re32_v, 0 },
1819
    { "vl1re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1775
    { "vl1re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re64_v, rv_op_vl1re64_v, 0 },
1820
    { "vl1re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1776
    { "vl2re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re8_v, rv_op_vl2re8_v, 0 },
1821
    { "vl2re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1777
    { "vl2re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re16_v, rv_op_vl2re16_v, 0 },
1822
    { "vl2re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1778
    { "vl2re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re32_v, rv_op_vl2re32_v, 0 },
1823
    { "vl2re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1779
    { "vl2re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re64_v, rv_op_vl2re64_v, 0 },
1824
    { "vl2re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1780
    { "vl4re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re8_v, rv_op_vl4re8_v, 0 },
1825
    { "vl4re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1781
    { "vl4re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re16_v, rv_op_vl4re16_v, 0 },
1826
    { "vl4re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1782
    { "vl4re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re32_v, rv_op_vl4re32_v, 0 },
1827
    { "vl4re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1783
    { "vl4re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re64_v, rv_op_vl4re64_v, 0 },
1828
    { "vl4re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1784
    { "vl8re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re8_v, rv_op_vl8re8_v, 0 },
1829
    { "vl8re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1785
    { "vl8re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re16_v, rv_op_vl8re16_v, 0 },
1830
    { "vl8re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1786
    { "vl8re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re32_v, rv_op_vl8re32_v, 0 },
1831
    { "vl8re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1787
    { "vl8re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re64_v, rv_op_vl8re64_v, 0 },
1832
    { "vl8re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1788
    { "vs1r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs1r_v, rv_op_vs1r_v, 0 },
1833
    { "vs1r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1789
    { "vs2r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs2r_v, rv_op_vs2r_v, 0 },
1834
    { "vs2r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1790
    { "vs4r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs4r_v, rv_op_vs4r_v, 0 },
1835
    { "vs4r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1791
    { "vs8r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs8r_v, rv_op_vs8r_v, 0 },
1836
    { "vs8r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, 0, 0, 0 },
1792
    { "vadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vadd_vv, rv_op_vadd_vv, 0 },
1837
    { "vadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1793
    { "vadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vadd_vx, rv_op_vadd_vx, 0 },
1838
    { "vadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1794
    { "vadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vadd_vi, rv_op_vadd_vi, 0 },
1839
    { "vadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1795
    { "vsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsub_vv, rv_op_vsub_vv, 0 },
1840
    { "vsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1796
    { "vsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsub_vx, rv_op_vsub_vx, 0 },
1841
    { "vsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1797
    { "vrsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrsub_vx, rv_op_vrsub_vx, 0 },
1842
    { "vrsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1798
    { "vrsub.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vrsub_vi, rv_op_vrsub_vi, 0 },
1843
    { "vrsub.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1799
    { "vwaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwaddu_vv, rv_op_vwaddu_vv, 0 },
1844
    { "vwaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1800
    { "vwaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwaddu_vx, rv_op_vwaddu_vx, 0 },
1845
    { "vwaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1801
    { "vwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwadd_vv, rv_op_vwadd_vv, 0 },
1846
    { "vwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1802
    { "vwadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwadd_vx, rv_op_vwadd_vx, 0 },
1847
    { "vwadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1803
    { "vwsubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsubu_vv, rv_op_vwsubu_vv, 0 },
1848
    { "vwsubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1804
    { "vwsubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsubu_vx, rv_op_vwsubu_vx, 0 },
1849
    { "vwsubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1805
    { "vwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsub_vv, rv_op_vwsub_vv, 0 },
1850
    { "vwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1806
    { "vwsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsub_vx, rv_op_vwsub_vx, 0 },
1851
    { "vwsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1807
    { "vwaddu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwaddu_wv, rv_op_vwaddu_wv, 0 },
1852
    { "vwaddu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1808
    { "vwaddu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwaddu_wx, rv_op_vwaddu_wx, 0 },
1853
    { "vwaddu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1809
    { "vwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwadd_wv, rv_op_vwadd_wv, 0 },
1854
    { "vwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1810
    { "vwadd.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwadd_wx, rv_op_vwadd_wx, 0 },
1855
    { "vwadd.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1811
    { "vwsubu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsubu_wv, rv_op_vwsubu_wv, 0 },
1856
    { "vwsubu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1812
    { "vwsubu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsubu_wx, rv_op_vwsubu_wx, 0 },
1857
    { "vwsubu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1813
    { "vwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsub_wv, rv_op_vwsub_wv, 0 },
1858
    { "vwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1814
    { "vwsub.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsub_wx, rv_op_vwsub_wx, 0 },
1859
    { "vwsub.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1815
    { "vadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vadc_vvm, rv_op_vadc_vvm, 0 },
1860
    { "vadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, 0, 0, 0 },
1816
    { "vadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vadc_vxm, rv_op_vadc_vxm, 0 },
1861
    { "vadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, 0, 0, 0 },
1817
    { "vadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vadc_vim, rv_op_vadc_vim, 0 },
1862
    { "vadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, 0, 0, 0 },
1818
    { "vmadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmadc_vvm, rv_op_vmadc_vvm, 0 },
1863
    { "vmadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, 0, 0, 0 },
1819
    { "vmadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmadc_vxm, rv_op_vmadc_vxm, 0 },
1864
    { "vmadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, 0, 0, 0 },
1820
    { "vmadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vmadc_vim, rv_op_vmadc_vim, 0 },
1865
    { "vmadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, 0, 0, 0 },
1821
    { "vsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vsbc_vvm, rv_op_vsbc_vvm, 0 },
1866
    { "vsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, 0, 0, 0 },
1822
    { "vsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vsbc_vxm, rv_op_vsbc_vxm, 0 },
1867
    { "vsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, 0, 0, 0 },
1823
    { "vmsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmsbc_vvm, rv_op_vmsbc_vvm, 0 },
1868
    { "vmsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, 0, 0, 0 },
1824
    { "vmsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmsbc_vxm, rv_op_vmsbc_vxm, 0 },
1869
    { "vmsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, 0, 0, 0 },
1825
    { "vand.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vand_vv, rv_op_vand_vv, 0 },
1870
    { "vand.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1826
    { "vand.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vand_vx, rv_op_vand_vx, 0 },
1871
    { "vand.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1827
    { "vand.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vand_vi, rv_op_vand_vi, 0 },
1872
    { "vand.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1828
    { "vor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vor_vv, rv_op_vor_vv, 0 },
1873
    { "vor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1829
    { "vor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vor_vx, rv_op_vor_vx, 0 },
1874
    { "vor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1830
    { "vor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vor_vi, rv_op_vor_vi, 0 },
1875
    { "vor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1831
    { "vxor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vxor_vv, rv_op_vxor_vv, 0 },
1876
    { "vxor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1832
    { "vxor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vxor_vx, rv_op_vxor_vx, 0 },
1877
    { "vxor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1833
    { "vxor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vxor_vi, rv_op_vxor_vi, 0 },
1878
    { "vxor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1834
    { "vsll.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsll_vv, rv_op_vsll_vv, 0 },
1879
    { "vsll.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1835
    { "vsll.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsll_vx, rv_op_vsll_vx, 0 },
1880
    { "vsll.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1836
    { "vsll.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsll_vi, rv_op_vsll_vi, 0 },
1881
    { "vsll.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1837
    { "vsrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsrl_vv, rv_op_vsrl_vv, 0 },
1882
    { "vsrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1838
    { "vsrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsrl_vx, rv_op_vsrl_vx, 0 },
1883
    { "vsrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1839
    { "vsrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsrl_vi, rv_op_vsrl_vi, 0 },
1884
    { "vsrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1840
    { "vsra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsra_vv, rv_op_vsra_vv, 0 },
1885
    { "vsra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1841
    { "vsra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsra_vx, rv_op_vsra_vx, 0 },
1886
    { "vsra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1842
    { "vsra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsra_vi, rv_op_vsra_vi, 0 },
1887
    { "vsra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1843
    { "vnsrl.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnsrl_wv, rv_op_vnsrl_wv, 0 },
1888
    { "vnsrl.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1844
    { "vnsrl.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnsrl_wx, rv_op_vnsrl_wx, 0 },
1889
    { "vnsrl.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1845
    { "vnsrl.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnsrl_wi, rv_op_vnsrl_wi, 0 },
1890
    { "vnsrl.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1846
    { "vnsra.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnsra_wv, rv_op_vnsra_wv, 0 },
1891
    { "vnsra.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1847
    { "vnsra.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnsra_wx, rv_op_vnsra_wx, 0 },
1892
    { "vnsra.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1848
    { "vnsra.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnsra_wi, rv_op_vnsra_wi, 0 },
1893
    { "vnsra.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1849
    { "vmseq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmseq_vv, rv_op_vmseq_vv, 0 },
1894
    { "vmseq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1850
    { "vmseq.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmseq_vx, rv_op_vmseq_vx, 0 },
1895
    { "vmseq.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1851
    { "vmseq.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmseq_vi, rv_op_vmseq_vi, 0 },
1896
    { "vmseq.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1852
    { "vmsne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsne_vv, rv_op_vmsne_vv, 0 },
1897
    { "vmsne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1853
    { "vmsne.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsne_vx, rv_op_vmsne_vx, 0 },
1898
    { "vmsne.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1854
    { "vmsne.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsne_vi, rv_op_vmsne_vi, 0 },
1899
    { "vmsne.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1855
    { "vmsltu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsltu_vv, rv_op_vmsltu_vv, 0 },
1900
    { "vmsltu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1856
    { "vmsltu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsltu_vx, rv_op_vmsltu_vx, 0 },
1901
    { "vmsltu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1857
    { "vmslt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmslt_vv, rv_op_vmslt_vv, 0 },
1902
    { "vmslt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1858
    { "vmslt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmslt_vx, rv_op_vmslt_vx, 0 },
1903
    { "vmslt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1859
    { "vmsleu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsleu_vv, rv_op_vmsleu_vv, 0 },
1904
    { "vmsleu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1860
    { "vmsleu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsleu_vx, rv_op_vmsleu_vx, 0 },
1905
    { "vmsleu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1861
    { "vmsleu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsleu_vi, rv_op_vmsleu_vi, 0 },
1906
    { "vmsleu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1862
    { "vmsle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsle_vv, rv_op_vmsle_vv, 0 },
1907
    { "vmsle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1863
    { "vmsle.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsle_vx, rv_op_vmsle_vx, 0 },
1908
    { "vmsle.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1864
    { "vmsle.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsle_vi, rv_op_vmsle_vi, 0 },
1909
    { "vmsle.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1865
    { "vmsgtu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsgtu_vx, rv_op_vmsgtu_vx, 0 },
1910
    { "vmsgtu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1866
    { "vmsgtu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsgtu_vi, rv_op_vmsgtu_vi, 0 },
1911
    { "vmsgtu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1867
    { "vmsgt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsgt_vx, rv_op_vmsgt_vx, 0 },
1912
    { "vmsgt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1868
    { "vmsgt.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsgt_vi, rv_op_vmsgt_vi, 0 },
1913
    { "vmsgt.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1869
    { "vminu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vminu_vv, rv_op_vminu_vv, 0 },
1914
    { "vminu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1870
    { "vminu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vminu_vx, rv_op_vminu_vx, 0 },
1915
    { "vminu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1871
    { "vmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmin_vv, rv_op_vmin_vv, 0 },
1916
    { "vmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1872
    { "vmin.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmin_vx, rv_op_vmin_vx, 0 },
1917
    { "vmin.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1873
    { "vmaxu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmaxu_vv, rv_op_vmaxu_vv, 0 },
1918
    { "vmaxu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1874
    { "vmaxu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmaxu_vx, rv_op_vmaxu_vx, 0 },
1919
    { "vmaxu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1875
    { "vmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmax_vv, rv_op_vmax_vv, 0 },
1920
    { "vmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1876
    { "vmax.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmax_vx, rv_op_vmax_vx, 0 },
1921
    { "vmax.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1877
    { "vmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmul_vv, rv_op_vmul_vv, 0 },
1922
    { "vmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1878
    { "vmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmul_vx, rv_op_vmul_vx, 0 },
1923
    { "vmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1879
    { "vmulh.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulh_vv, rv_op_vmulh_vv, 0 },
1924
    { "vmulh.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1880
    { "vmulh.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulh_vx, rv_op_vmulh_vx, 0 },
1925
    { "vmulh.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1881
    { "vmulhu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulhu_vv, rv_op_vmulhu_vv, 0 },
1926
    { "vmulhu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1882
    { "vmulhu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulhu_vx, rv_op_vmulhu_vx, 0 },
1927
    { "vmulhu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1883
    { "vmulhsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulhsu_vv, rv_op_vmulhsu_vv, 0 },
1928
    { "vmulhsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1884
    { "vmulhsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulhsu_vx, rv_op_vmulhsu_vx, 0 },
1929
    { "vmulhsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1885
    { "vdivu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vdivu_vv, rv_op_vdivu_vv, 0 },
1930
    { "vdivu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1886
    { "vdivu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vdivu_vx, rv_op_vdivu_vx, 0 },
1931
    { "vdivu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1887
    { "vdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vdiv_vv, rv_op_vdiv_vv, 0 },
1932
    { "vdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1888
    { "vdiv.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vdiv_vx, rv_op_vdiv_vx, 0 },
1933
    { "vdiv.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1889
    { "vremu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vremu_vv, rv_op_vremu_vv, 0 },
1934
    { "vremu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1890
    { "vremu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vremu_vx, rv_op_vremu_vx, 0 },
1935
    { "vremu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1891
    { "vrem.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrem_vv, rv_op_vrem_vv, 0 },
1936
    { "vrem.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1892
    { "vrem.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrem_vx, rv_op_vrem_vx, 0 },
1937
    { "vrem.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1893
    { "vwmulu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmulu_vv, rv_op_vwmulu_vv, 0 },
1938
    { "vwmulu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1894
    { "vwmulu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmulu_vx, rv_op_vwmulu_vx, 0 },
1939
    { "vwmulu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1895
    { "vwmulsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmulsu_vv, rv_op_vwmulsu_vv, 0 },
1940
    { "vwmulsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1896
    { "vwmulsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmulsu_vx, rv_op_vwmulsu_vx, 0 },
1941
    { "vwmulsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1897
    { "vwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmul_vv, rv_op_vwmul_vv, 0 },
1942
    { "vwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1898
    { "vwmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmul_vx, rv_op_vwmul_vx, 0 },
1943
    { "vwmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1899
    { "vmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vmacc_vv, rv_op_vmacc_vv, 0 },
1944
    { "vmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1900
    { "vmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vmacc_vx, rv_op_vmacc_vx, 0 },
1945
    { "vmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1901
    { "vnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vnmsac_vv, rv_op_vnmsac_vv, 0 },
1946
    { "vnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1902
    { "vnmsac.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vnmsac_vx, rv_op_vnmsac_vx, 0 },
1947
    { "vnmsac.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1903
    { "vmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vmadd_vv, rv_op_vmadd_vv, 0 },
1948
    { "vmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1904
    { "vmadd.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vmadd_vx, rv_op_vmadd_vx, 0 },
1949
    { "vmadd.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1905
    { "vnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vnmsub_vv, rv_op_vnmsub_vv, 0 },
1950
    { "vnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1906
    { "vnmsub.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vnmsub_vx, rv_op_vnmsub_vx, 0 },
1951
    { "vnmsub.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1907
    { "vwmaccu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmaccu_vv, rv_op_vwmaccu_vv, 0 },
1952
    { "vwmaccu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1908
    { "vwmaccu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccu_vx, rv_op_vwmaccu_vx, 0 },
1953
    { "vwmaccu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1909
    { "vwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmacc_vv, rv_op_vwmacc_vv, 0 },
1954
    { "vwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1910
    { "vwmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmacc_vx, rv_op_vwmacc_vx, 0 },
1955
    { "vwmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1911
    { "vwmaccsu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmaccsu_vv, rv_op_vwmaccsu_vv, 0 },
1956
    { "vwmaccsu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1912
    { "vwmaccsu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccsu_vx, rv_op_vwmaccsu_vx, 0 },
1957
    { "vwmaccsu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1913
    { "vwmaccus.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccus_vx, rv_op_vwmaccus_vx, 0 },
1958
    { "vwmaccus.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, 0, 0, 0 },
1914
    { "vmv.v.v", rv_codec_v_r, rv_fmt_vd_vs1, NULL, rv_op_vmv_v_v, rv_op_vmv_v_v, 0 },
1959
    { "vmv.v.v", rv_codec_v_r, rv_fmt_vd_vs1, NULL, 0, 0, 0 },
1915
    { "vmv.v.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, rv_op_vmv_v_x, rv_op_vmv_v_x, 0 },
1960
    { "vmv.v.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, 0, 0, 0 },
1916
    { "vmv.v.i", rv_codec_v_i, rv_fmt_vd_imm, NULL, rv_op_vmv_v_i, rv_op_vmv_v_i, 0 },
1961
    { "vmv.v.i", rv_codec_v_i, rv_fmt_vd_imm, NULL, 0, 0, 0 },
1917
    { "vmerge.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmerge_vvm, rv_op_vmerge_vvm, 0 },
1962
    { "vmerge.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, 0, 0, 0 },
1918
    { "vmerge.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmerge_vxm, rv_op_vmerge_vxm, 0 },
1963
    { "vmerge.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, 0, 0, 0 },
1919
    { "vmerge.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vmerge_vim, rv_op_vmerge_vim, 0 },
1964
    { "vmerge.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, 0, 0, 0 },
1920
    { "vsaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsaddu_vv, rv_op_vsaddu_vv, 0 },
1965
    { "vsaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1921
    { "vsaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsaddu_vx, rv_op_vsaddu_vx, 0 },
1966
    { "vsaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1922
    { "vsaddu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vsaddu_vi, rv_op_vsaddu_vi, 0 },
1967
    { "vsaddu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1923
    { "vsadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsadd_vv, rv_op_vsadd_vv, 0 },
1968
    { "vsadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1924
    { "vsadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsadd_vx, rv_op_vsadd_vx, 0 },
1969
    { "vsadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1925
    { "vsadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vsadd_vi, rv_op_vsadd_vi, 0 },
1970
    { "vsadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, 0, 0, 0 },
1926
    { "vssubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssubu_vv, rv_op_vssubu_vv, 0 },
1971
    { "vssubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1927
    { "vssubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssubu_vx, rv_op_vssubu_vx, 0 },
1972
    { "vssubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1928
    { "vssub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssub_vv, rv_op_vssub_vv, 0 },
1973
    { "vssub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1929
    { "vssub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssub_vx, rv_op_vssub_vx, 0 },
1974
    { "vssub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1930
    { "vaadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vaadd_vv, rv_op_vaadd_vv, 0 },
1975
    { "vaadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1931
    { "vaadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vaadd_vx, rv_op_vaadd_vx, 0 },
1976
    { "vaadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1932
    { "vaaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vaaddu_vv, rv_op_vaaddu_vv, 0 },
1977
    { "vaaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1933
    { "vaaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vaaddu_vx, rv_op_vaaddu_vx, 0 },
1978
    { "vaaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1934
    { "vasub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vasub_vv, rv_op_vasub_vv, 0 },
1979
    { "vasub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1935
    { "vasub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vasub_vx, rv_op_vasub_vx, 0 },
1980
    { "vasub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1936
    { "vasubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vasubu_vv, rv_op_vasubu_vv, 0 },
1981
    { "vasubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1937
    { "vasubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vasubu_vx, rv_op_vasubu_vx, 0 },
1982
    { "vasubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1938
    { "vsmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsmul_vv, rv_op_vsmul_vv, 0 },
1983
    { "vsmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1939
    { "vsmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsmul_vx, rv_op_vsmul_vx, 0 },
1984
    { "vsmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1940
    { "vssrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssrl_vv, rv_op_vssrl_vv, 0 },
1985
    { "vssrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1941
    { "vssrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssrl_vx, rv_op_vssrl_vx, 0 },
1986
    { "vssrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1942
    { "vssrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vssrl_vi, rv_op_vssrl_vi, 0 },
1987
    { "vssrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1943
    { "vssra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssra_vv, rv_op_vssra_vv, 0 },
1988
    { "vssra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1944
    { "vssra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssra_vx, rv_op_vssra_vx, 0 },
1989
    { "vssra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1945
    { "vssra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vssra_vi, rv_op_vssra_vi, 0 },
1990
    { "vssra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1946
    { "vnclipu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnclipu_wv, rv_op_vnclipu_wv, 0 },
1991
    { "vnclipu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1947
    { "vnclipu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnclipu_wx, rv_op_vnclipu_wx, 0 },
1992
    { "vnclipu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1948
    { "vnclipu.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnclipu_wi, rv_op_vnclipu_wi, 0 },
1993
    { "vnclipu.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1949
    { "vnclip.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnclip_wv, rv_op_vnclip_wv, 0 },
1994
    { "vnclip.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1950
    { "vnclip.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnclip_wx, rv_op_vnclip_wx, 0 },
1995
    { "vnclip.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
1951
    { "vnclip.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnclip_wi, rv_op_vnclip_wi, 0 },
1996
    { "vnclip.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
1952
    { "vfadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfadd_vv, rv_op_vfadd_vv, 0 },
1997
    { "vfadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1953
    { "vfadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfadd_vf, rv_op_vfadd_vf, 0 },
1998
    { "vfadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1954
    { "vfsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsub_vv, rv_op_vfsub_vv, 0 },
1999
    { "vfsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1955
    { "vfsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsub_vf, rv_op_vfsub_vf, 0 },
2000
    { "vfsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1956
    { "vfrsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfrsub_vf, rv_op_vfrsub_vf, 0 },
2001
    { "vfrsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1957
    { "vfwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwadd_vv, rv_op_vfwadd_vv, 0 },
2002
    { "vfwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1958
    { "vfwadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwadd_vf, rv_op_vfwadd_vf, 0 },
2003
    { "vfwadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1959
    { "vfwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwadd_wv, rv_op_vfwadd_wv, 0 },
2004
    { "vfwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1960
    { "vfwadd.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwadd_wf, rv_op_vfwadd_wf, 0 },
2005
    { "vfwadd.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1961
    { "vfwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwsub_vv, rv_op_vfwsub_vv, 0 },
2006
    { "vfwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1962
    { "vfwsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwsub_vf, rv_op_vfwsub_vf, 0 },
2007
    { "vfwsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1963
    { "vfwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwsub_wv, rv_op_vfwsub_wv, 0 },
2008
    { "vfwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1964
    { "vfwsub.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwsub_wf, rv_op_vfwsub_wf, 0 },
2009
    { "vfwsub.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1965
    { "vfmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmul_vv, rv_op_vfmul_vv, 0 },
2010
    { "vfmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1966
    { "vfmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmul_vf, rv_op_vfmul_vf, 0 },
2011
    { "vfmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1967
    { "vfdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfdiv_vv, rv_op_vfdiv_vv, 0 },
2012
    { "vfdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1968
    { "vfdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfdiv_vf, rv_op_vfdiv_vf, 0 },
2013
    { "vfdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1969
    { "vfrdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfrdiv_vf, rv_op_vfrdiv_vf, 0 },
2014
    { "vfrdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1970
    { "vfwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwmul_vv, rv_op_vfwmul_vv, 0 },
2015
    { "vfwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
1971
    { "vfwmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwmul_vf, rv_op_vfwmul_vf, 0 },
2016
    { "vfwmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
1972
    { "vfmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmacc_vv, rv_op_vfmacc_vv, 0 },
2017
    { "vfmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1973
    { "vfmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmacc_vf, rv_op_vfmacc_vf, 0 },
2018
    { "vfmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1974
    { "vfnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmacc_vv, rv_op_vfnmacc_vv, 0 },
2019
    { "vfnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1975
    { "vfnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmacc_vf, rv_op_vfnmacc_vf, 0 },
2020
    { "vfnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1976
    { "vfmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmsac_vv, rv_op_vfmsac_vv, 0 },
2021
    { "vfmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1977
    { "vfmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmsac_vf, rv_op_vfmsac_vf, 0 },
2022
    { "vfmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1978
    { "vfnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmsac_vv, rv_op_vfnmsac_vv, 0 },
2023
    { "vfnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1979
    { "vfnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmsac_vf, rv_op_vfnmsac_vf, 0 },
2024
    { "vfnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1980
    { "vfmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmadd_vv, rv_op_vfmadd_vv, 0 },
2025
    { "vfmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1981
    { "vfmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmadd_vf, rv_op_vfmadd_vf, 0 },
2026
    { "vfmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1982
    { "vfnmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmadd_vv, rv_op_vfnmadd_vv, 0 },
2027
    { "vfnmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1983
    { "vfnmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmadd_vf, rv_op_vfnmadd_vf, 0 },
2028
    { "vfnmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1984
    { "vfmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmsub_vv, rv_op_vfmsub_vv, 0 },
2029
    { "vfmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1985
    { "vfmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmsub_vf, rv_op_vfmsub_vf, 0 },
2030
    { "vfmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1986
    { "vfnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmsub_vv, rv_op_vfnmsub_vv, 0 },
2031
    { "vfnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1987
    { "vfnmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmsub_vf, rv_op_vfnmsub_vf, 0 },
2032
    { "vfnmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1988
    { "vfwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwmacc_vv, rv_op_vfwmacc_vv, 0 },
2033
    { "vfwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1989
    { "vfwmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwmacc_vf, rv_op_vfwmacc_vf, 0 },
2034
    { "vfwmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1990
    { "vfwnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwnmacc_vv, rv_op_vfwnmacc_vv, 0 },
2035
    { "vfwnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1991
    { "vfwnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwnmacc_vf, rv_op_vfwnmacc_vf, 0 },
2036
    { "vfwnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1992
    { "vfwmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwmsac_vv, rv_op_vfwmsac_vv, 0 },
2037
    { "vfwmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1993
    { "vfwmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwmsac_vf, rv_op_vfwmsac_vf, 0 },
2038
    { "vfwmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1994
    { "vfwnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwnmsac_vv, rv_op_vfwnmsac_vv, 0 },
2039
    { "vfwnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, 0, 0, 0 },
1995
    { "vfwnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwnmsac_vf, rv_op_vfwnmsac_vf, 0 },
2040
    { "vfwnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, 0, 0, 0 },
1996
    { "vfsqrt.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfsqrt_v, rv_op_vfsqrt_v, 0 },
2041
    { "vfsqrt.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
1997
    { "vfrsqrt7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfrsqrt7_v, rv_op_vfrsqrt7_v, 0 },
2042
    { "vfrsqrt7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
1998
    { "vfrec7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfrec7_v, rv_op_vfrec7_v, 0 },
2043
    { "vfrec7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
1999
    { "vfmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmin_vv, rv_op_vfmin_vv, 0 },
2044
    { "vfmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2000
    { "vfmin.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmin_vf, rv_op_vfmin_vf, 0 },
2045
    { "vfmin.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2001
    { "vfmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmax_vv, rv_op_vfmax_vv, 0 },
2046
    { "vfmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2002
    { "vfmax.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmax_vf, rv_op_vfmax_vf, 0 },
2047
    { "vfmax.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2003
    { "vfsgnj.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnj_vv, rv_op_vfsgnj_vv, 0 },
2048
    { "vfsgnj.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2004
    { "vfsgnj.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnj_vf, rv_op_vfsgnj_vf, 0 },
2049
    { "vfsgnj.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2005
    { "vfsgnjn.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnjn_vv, rv_op_vfsgnjn_vv, 0 },
2050
    { "vfsgnjn.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2006
    { "vfsgnjn.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnjn_vf, rv_op_vfsgnjn_vf, 0 },
2051
    { "vfsgnjn.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2007
    { "vfsgnjx.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnjx_vv, rv_op_vfsgnjx_vv, 0 },
2052
    { "vfsgnjx.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2008
    { "vfsgnjx.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnjx_vf, rv_op_vfsgnjx_vf, 0 },
2053
    { "vfsgnjx.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2009
    { "vfslide1up.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfslide1up_vf, rv_op_vfslide1up_vf, 0 },
2054
    { "vfslide1up.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2010
    { "vfslide1down.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfslide1down_vf, rv_op_vfslide1down_vf, 0 },
2055
    { "vfslide1down.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2011
    { "vmfeq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfeq_vv, rv_op_vmfeq_vv, 0 },
2056
    { "vmfeq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2012
    { "vmfeq.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfeq_vf, rv_op_vmfeq_vf, 0 },
2057
    { "vmfeq.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2013
    { "vmfne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfne_vv, rv_op_vmfne_vv, 0 },
2058
    { "vmfne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2014
    { "vmfne.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfne_vf, rv_op_vmfne_vf, 0 },
2059
    { "vmfne.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2015
    { "vmflt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmflt_vv, rv_op_vmflt_vv, 0 },
2060
    { "vmflt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2016
    { "vmflt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmflt_vf, rv_op_vmflt_vf, 0 },
2061
    { "vmflt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2017
    { "vmfle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfle_vv, rv_op_vmfle_vv, 0 },
2062
    { "vmfle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2018
    { "vmfle.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfle_vf, rv_op_vmfle_vf, 0 },
2063
    { "vmfle.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2019
    { "vmfgt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfgt_vf, rv_op_vmfgt_vf, 0 },
2064
    { "vmfgt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2020
    { "vmfge.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfge_vf, rv_op_vmfge_vf, 0 },
2065
    { "vmfge.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, 0, 0, 0 },
2021
    { "vfclass.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfclass_v, rv_op_vfclass_v, 0 },
2066
    { "vfclass.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2022
    { "vfmerge.vfm", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vl, NULL, rv_op_vfmerge_vfm, rv_op_vfmerge_vfm, 0 },
2067
    { "vfmerge.vfm", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vl, NULL, 0, 0, 0 },
2023
    { "vfmv.v.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, rv_op_vfmv_v_f, rv_op_vfmv_v_f, 0 },
2068
    { "vfmv.v.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, 0, 0, 0 },
2024
    { "vfcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_xu_f_v, rv_op_vfcvt_xu_f_v, 0 },
2069
    { "vfcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2025
    { "vfcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_x_f_v, rv_op_vfcvt_x_f_v, 0 },
2070
    { "vfcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2026
    { "vfcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_f_xu_v, rv_op_vfcvt_f_xu_v, 0 },
2071
    { "vfcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2027
    { "vfcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_f_x_v, rv_op_vfcvt_f_x_v, 0 },
2072
    { "vfcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2028
    { "vfcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_rtz_xu_f_v, rv_op_vfcvt_rtz_xu_f_v, 0 },
2073
    { "vfcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2029
    { "vfcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_rtz_x_f_v, rv_op_vfcvt_rtz_x_f_v, 0 },
2074
    { "vfcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2030
    { "vfwcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_xu_f_v, rv_op_vfwcvt_xu_f_v, 0 },
2075
    { "vfwcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2031
    { "vfwcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_x_f_v, rv_op_vfwcvt_x_f_v, 0 },
2076
    { "vfwcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2032
    { "vfwcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_xu_v, rv_op_vfwcvt_f_xu_v, 0 },
2077
    { "vfwcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2033
    { "vfwcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_x_v, rv_op_vfwcvt_f_x_v, 0 },
2078
    { "vfwcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2034
    { "vfwcvt.f.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_f_v, rv_op_vfwcvt_f_f_v, 0 },
2079
    { "vfwcvt.f.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2035
    { "vfwcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_rtz_xu_f_v, rv_op_vfwcvt_rtz_xu_f_v, 0 },
2080
    { "vfwcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2036
    { "vfwcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_rtz_x_f_v, rv_op_vfwcvt_rtz_x_f_v, 0 },
2081
    { "vfwcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2037
    { "vfncvt.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_xu_f_w, rv_op_vfncvt_xu_f_w, 0 },
2082
    { "vfncvt.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2038
    { "vfncvt.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_x_f_w, rv_op_vfncvt_x_f_w, 0 },
2083
    { "vfncvt.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2039
    { "vfncvt.f.xu.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_xu_w, rv_op_vfncvt_f_xu_w, 0 },
2084
    { "vfncvt.f.xu.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2040
    { "vfncvt.f.x.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_x_w, rv_op_vfncvt_f_x_w, 0 },
2085
    { "vfncvt.f.x.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2041
    { "vfncvt.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_f_w, rv_op_vfncvt_f_f_w, 0 },
2086
    { "vfncvt.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2042
    { "vfncvt.rod.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rod_f_f_w, rv_op_vfncvt_rod_f_f_w, 0 },
2087
    { "vfncvt.rod.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2043
    { "vfncvt.rtz.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rtz_xu_f_w, rv_op_vfncvt_rtz_xu_f_w, 0 },
2088
    { "vfncvt.rtz.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2044
    { "vfncvt.rtz.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rtz_x_f_w, rv_op_vfncvt_rtz_x_f_w, 0 },
2089
    { "vfncvt.rtz.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2045
    { "vredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredsum_vs, rv_op_vredsum_vs, 0 },
2090
    { "vredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2046
    { "vredand.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredand_vs, rv_op_vredand_vs, 0 },
2091
    { "vredand.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2047
    { "vredor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredor_vs, rv_op_vredor_vs, 0 },
2092
    { "vredor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2048
    { "vredxor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredxor_vs, rv_op_vredxor_vs, 0 },
2093
    { "vredxor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2049
    { "vredminu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredminu_vs, rv_op_vredminu_vs, 0 },
2094
    { "vredminu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2050
    { "vredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmin_vs, rv_op_vredmin_vs, 0 },
2095
    { "vredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2051
    { "vredmaxu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmaxu_vs, rv_op_vredmaxu_vs, 0 },
2096
    { "vredmaxu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2052
    { "vredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmax_vs, rv_op_vredmax_vs, 0 },
2097
    { "vredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2053
    { "vwredsumu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwredsumu_vs, rv_op_vwredsumu_vs, 0 },
2098
    { "vwredsumu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2054
    { "vwredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwredsum_vs, rv_op_vwredsum_vs, 0 },
2099
    { "vwredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2055
    { "vfredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredusum_vs, rv_op_vfredusum_vs, 0 },
2100
    { "vfredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2056
    { "vfredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredosum_vs, rv_op_vfredosum_vs, 0 },
2101
    { "vfredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2057
    { "vfredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredmin_vs, rv_op_vfredmin_vs, 0 },
2102
    { "vfredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2058
    { "vfredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredmax_vs, rv_op_vfredmax_vs, 0 },
2103
    { "vfredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2059
    { "vfwredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwredusum_vs, rv_op_vfwredusum_vs, 0 },
2104
    { "vfwredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2060
    { "vfwredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwredosum_vs, rv_op_vfwredosum_vs, 0 },
2105
    { "vfwredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2061
    { "vmand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmand_mm, rv_op_vmand_mm, 0 },
2106
    { "vmand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2062
    { "vmnand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmnand_mm, rv_op_vmnand_mm, 0 },
2107
    { "vmnand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2063
    { "vmandn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmandn_mm, rv_op_vmandn_mm, 0 },
2108
    { "vmandn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2064
    { "vmxor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmxor_mm, rv_op_vmxor_mm, 0 },
2109
    { "vmxor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2065
    { "vmor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmor_mm, rv_op_vmor_mm, 0 },
2110
    { "vmor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2066
    { "vmnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmnor_mm, rv_op_vmnor_mm, 0 },
2111
    { "vmnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2067
    { "vmorn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmorn_mm, rv_op_vmorn_mm, 0 },
2112
    { "vmorn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2068
    { "vmxnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmxnor_mm, rv_op_vmxnor_mm, 0 },
2113
    { "vmxnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2069
    { "vcpop.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, rv_op_vcpop_m, rv_op_vcpop_m, 0 },
2114
    { "vcpop.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, 0, 0, 0 },
2070
    { "vfirst.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, rv_op_vfirst_m, rv_op_vfirst_m, 0 },
2115
    { "vfirst.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, 0, 0, 0 },
2071
    { "vmsbf.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsbf_m, rv_op_vmsbf_m, 0 },
2116
    { "vmsbf.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2072
    { "vmsif.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsif_m, rv_op_vmsif_m, 0 },
2117
    { "vmsif.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2073
    { "vmsof.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsof_m, rv_op_vmsof_m, 0 },
2118
    { "vmsof.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2074
    { "viota.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_viota_m, rv_op_viota_m, 0 },
2119
    { "viota.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2075
    { "vid.v", rv_codec_v_r, rv_fmt_vd_vm, NULL, rv_op_vid_v, rv_op_vid_v, 0 },
2120
    { "vid.v", rv_codec_v_r, rv_fmt_vd_vm, NULL, 0, 0, 0 },
2076
    { "vmv.x.s", rv_codec_v_r, rv_fmt_rd_vs2, NULL, rv_op_vmv_x_s, rv_op_vmv_x_s, 0 },
2121
    { "vmv.x.s", rv_codec_v_r, rv_fmt_rd_vs2, NULL, 0, 0, 0 },
2077
    { "vmv.s.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, rv_op_vmv_s_x, rv_op_vmv_s_x, 0 },
2122
    { "vmv.s.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, 0, 0, 0 },
2078
    { "vfmv.f.s", rv_codec_v_r, rv_fmt_fd_vs2, NULL, rv_op_vfmv_f_s, rv_op_vfmv_f_s, 0 },
2123
    { "vfmv.f.s", rv_codec_v_r, rv_fmt_fd_vs2, NULL, 0, 0, 0 },
2079
    { "vfmv.s.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, rv_op_vfmv_s_f, rv_op_vfmv_s_f, 0 },
2124
    { "vfmv.s.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, 0, 0, 0 },
2080
    { "vslideup.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslideup_vx, rv_op_vslideup_vx, 0 },
2125
    { "vslideup.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
2081
    { "vslideup.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vslideup_vi, rv_op_vslideup_vi, 0 },
2126
    { "vslideup.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
2082
    { "vslide1up.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslide1up_vx, rv_op_vslide1up_vx, 0 },
2127
    { "vslide1up.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
2083
    { "vslidedown.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslidedown_vx, rv_op_vslidedown_vx, 0 },
2128
    { "vslidedown.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
2084
    { "vslidedown.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vslidedown_vi, rv_op_vslidedown_vi, 0 },
2129
    { "vslidedown.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
2085
    { "vslide1down.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslide1down_vx, rv_op_vslide1down_vx, 0 },
2130
    { "vslide1down.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
2086
    { "vrgather.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrgather_vv, rv_op_vrgather_vv, 0 },
2131
    { "vrgather.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2087
    { "vrgatherei16.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrgatherei16_vv, rv_op_vrgatherei16_vv, 0 },
2132
    { "vrgatherei16.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, 0, 0, 0 },
2088
    { "vrgather.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrgather_vx, rv_op_vrgather_vx, 0 },
2133
    { "vrgather.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, 0, 0, 0 },
2089
    { "vrgather.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vrgather_vi, rv_op_vrgather_vi, 0 },
2134
    { "vrgather.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, 0, 0, 0 },
2090
    { "vcompress.vm", rv_codec_v_r, rv_fmt_vd_vs2_vs1, NULL, rv_op_vcompress_vm, rv_op_vcompress_vm, 0 },
2135
    { "vcompress.vm", rv_codec_v_r, rv_fmt_vd_vs2_vs1, NULL, 0, 0, 0 },
2091
    { "vmv1r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv1r_v, rv_op_vmv1r_v, 0 },
2136
    { "vmv1r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
2092
    { "vmv2r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv2r_v, rv_op_vmv2r_v, 0 },
2137
    { "vmv2r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
2093
    { "vmv4r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv4r_v, rv_op_vmv4r_v, 0 },
2138
    { "vmv4r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
2094
    { "vmv8r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv8r_v, rv_op_vmv8r_v, 0 },
2139
    { "vmv8r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, 0, 0, 0 },
2095
    { "vzext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf2, rv_op_vzext_vf2, 0 },
2140
    { "vzext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2096
    { "vzext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf4, rv_op_vzext_vf4, 0 },
2141
    { "vzext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2097
    { "vzext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf8, rv_op_vzext_vf8, 0 },
2142
    { "vzext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2098
    { "vsext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf2, rv_op_vsext_vf2, 0 },
2143
    { "vsext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2099
    { "vsext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf4, rv_op_vsext_vf4, 0 },
2144
    { "vsext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2100
    { "vsext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf8, rv_op_vsext_vf8, 0 },
2145
    { "vsext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, 0, 0, 0 },
2101
    { "vsetvli", rv_codec_vsetvli, rv_fmt_vsetvli, NULL, rv_op_vsetvli, rv_op_vsetvli, 0 },
2146
    { "vsetvli", rv_codec_vsetvli, rv_fmt_vsetvli, NULL, 0, 0, 0 },
2102
    { "vsetivli", rv_codec_vsetivli, rv_fmt_vsetivli, NULL, rv_op_vsetivli, rv_op_vsetivli, 0 },
2147
    { "vsetivli", rv_codec_vsetivli, rv_fmt_vsetivli, NULL, 0, 0, 0 },
2103
    { "vsetvl", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, rv_op_vsetvl, rv_op_vsetvl, 0 },
2148
    { "vsetvl", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
2104
    { "c.zext.b", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
2149
    { "c.zext.b", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
2105
    { "c.sext.b", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
2150
    { "c.sext.b", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
2106
    { "c.zext.h", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
2151
    { "c.zext.h", rv_codec_zcb_ext, rv_fmt_rd, NULL, 0 },
Lines 2345-2353 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2345
{
2390
{
2346
    rv_inst inst = dec->inst;
2391
    rv_inst inst = dec->inst;
2347
    rv_opcode op = rv_op_illegal;
2392
    rv_opcode op = rv_op_illegal;
2348
    switch (((inst >> 0) & 0b11)) {
2393
    switch ((inst >> 0) & 0b11) {
2349
    case 0:
2394
    case 0:
2350
        switch (((inst >> 13) & 0b111)) {
2395
        switch ((inst >> 13) & 0b111) {
2351
        case 0: op = rv_op_c_addi4spn; break;
2396
        case 0: op = rv_op_c_addi4spn; break;
2352
        case 1:
2397
        case 1:
2353
            if (isa == rv128) {
2398
            if (isa == rv128) {
Lines 2400-2408 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2400
        }
2445
        }
2401
        break;
2446
        break;
2402
    case 1:
2447
    case 1:
2403
        switch (((inst >> 13) & 0b111)) {
2448
        switch ((inst >> 13) & 0b111) {
2404
        case 0:
2449
        case 0:
2405
            switch (((inst >> 2) & 0b11111111111)) {
2450
            switch ((inst >> 2) & 0b11111111111) {
2406
            case 0: op = rv_op_c_nop; break;
2451
            case 0: op = rv_op_c_nop; break;
2407
            default: op = rv_op_c_addi; break;
2452
            default: op = rv_op_c_addi; break;
2408
            }
2453
            }
Lines 2416-2428 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2416
            break;
2461
            break;
2417
        case 2: op = rv_op_c_li; break;
2462
        case 2: op = rv_op_c_li; break;
2418
        case 3:
2463
        case 3:
2419
            switch (((inst >> 7) & 0b11111)) {
2464
            switch ((inst >> 7) & 0b11111) {
2420
            case 2: op = rv_op_c_addi16sp; break;
2465
            case 2: op = rv_op_c_addi16sp; break;
2421
            default: op = rv_op_c_lui; break;
2466
            default: op = rv_op_c_lui; break;
2422
            }
2467
            }
2423
            break;
2468
            break;
2424
        case 4:
2469
        case 4:
2425
            switch (((inst >> 10) & 0b11)) {
2470
            switch ((inst >> 10) & 0b11) {
2426
            case 0:
2471
            case 0:
2427
                op = rv_op_c_srli;
2472
                op = rv_op_c_srli;
2428
                break;
2473
                break;
Lines 2459-2465 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2459
        }
2504
        }
2460
        break;
2505
        break;
2461
    case 2:
2506
    case 2:
2462
        switch (((inst >> 13) & 0b111)) {
2507
        switch ((inst >> 13) & 0b111) {
2463
        case 0:
2508
        case 0:
2464
            op = rv_op_c_slli;
2509
            op = rv_op_c_slli;
2465
            break;
2510
            break;
Lines 2479-2495 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2479
            }
2524
            }
2480
            break;
2525
            break;
2481
        case 4:
2526
        case 4:
2482
            switch (((inst >> 12) & 0b1)) {
2527
            switch ((inst >> 12) & 0b1) {
2483
            case 0:
2528
            case 0:
2484
                switch (((inst >> 2) & 0b11111)) {
2529
                switch ((inst >> 2) & 0b11111) {
2485
                case 0: op = rv_op_c_jr; break;
2530
                case 0: op = rv_op_c_jr; break;
2486
                default: op = rv_op_c_mv; break;
2531
                default: op = rv_op_c_mv; break;
2487
                }
2532
                }
2488
                break;
2533
                break;
2489
            case 1:
2534
            case 1:
2490
                switch (((inst >> 2) & 0b11111)) {
2535
                switch ((inst >> 2) & 0b11111) {
2491
                case 0:
2536
                case 0:
2492
                    switch (((inst >> 7) & 0b11111)) {
2537
                    switch ((inst >> 7) & 0b11111) {
2493
                    case 0: op = rv_op_c_ebreak; break;
2538
                    case 0: op = rv_op_c_ebreak; break;
2494
                    default: op = rv_op_c_jalr; break;
2539
                    default: op = rv_op_c_jalr; break;
2495
                    }
2540
                    }
Lines 2504-2510 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2504
                op = rv_op_c_sqsp;
2549
                op = rv_op_c_sqsp;
2505
            } else {
2550
            } else {
2506
                op = rv_op_c_fsdsp;
2551
                op = rv_op_c_fsdsp;
2507
                if (((inst >> 12) & 0b01)) {
2552
                if (dec->cfg->ext_zcmp && ((inst >> 12) & 0b01)) {
2508
                    switch ((inst >> 8) & 0b01111) {
2553
                    switch ((inst >> 8) & 0b01111) {
2509
                    case 8:
2554
                    case 8:
2510
                        if (((inst >> 4) & 0b01111) >= 4) {
2555
                        if (((inst >> 4) & 0b01111) >= 4) {
Lines 2530-2535 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2530
                } else {
2575
                } else {
2531
                    switch ((inst >> 10) & 0b011) {
2576
                    switch ((inst >> 10) & 0b011) {
2532
                    case 0:
2577
                    case 0:
2578
                        if (!dec->cfg->ext_zcmt) {
2579
                            break;
2580
                        }
2533
                        if (((inst >> 2) & 0xFF) >= 32) {
2581
                        if (((inst >> 2) & 0xFF) >= 32) {
2534
                            op = rv_op_cm_jalt;
2582
                            op = rv_op_cm_jalt;
2535
                        } else {
2583
                        } else {
Lines 2537-2542 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2537
                        }
2585
                        }
2538
                        break;
2586
                        break;
2539
                    case 3:
2587
                    case 3:
2588
                        if (!dec->cfg->ext_zcmp) {
2589
                            break;
2590
                        }
2540
                        switch ((inst >> 5) & 0b011) {
2591
                        switch ((inst >> 5) & 0b011) {
2541
                        case 1: op = rv_op_cm_mvsa01; break;
2592
                        case 1: op = rv_op_cm_mvsa01; break;
2542
                        case 3: op = rv_op_cm_mva01s; break;
2593
                        case 3: op = rv_op_cm_mva01s; break;
Lines 2557-2565 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2557
        }
2608
        }
2558
        break;
2609
        break;
2559
    case 3:
2610
    case 3:
2560
        switch (((inst >> 2) & 0b11111)) {
2611
        switch ((inst >> 2) & 0b11111) {
2561
        case 0:
2612
        case 0:
2562
            switch (((inst >> 12) & 0b111)) {
2613
            switch ((inst >> 12) & 0b111) {
2563
            case 0: op = rv_op_lb; break;
2614
            case 0: op = rv_op_lb; break;
2564
            case 1: op = rv_op_lh; break;
2615
            case 1: op = rv_op_lh; break;
2565
            case 2: op = rv_op_lw; break;
2616
            case 2: op = rv_op_lw; break;
Lines 2571-2587 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2571
            }
2622
            }
2572
            break;
2623
            break;
2573
        case 1:
2624
        case 1:
2574
            switch (((inst >> 12) & 0b111)) {
2625
            switch ((inst >> 12) & 0b111) {
2575
            case 0:
2626
            case 0:
2576
                switch (((inst >> 20) & 0b111111111111)) {
2627
                switch ((inst >> 20) & 0b111111111111) {
2577
                case 40: op = rv_op_vl1re8_v; break;
2628
                case 40: op = rv_op_vl1re8_v; break;
2578
                case 552: op = rv_op_vl2re8_v; break;
2629
                case 552: op = rv_op_vl2re8_v; break;
2579
                case 1576: op = rv_op_vl4re8_v; break;
2630
                case 1576: op = rv_op_vl4re8_v; break;
2580
                case 3624: op = rv_op_vl8re8_v; break;
2631
                case 3624: op = rv_op_vl8re8_v; break;
2581
                }
2632
                }
2582
                switch (((inst >> 26) & 0b111)) {
2633
                switch ((inst >> 26) & 0b111) {
2583
                case 0:
2634
                case 0:
2584
                    switch (((inst >> 20) & 0b11111)) {
2635
                    switch ((inst >> 20) & 0b11111) {
2585
                    case 0: op = rv_op_vle8_v; break;
2636
                    case 0: op = rv_op_vle8_v; break;
2586
                    case 11: op = rv_op_vlm_v; break;
2637
                    case 11: op = rv_op_vlm_v; break;
2587
                    case 16: op = rv_op_vle8ff_v; break;
2638
                    case 16: op = rv_op_vle8ff_v; break;
Lines 2596-2610 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2596
            case 3: op = rv_op_fld; break;
2647
            case 3: op = rv_op_fld; break;
2597
            case 4: op = rv_op_flq; break;
2648
            case 4: op = rv_op_flq; break;
2598
            case 5:
2649
            case 5:
2599
                switch (((inst >> 20) & 0b111111111111)) {
2650
                switch ((inst >> 20) & 0b111111111111) {
2600
                case 40: op = rv_op_vl1re16_v; break;
2651
                case 40: op = rv_op_vl1re16_v; break;
2601
                case 552: op = rv_op_vl2re16_v; break;
2652
                case 552: op = rv_op_vl2re16_v; break;
2602
                case 1576: op = rv_op_vl4re16_v; break;
2653
                case 1576: op = rv_op_vl4re16_v; break;
2603
                case 3624: op = rv_op_vl8re16_v; break;
2654
                case 3624: op = rv_op_vl8re16_v; break;
2604
                }
2655
                }
2605
                switch (((inst >> 26) & 0b111)) {
2656
                switch ((inst >> 26) & 0b111) {
2606
                case 0:
2657
                case 0:
2607
                    switch (((inst >> 20) & 0b11111)) {
2658
                    switch ((inst >> 20) & 0b11111) {
2608
                    case 0: op = rv_op_vle16_v; break;
2659
                    case 0: op = rv_op_vle16_v; break;
2609
                    case 16: op = rv_op_vle16ff_v; break;
2660
                    case 16: op = rv_op_vle16ff_v; break;
2610
                    }
2661
                    }
Lines 2615-2629 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2615
                }
2666
                }
2616
                break;
2667
                break;
2617
            case 6:
2668
            case 6:
2618
                switch (((inst >> 20) & 0b111111111111)) {
2669
                switch ((inst >> 20) & 0b111111111111) {
2619
                case 40: op = rv_op_vl1re32_v; break;
2670
                case 40: op = rv_op_vl1re32_v; break;
2620
                case 552: op = rv_op_vl2re32_v; break;
2671
                case 552: op = rv_op_vl2re32_v; break;
2621
                case 1576: op = rv_op_vl4re32_v; break;
2672
                case 1576: op = rv_op_vl4re32_v; break;
2622
                case 3624: op = rv_op_vl8re32_v; break;
2673
                case 3624: op = rv_op_vl8re32_v; break;
2623
                }
2674
                }
2624
                switch (((inst >> 26) & 0b111)) {
2675
                switch ((inst >> 26) & 0b111) {
2625
                case 0:
2676
                case 0:
2626
                    switch (((inst >> 20) & 0b11111)) {
2677
                    switch ((inst >> 20) & 0b11111) {
2627
                    case 0: op = rv_op_vle32_v; break;
2678
                    case 0: op = rv_op_vle32_v; break;
2628
                    case 16: op = rv_op_vle32ff_v; break;
2679
                    case 16: op = rv_op_vle32ff_v; break;
2629
                    }
2680
                    }
Lines 2634-2648 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2634
                }
2685
                }
2635
                break;
2686
                break;
2636
            case 7:
2687
            case 7:
2637
                switch (((inst >> 20) & 0b111111111111)) {
2688
                switch ((inst >> 20) & 0b111111111111) {
2638
                case 40: op = rv_op_vl1re64_v; break;
2689
                case 40: op = rv_op_vl1re64_v; break;
2639
                case 552: op = rv_op_vl2re64_v; break;
2690
                case 552: op = rv_op_vl2re64_v; break;
2640
                case 1576: op = rv_op_vl4re64_v; break;
2691
                case 1576: op = rv_op_vl4re64_v; break;
2641
                case 3624: op = rv_op_vl8re64_v; break;
2692
                case 3624: op = rv_op_vl8re64_v; break;
2642
                }
2693
                }
2643
                switch (((inst >> 26) & 0b111)) {
2694
                switch ((inst >> 26) & 0b111) {
2644
                case 0:
2695
                case 0:
2645
                    switch (((inst >> 20) & 0b11111)) {
2696
                    switch ((inst >> 20) & 0b11111) {
2646
                    case 0: op = rv_op_vle64_v; break;
2697
                    case 0: op = rv_op_vle64_v; break;
2647
                    case 16: op = rv_op_vle64ff_v; break;
2698
                    case 16: op = rv_op_vle64ff_v; break;
2648
                    }
2699
                    }
Lines 2655-2679 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2655
            }
2706
            }
2656
            break;
2707
            break;
2657
        case 3:
2708
        case 3:
2658
            switch (((inst >> 12) & 0b111)) {
2709
            switch ((inst >> 12) & 0b111) {
2659
            case 0: op = rv_op_fence; break;
2710
            case 0: op = rv_op_fence; break;
2660
            case 1: op = rv_op_fence_i; break;
2711
            case 1: op = rv_op_fence_i; break;
2661
            case 2: op = rv_op_lq; break;
2712
            case 2: op = rv_op_lq; break;
2662
            }
2713
            }
2663
            break;
2714
            break;
2664
        case 4:
2715
        case 4:
2665
            switch (((inst >> 12) & 0b111)) {
2716
            switch ((inst >> 12) & 0b111) {
2666
            case 0: op = rv_op_addi; break;
2717
            case 0: op = rv_op_addi; break;
2667
            case 1:
2718
            case 1:
2668
                switch (((inst >> 27) & 0b11111)) {
2719
                switch ((inst >> 27) & 0b11111) {
2669
                case 0b00000: op = rv_op_slli; break;
2720
                case 0b00000: op = rv_op_slli; break;
2670
                case 0b00001:
2721
                case 0b00001:
2671
                    switch (((inst >> 20) & 0b1111111)) {
2722
                    switch ((inst >> 20) & 0b1111111) {
2672
                    case 0b0001111: op = rv_op_zip; break;
2723
                    case 0b0001111: op = rv_op_zip; break;
2673
                    }
2724
                    }
2674
                    break;
2725
                    break;
2675
                case 0b00010:
2726
                case 0b00010:
2676
                    switch (((inst >> 20) & 0b1111111)) {
2727
                    switch ((inst >> 20) & 0b1111111) {
2677
                    case 0b0000000: op = rv_op_sha256sum0; break;
2728
                    case 0b0000000: op = rv_op_sha256sum0; break;
2678
                    case 0b0000001: op = rv_op_sha256sum1; break;
2729
                    case 0b0000001: op = rv_op_sha256sum1; break;
2679
                    case 0b0000010: op = rv_op_sha256sig0; break;
2730
                    case 0b0000010: op = rv_op_sha256sig0; break;
Lines 2688-2694 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2688
                    break;
2739
                    break;
2689
                case 0b00101: op = rv_op_bseti; break;
2740
                case 0b00101: op = rv_op_bseti; break;
2690
                case 0b00110:
2741
                case 0b00110:
2691
                    switch (((inst >> 20) & 0b1111111)) {
2742
                    switch ((inst >> 20) & 0b1111111) {
2692
                    case 0b0000000: op = rv_op_aes64im; break;
2743
                    case 0b0000000: op = rv_op_aes64im; break;
2693
                    default:
2744
                    default:
2694
                        if (((inst >> 24) & 0b0111) == 0b001) {
2745
                        if (((inst >> 24) & 0b0111) == 0b001) {
Lines 2700-2706 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2700
                case 0b01001: op = rv_op_bclri; break;
2751
                case 0b01001: op = rv_op_bclri; break;
2701
                case 0b01101: op = rv_op_binvi; break;
2752
                case 0b01101: op = rv_op_binvi; break;
2702
                case 0b01100:
2753
                case 0b01100:
2703
                    switch (((inst >> 20) & 0b1111111)) {
2754
                    switch ((inst >> 20) & 0b1111111) {
2704
                    case 0b0000000: op = rv_op_clz; break;
2755
                    case 0b0000000: op = rv_op_clz; break;
2705
                    case 0b0000001: op = rv_op_ctz; break;
2756
                    case 0b0000001: op = rv_op_ctz; break;
2706
                    case 0b0000010: op = rv_op_cpop; break;
2757
                    case 0b0000010: op = rv_op_cpop; break;
Lines 2715-2724 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2715
            case 3: op = rv_op_sltiu; break;
2766
            case 3: op = rv_op_sltiu; break;
2716
            case 4: op = rv_op_xori; break;
2767
            case 4: op = rv_op_xori; break;
2717
            case 5:
2768
            case 5:
2718
                switch (((inst >> 27) & 0b11111)) {
2769
                switch ((inst >> 27) & 0b11111) {
2719
                case 0b00000: op = rv_op_srli; break;
2770
                case 0b00000: op = rv_op_srli; break;
2720
                case 0b00001:
2771
                case 0b00001:
2721
                    switch (((inst >> 20) & 0b1111111)) {
2772
                    switch ((inst >> 20) & 0b1111111) {
2722
                    case 0b0001111: op = rv_op_unzip; break;
2773
                    case 0b0001111: op = rv_op_unzip; break;
2723
                    }
2774
                    }
2724
                    break;
2775
                    break;
Lines 2741-2750 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2741
            break;
2792
            break;
2742
        case 5: op = rv_op_auipc; break;
2793
        case 5: op = rv_op_auipc; break;
2743
        case 6:
2794
        case 6:
2744
            switch (((inst >> 12) & 0b111)) {
2795
            switch ((inst >> 12) & 0b111) {
2745
            case 0: op = rv_op_addiw; break;
2796
            case 0: op = rv_op_addiw; break;
2746
            case 1:
2797
            case 1:
2747
                switch (((inst >> 26) & 0b111111)) {
2798
                switch ((inst >> 26) & 0b111111) {
2748
                case 0: op = rv_op_slliw; break;
2799
                case 0: op = rv_op_slliw; break;
2749
                case 2: op = rv_op_slli_uw; break;
2800
                case 2: op = rv_op_slli_uw; break;
2750
                case 24:
2801
                case 24:
Lines 2757-2763 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2757
                }
2808
                }
2758
                break;
2809
                break;
2759
            case 5:
2810
            case 5:
2760
                switch (((inst >> 25) & 0b1111111)) {
2811
                switch ((inst >> 25) & 0b1111111) {
2761
                case 0: op = rv_op_srliw; break;
2812
                case 0: op = rv_op_srliw; break;
2762
                case 32: op = rv_op_sraiw; break;
2813
                case 32: op = rv_op_sraiw; break;
2763
                case 48: op = rv_op_roriw; break;
2814
                case 48: op = rv_op_roriw; break;
Lines 2766-2772 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2766
            }
2817
            }
2767
            break;
2818
            break;
2768
        case 8:
2819
        case 8:
2769
            switch (((inst >> 12) & 0b111)) {
2820
            switch ((inst >> 12) & 0b111) {
2770
            case 0: op = rv_op_sb; break;
2821
            case 0: op = rv_op_sb; break;
2771
            case 1: op = rv_op_sh; break;
2822
            case 1: op = rv_op_sh; break;
2772
            case 2: op = rv_op_sw; break;
2823
            case 2: op = rv_op_sw; break;
Lines 2775-2791 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2775
            }
2826
            }
2776
            break;
2827
            break;
2777
        case 9:
2828
        case 9:
2778
            switch (((inst >> 12) & 0b111)) {
2829
            switch ((inst >> 12) & 0b111) {
2779
            case 0:
2830
            case 0:
2780
                switch (((inst >> 20) & 0b111111111111)) {
2831
                switch ((inst >> 20) & 0b111111111111) {
2781
                case 40: op = rv_op_vs1r_v; break;
2832
                case 40: op = rv_op_vs1r_v; break;
2782
                case 552: op = rv_op_vs2r_v; break;
2833
                case 552: op = rv_op_vs2r_v; break;
2783
                case 1576: op = rv_op_vs4r_v; break;
2834
                case 1576: op = rv_op_vs4r_v; break;
2784
                case 3624: op = rv_op_vs8r_v; break;
2835
                case 3624: op = rv_op_vs8r_v; break;
2785
                }
2836
                }
2786
                switch (((inst >> 26) & 0b111)) {
2837
                switch ((inst >> 26) & 0b111) {
2787
                case 0:
2838
                case 0:
2788
                    switch (((inst >> 20) & 0b11111)) {
2839
                    switch ((inst >> 20) & 0b11111) {
2789
                    case 0: op = rv_op_vse8_v; break;
2840
                    case 0: op = rv_op_vse8_v; break;
2790
                    case 11: op = rv_op_vsm_v; break;
2841
                    case 11: op = rv_op_vsm_v; break;
2791
                    }
2842
                    }
Lines 2799-2807 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2799
            case 3: op = rv_op_fsd; break;
2850
            case 3: op = rv_op_fsd; break;
2800
            case 4: op = rv_op_fsq; break;
2851
            case 4: op = rv_op_fsq; break;
2801
            case 5:
2852
            case 5:
2802
                switch (((inst >> 26) & 0b111)) {
2853
                switch ((inst >> 26) & 0b111) {
2803
                case 0:
2854
                case 0:
2804
                    switch (((inst >> 20) & 0b11111)) {
2855
                    switch ((inst >> 20) & 0b11111) {
2805
                    case 0: op = rv_op_vse16_v; break;
2856
                    case 0: op = rv_op_vse16_v; break;
2806
                    }
2857
                    }
2807
                    break;
2858
                    break;
Lines 2811-2819 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2811
                }
2862
                }
2812
                break;
2863
                break;
2813
            case 6:
2864
            case 6:
2814
                switch (((inst >> 26) & 0b111)) {
2865
                switch ((inst >> 26) & 0b111) {
2815
                case 0:
2866
                case 0:
2816
                    switch (((inst >> 20) & 0b11111)) {
2867
                    switch ((inst >> 20) & 0b11111) {
2817
                    case 0: op = rv_op_vse32_v; break;
2868
                    case 0: op = rv_op_vse32_v; break;
2818
                    }
2869
                    }
2819
                    break;
2870
                    break;
Lines 2823-2831 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2823
                }
2874
                }
2824
                break;
2875
                break;
2825
            case 7:
2876
            case 7:
2826
                switch (((inst >> 26) & 0b111)) {
2877
                switch ((inst >> 26) & 0b111) {
2827
                case 0:
2878
                case 0:
2828
                    switch (((inst >> 20) & 0b11111)) {
2879
                    switch ((inst >> 20) & 0b11111) {
2829
                    case 0: op = rv_op_vse64_v; break;
2880
                    case 0: op = rv_op_vse64_v; break;
2830
                    }
2881
                    }
2831
                    break;
2882
                    break;
Lines 2837-2843 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2837
            }
2888
            }
2838
            break;
2889
            break;
2839
        case 11:
2890
        case 11:
2840
            switch (((inst >> 24) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
2891
            switch (((inst >> 24) & 0b11111000) |
2892
                    ((inst >> 12) & 0b00000111)) {
2841
            case 2: op = rv_op_amoadd_w; break;
2893
            case 2: op = rv_op_amoadd_w; break;
2842
            case 3: op = rv_op_amoadd_d; break;
2894
            case 3: op = rv_op_amoadd_d; break;
2843
            case 4: op = rv_op_amoadd_q; break;
2895
            case 4: op = rv_op_amoadd_q; break;
Lines 2845-2861 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2845
            case 11: op = rv_op_amoswap_d; break;
2897
            case 11: op = rv_op_amoswap_d; break;
2846
            case 12: op = rv_op_amoswap_q; break;
2898
            case 12: op = rv_op_amoswap_q; break;
2847
            case 18:
2899
            case 18:
2848
                switch (((inst >> 20) & 0b11111)) {
2900
                switch ((inst >> 20) & 0b11111) {
2849
                case 0: op = rv_op_lr_w; break;
2901
                case 0: op = rv_op_lr_w; break;
2850
                }
2902
                }
2851
                break;
2903
                break;
2852
            case 19:
2904
            case 19:
2853
                switch (((inst >> 20) & 0b11111)) {
2905
                switch ((inst >> 20) & 0b11111) {
2854
                case 0: op = rv_op_lr_d; break;
2906
                case 0: op = rv_op_lr_d; break;
2855
                }
2907
                }
2856
                break;
2908
                break;
2857
            case 20:
2909
            case 20:
2858
                switch (((inst >> 20) & 0b11111)) {
2910
                switch ((inst >> 20) & 0b11111) {
2859
                case 0: op = rv_op_lr_q; break;
2911
                case 0: op = rv_op_lr_q; break;
2860
                }
2912
                }
2861
                break;
2913
                break;
Lines 2886-2892 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2886
            }
2938
            }
2887
            break;
2939
            break;
2888
        case 12:
2940
        case 12:
2889
            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {
2941
            switch (((inst >> 22) & 0b1111111000) |
2942
                    ((inst >> 12) & 0b0000000111)) {
2890
            case 0: op = rv_op_add; break;
2943
            case 0: op = rv_op_add; break;
2891
            case 1: op = rv_op_sll; break;
2944
            case 1: op = rv_op_sll; break;
2892
            case 2: op = rv_op_slt; break;
2945
            case 2: op = rv_op_slt; break;
Lines 2959-2965 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2959
            break;
3012
            break;
2960
        case 13: op = rv_op_lui; break;
3013
        case 13: op = rv_op_lui; break;
2961
        case 14:
3014
        case 14:
2962
            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {
3015
            switch (((inst >> 22) & 0b1111111000) |
3016
                    ((inst >> 12) & 0b0000000111)) {
2963
            case 0: op = rv_op_addw; break;
3017
            case 0: op = rv_op_addw; break;
2964
            case 1: op = rv_op_sllw; break;
3018
            case 1: op = rv_op_sllw; break;
2965
            case 5: op = rv_op_srlw; break;
3019
            case 5: op = rv_op_srlw; break;
Lines 2985-3019 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
2985
            }
3039
            }
2986
            break;
3040
            break;
2987
        case 16:
3041
        case 16:
2988
            switch (((inst >> 25) & 0b11)) {
3042
            switch ((inst >> 25) & 0b11) {
2989
            case 0: op = rv_op_fmadd_s; break;
3043
            case 0: op = rv_op_fmadd_s; break;
2990
            case 1: op = rv_op_fmadd_d; break;
3044
            case 1: op = rv_op_fmadd_d; break;
2991
            case 3: op = rv_op_fmadd_q; break;
3045
            case 3: op = rv_op_fmadd_q; break;
2992
            }
3046
            }
2993
            break;
3047
            break;
2994
        case 17:
3048
        case 17:
2995
            switch (((inst >> 25) & 0b11)) {
3049
            switch ((inst >> 25) & 0b11) {
2996
            case 0: op = rv_op_fmsub_s; break;
3050
            case 0: op = rv_op_fmsub_s; break;
2997
            case 1: op = rv_op_fmsub_d; break;
3051
            case 1: op = rv_op_fmsub_d; break;
2998
            case 3: op = rv_op_fmsub_q; break;
3052
            case 3: op = rv_op_fmsub_q; break;
2999
            }
3053
            }
3000
            break;
3054
            break;
3001
        case 18:
3055
        case 18:
3002
            switch (((inst >> 25) & 0b11)) {
3056
            switch ((inst >> 25) & 0b11) {
3003
            case 0: op = rv_op_fnmsub_s; break;
3057
            case 0: op = rv_op_fnmsub_s; break;
3004
            case 1: op = rv_op_fnmsub_d; break;
3058
            case 1: op = rv_op_fnmsub_d; break;
3005
            case 3: op = rv_op_fnmsub_q; break;
3059
            case 3: op = rv_op_fnmsub_q; break;
3006
            }
3060
            }
3007
            break;
3061
            break;
3008
        case 19:
3062
        case 19:
3009
            switch (((inst >> 25) & 0b11)) {
3063
            switch ((inst >> 25) & 0b11) {
3010
            case 0: op = rv_op_fnmadd_s; break;
3064
            case 0: op = rv_op_fnmadd_s; break;
3011
            case 1: op = rv_op_fnmadd_d; break;
3065
            case 1: op = rv_op_fnmadd_d; break;
3012
            case 3: op = rv_op_fnmadd_q; break;
3066
            case 3: op = rv_op_fnmadd_q; break;
3013
            }
3067
            }
3014
            break;
3068
            break;
3015
        case 20:
3069
        case 20:
3016
            switch (((inst >> 25) & 0b1111111)) {
3070
            switch ((inst >> 25) & 0b1111111) {
3017
            case 0: op = rv_op_fadd_s; break;
3071
            case 0: op = rv_op_fadd_s; break;
3018
            case 1: op = rv_op_fadd_d; break;
3072
            case 1: op = rv_op_fadd_d; break;
3019
            case 3: op = rv_op_fadd_q; break;
3073
            case 3: op = rv_op_fadd_q; break;
Lines 3027-3126 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3027
            case 13: op = rv_op_fdiv_d; break;
3081
            case 13: op = rv_op_fdiv_d; break;
3028
            case 15: op = rv_op_fdiv_q; break;
3082
            case 15: op = rv_op_fdiv_q; break;
3029
            case 16:
3083
            case 16:
3030
                switch (((inst >> 12) & 0b111)) {
3084
                switch ((inst >> 12) & 0b111) {
3031
                case 0: op = rv_op_fsgnj_s; break;
3085
                case 0: op = rv_op_fsgnj_s; break;
3032
                case 1: op = rv_op_fsgnjn_s; break;
3086
                case 1: op = rv_op_fsgnjn_s; break;
3033
                case 2: op = rv_op_fsgnjx_s; break;
3087
                case 2: op = rv_op_fsgnjx_s; break;
3034
                }
3088
                }
3035
                break;
3089
                break;
3036
            case 17:
3090
            case 17:
3037
                switch (((inst >> 12) & 0b111)) {
3091
                switch ((inst >> 12) & 0b111) {
3038
                case 0: op = rv_op_fsgnj_d; break;
3092
                case 0: op = rv_op_fsgnj_d; break;
3039
                case 1: op = rv_op_fsgnjn_d; break;
3093
                case 1: op = rv_op_fsgnjn_d; break;
3040
                case 2: op = rv_op_fsgnjx_d; break;
3094
                case 2: op = rv_op_fsgnjx_d; break;
3041
                }
3095
                }
3042
                break;
3096
                break;
3043
            case 19:
3097
            case 19:
3044
                switch (((inst >> 12) & 0b111)) {
3098
                switch ((inst >> 12) & 0b111) {
3045
                case 0: op = rv_op_fsgnj_q; break;
3099
                case 0: op = rv_op_fsgnj_q; break;
3046
                case 1: op = rv_op_fsgnjn_q; break;
3100
                case 1: op = rv_op_fsgnjn_q; break;
3047
                case 2: op = rv_op_fsgnjx_q; break;
3101
                case 2: op = rv_op_fsgnjx_q; break;
3048
                }
3102
                }
3049
                break;
3103
                break;
3050
            case 20:
3104
            case 20:
3051
                switch (((inst >> 12) & 0b111)) {
3105
                switch ((inst >> 12) & 0b111) {
3052
                case 0: op = rv_op_fmin_s; break;
3106
                case 0: op = rv_op_fmin_s; break;
3053
                case 1: op = rv_op_fmax_s; break;
3107
                case 1: op = rv_op_fmax_s; break;
3054
                }
3108
                }
3055
                break;
3109
                break;
3056
            case 21:
3110
            case 21:
3057
                switch (((inst >> 12) & 0b111)) {
3111
                switch ((inst >> 12) & 0b111) {
3058
                case 0: op = rv_op_fmin_d; break;
3112
                case 0: op = rv_op_fmin_d; break;
3059
                case 1: op = rv_op_fmax_d; break;
3113
                case 1: op = rv_op_fmax_d; break;
3060
                }
3114
                }
3061
                break;
3115
                break;
3062
            case 23:
3116
            case 23:
3063
                switch (((inst >> 12) & 0b111)) {
3117
                switch ((inst >> 12) & 0b111) {
3064
                case 0: op = rv_op_fmin_q; break;
3118
                case 0: op = rv_op_fmin_q; break;
3065
                case 1: op = rv_op_fmax_q; break;
3119
                case 1: op = rv_op_fmax_q; break;
3066
                }
3120
                }
3067
                break;
3121
                break;
3068
            case 32:
3122
            case 32:
3069
                switch (((inst >> 20) & 0b11111)) {
3123
                switch ((inst >> 20) & 0b11111) {
3070
                case 1: op = rv_op_fcvt_s_d; break;
3124
                case 1: op = rv_op_fcvt_s_d; break;
3071
                case 3: op = rv_op_fcvt_s_q; break;
3125
                case 3: op = rv_op_fcvt_s_q; break;
3072
                }
3126
                }
3073
                break;
3127
                break;
3074
            case 33:
3128
            case 33:
3075
                switch (((inst >> 20) & 0b11111)) {
3129
                switch ((inst >> 20) & 0b11111) {
3076
                case 0: op = rv_op_fcvt_d_s; break;
3130
                case 0: op = rv_op_fcvt_d_s; break;
3077
                case 3: op = rv_op_fcvt_d_q; break;
3131
                case 3: op = rv_op_fcvt_d_q; break;
3078
                }
3132
                }
3079
                break;
3133
                break;
3080
            case 35:
3134
            case 35:
3081
                switch (((inst >> 20) & 0b11111)) {
3135
                switch ((inst >> 20) & 0b11111) {
3082
                case 0: op = rv_op_fcvt_q_s; break;
3136
                case 0: op = rv_op_fcvt_q_s; break;
3083
                case 1: op = rv_op_fcvt_q_d; break;
3137
                case 1: op = rv_op_fcvt_q_d; break;
3084
                }
3138
                }
3085
                break;
3139
                break;
3086
            case 44:
3140
            case 44:
3087
                switch (((inst >> 20) & 0b11111)) {
3141
                switch ((inst >> 20) & 0b11111) {
3088
                case 0: op = rv_op_fsqrt_s; break;
3142
                case 0: op = rv_op_fsqrt_s; break;
3089
                }
3143
                }
3090
                break;
3144
                break;
3091
            case 45:
3145
            case 45:
3092
                switch (((inst >> 20) & 0b11111)) {
3146
                switch ((inst >> 20) & 0b11111) {
3093
                case 0: op = rv_op_fsqrt_d; break;
3147
                case 0: op = rv_op_fsqrt_d; break;
3094
                }
3148
                }
3095
                break;
3149
                break;
3096
            case 47:
3150
            case 47:
3097
                switch (((inst >> 20) & 0b11111)) {
3151
                switch ((inst >> 20) & 0b11111) {
3098
                case 0: op = rv_op_fsqrt_q; break;
3152
                case 0: op = rv_op_fsqrt_q; break;
3099
                }
3153
                }
3100
                break;
3154
                break;
3101
            case 80:
3155
            case 80:
3102
                switch (((inst >> 12) & 0b111)) {
3156
                switch ((inst >> 12) & 0b111) {
3103
                case 0: op = rv_op_fle_s; break;
3157
                case 0: op = rv_op_fle_s; break;
3104
                case 1: op = rv_op_flt_s; break;
3158
                case 1: op = rv_op_flt_s; break;
3105
                case 2: op = rv_op_feq_s; break;
3159
                case 2: op = rv_op_feq_s; break;
3106
                }
3160
                }
3107
                break;
3161
                break;
3108
            case 81:
3162
            case 81:
3109
                switch (((inst >> 12) & 0b111)) {
3163
                switch ((inst >> 12) & 0b111) {
3110
                case 0: op = rv_op_fle_d; break;
3164
                case 0: op = rv_op_fle_d; break;
3111
                case 1: op = rv_op_flt_d; break;
3165
                case 1: op = rv_op_flt_d; break;
3112
                case 2: op = rv_op_feq_d; break;
3166
                case 2: op = rv_op_feq_d; break;
3113
                }
3167
                }
3114
                break;
3168
                break;
3115
            case 83:
3169
            case 83:
3116
                switch (((inst >> 12) & 0b111)) {
3170
                switch ((inst >> 12) & 0b111) {
3117
                case 0: op = rv_op_fle_q; break;
3171
                case 0: op = rv_op_fle_q; break;
3118
                case 1: op = rv_op_flt_q; break;
3172
                case 1: op = rv_op_flt_q; break;
3119
                case 2: op = rv_op_feq_q; break;
3173
                case 2: op = rv_op_feq_q; break;
3120
                }
3174
                }
3121
                break;
3175
                break;
3122
            case 96:
3176
            case 96:
3123
                switch (((inst >> 20) & 0b11111)) {
3177
                switch ((inst >> 20) & 0b11111) {
3124
                case 0: op = rv_op_fcvt_w_s; break;
3178
                case 0: op = rv_op_fcvt_w_s; break;
3125
                case 1: op = rv_op_fcvt_wu_s; break;
3179
                case 1: op = rv_op_fcvt_wu_s; break;
3126
                case 2: op = rv_op_fcvt_l_s; break;
3180
                case 2: op = rv_op_fcvt_l_s; break;
Lines 3128-3134 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3128
                }
3182
                }
3129
                break;
3183
                break;
3130
            case 97:
3184
            case 97:
3131
                switch (((inst >> 20) & 0b11111)) {
3185
                switch ((inst >> 20) & 0b11111) {
3132
                case 0: op = rv_op_fcvt_w_d; break;
3186
                case 0: op = rv_op_fcvt_w_d; break;
3133
                case 1: op = rv_op_fcvt_wu_d; break;
3187
                case 1: op = rv_op_fcvt_wu_d; break;
3134
                case 2: op = rv_op_fcvt_l_d; break;
3188
                case 2: op = rv_op_fcvt_l_d; break;
Lines 3136-3142 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3136
                }
3190
                }
3137
                break;
3191
                break;
3138
            case 99:
3192
            case 99:
3139
                switch (((inst >> 20) & 0b11111)) {
3193
                switch ((inst >> 20) & 0b11111) {
3140
                case 0: op = rv_op_fcvt_w_q; break;
3194
                case 0: op = rv_op_fcvt_w_q; break;
3141
                case 1: op = rv_op_fcvt_wu_q; break;
3195
                case 1: op = rv_op_fcvt_wu_q; break;
3142
                case 2: op = rv_op_fcvt_l_q; break;
3196
                case 2: op = rv_op_fcvt_l_q; break;
Lines 3144-3150 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3144
                }
3198
                }
3145
                break;
3199
                break;
3146
            case 104:
3200
            case 104:
3147
                switch (((inst >> 20) & 0b11111)) {
3201
                switch ((inst >> 20) & 0b11111) {
3148
                case 0: op = rv_op_fcvt_s_w; break;
3202
                case 0: op = rv_op_fcvt_s_w; break;
3149
                case 1: op = rv_op_fcvt_s_wu; break;
3203
                case 1: op = rv_op_fcvt_s_wu; break;
3150
                case 2: op = rv_op_fcvt_s_l; break;
3204
                case 2: op = rv_op_fcvt_s_l; break;
Lines 3152-3158 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3152
                }
3206
                }
3153
                break;
3207
                break;
3154
            case 105:
3208
            case 105:
3155
                switch (((inst >> 20) & 0b11111)) {
3209
                switch ((inst >> 20) & 0b11111) {
3156
                case 0: op = rv_op_fcvt_d_w; break;
3210
                case 0: op = rv_op_fcvt_d_w; break;
3157
                case 1: op = rv_op_fcvt_d_wu; break;
3211
                case 1: op = rv_op_fcvt_d_wu; break;
3158
                case 2: op = rv_op_fcvt_d_l; break;
3212
                case 2: op = rv_op_fcvt_d_l; break;
Lines 3160-3166 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3160
                }
3214
                }
3161
                break;
3215
                break;
3162
            case 107:
3216
            case 107:
3163
                switch (((inst >> 20) & 0b11111)) {
3217
                switch ((inst >> 20) & 0b11111) {
3164
                case 0: op = rv_op_fcvt_q_w; break;
3218
                case 0: op = rv_op_fcvt_q_w; break;
3165
                case 1: op = rv_op_fcvt_q_wu; break;
3219
                case 1: op = rv_op_fcvt_q_wu; break;
3166
                case 2: op = rv_op_fcvt_q_l; break;
3220
                case 2: op = rv_op_fcvt_q_l; break;
Lines 3168-3211 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3168
                }
3222
                }
3169
                break;
3223
                break;
3170
            case 112:
3224
            case 112:
3171
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3225
                switch (((inst >> 17) & 0b11111000) |
3226
                        ((inst >> 12) & 0b00000111)) {
3172
                case 0: op = rv_op_fmv_x_s; break;
3227
                case 0: op = rv_op_fmv_x_s; break;
3173
                case 1: op = rv_op_fclass_s; break;
3228
                case 1: op = rv_op_fclass_s; break;
3174
                }
3229
                }
3175
                break;
3230
                break;
3176
            case 113:
3231
            case 113:
3177
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3232
                switch (((inst >> 17) & 0b11111000) |
3233
                        ((inst >> 12) & 0b00000111)) {
3178
                case 0: op = rv_op_fmv_x_d; break;
3234
                case 0: op = rv_op_fmv_x_d; break;
3179
                case 1: op = rv_op_fclass_d; break;
3235
                case 1: op = rv_op_fclass_d; break;
3180
                }
3236
                }
3181
                break;
3237
                break;
3182
            case 115:
3238
            case 115:
3183
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3239
                switch (((inst >> 17) & 0b11111000) |
3240
                        ((inst >> 12) & 0b00000111)) {
3184
                case 0: op = rv_op_fmv_x_q; break;
3241
                case 0: op = rv_op_fmv_x_q; break;
3185
                case 1: op = rv_op_fclass_q; break;
3242
                case 1: op = rv_op_fclass_q; break;
3186
                }
3243
                }
3187
                break;
3244
                break;
3188
            case 120:
3245
            case 120:
3189
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3246
                switch (((inst >> 17) & 0b11111000) |
3247
                        ((inst >> 12) & 0b00000111)) {
3190
                case 0: op = rv_op_fmv_s_x; break;
3248
                case 0: op = rv_op_fmv_s_x; break;
3191
                }
3249
                }
3192
                break;
3250
                break;
3193
            case 121:
3251
            case 121:
3194
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3252
                switch (((inst >> 17) & 0b11111000) |
3253
                        ((inst >> 12) & 0b00000111)) {
3195
                case 0: op = rv_op_fmv_d_x; break;
3254
                case 0: op = rv_op_fmv_d_x; break;
3196
                }
3255
                }
3197
                break;
3256
                break;
3198
            case 123:
3257
            case 123:
3199
                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {
3258
                switch (((inst >> 17) & 0b11111000) |
3259
                        ((inst >> 12) & 0b00000111)) {
3200
                case 0: op = rv_op_fmv_q_x; break;
3260
                case 0: op = rv_op_fmv_q_x; break;
3201
                }
3261
                }
3202
                break;
3262
                break;
3203
            }
3263
            }
3204
            break;
3264
            break;
3205
        case 21:
3265
        case 21:
3206
            switch (((inst >> 12) & 0b111)) {
3266
            switch ((inst >> 12) & 0b111) {
3207
            case 0:
3267
            case 0:
3208
                switch (((inst >> 26) & 0b111111)) {
3268
                switch ((inst >> 26) & 0b111111) {
3209
                case 0: op = rv_op_vadd_vv; break;
3269
                case 0: op = rv_op_vadd_vv; break;
3210
                case 2: op = rv_op_vsub_vv; break;
3270
                case 2: op = rv_op_vsub_vv; break;
3211
                case 4: op = rv_op_vminu_vv; break;
3271
                case 4: op = rv_op_vminu_vv; break;
Lines 3217-3225 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3217
                case 11: op = rv_op_vxor_vv; break;
3277
                case 11: op = rv_op_vxor_vv; break;
3218
                case 12: op = rv_op_vrgather_vv; break;
3278
                case 12: op = rv_op_vrgather_vv; break;
3219
                case 14: op = rv_op_vrgatherei16_vv; break;
3279
                case 14: op = rv_op_vrgatherei16_vv; break;
3220
                case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vvm; break;
3280
                case 16:
3281
                    if (((inst >> 25) & 1) == 0) {
3282
                        op = rv_op_vadc_vvm;
3283
                    }
3284
                    break;
3221
                case 17: op = rv_op_vmadc_vvm; break;
3285
                case 17: op = rv_op_vmadc_vvm; break;
3222
                case 18: if (((inst >> 25) & 1) == 0) op = rv_op_vsbc_vvm; break;
3286
                case 18:
3287
                    if (((inst >> 25) & 1) == 0) {
3288
                        op = rv_op_vsbc_vvm;
3289
                    }
3290
                    break;
3223
                case 19: op = rv_op_vmsbc_vvm; break;
3291
                case 19: op = rv_op_vmsbc_vvm; break;
3224
                case 23:
3292
                case 23:
3225
                    if (((inst >> 20) & 0b111111) == 32)
3293
                    if (((inst >> 20) & 0b111111) == 32)
Lines 3252-3258 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3252
                }
3320
                }
3253
                break;
3321
                break;
3254
            case 1:
3322
            case 1:
3255
                switch (((inst >> 26) & 0b111111)) {
3323
                switch ((inst >> 26) & 0b111111) {
3256
                case 0: op = rv_op_vfadd_vv; break;
3324
                case 0: op = rv_op_vfadd_vv; break;
3257
                case 1: op = rv_op_vfredusum_vs; break;
3325
                case 1: op = rv_op_vfredusum_vs; break;
3258
                case 2: op = rv_op_vfsub_vv; break;
3326
                case 2: op = rv_op_vfsub_vv; break;
Lines 3265-3276 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3265
                case 9: op = rv_op_vfsgnjn_vv; break;
3333
                case 9: op = rv_op_vfsgnjn_vv; break;
3266
                case 10: op = rv_op_vfsgnjx_vv; break;
3334
                case 10: op = rv_op_vfsgnjx_vv; break;
3267
                case 16:
3335
                case 16:
3268
                    switch (((inst >> 15) & 0b11111)) {
3336
                    switch ((inst >> 15) & 0b11111) {
3269
                    case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_f_s; break;
3337
                    case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_f_s; break;
3270
                    }
3338
                    }
3271
                    break;
3339
                    break;
3272
                case 18:
3340
                case 18:
3273
                    switch (((inst >> 15) & 0b11111)) {
3341
                    switch ((inst >> 15) & 0b11111) {
3274
                    case 0: op = rv_op_vfcvt_xu_f_v; break;
3342
                    case 0: op = rv_op_vfcvt_xu_f_v; break;
3275
                    case 1: op = rv_op_vfcvt_x_f_v; break;
3343
                    case 1: op = rv_op_vfcvt_x_f_v; break;
3276
                    case 2: op = rv_op_vfcvt_f_xu_v; break;
3344
                    case 2: op = rv_op_vfcvt_f_xu_v; break;
Lines 3295-3301 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3295
                    }
3363
                    }
3296
                    break;
3364
                    break;
3297
                case 19:
3365
                case 19:
3298
                    switch (((inst >> 15) & 0b11111)) {
3366
                    switch ((inst >> 15) & 0b11111) {
3299
                    case 0: op = rv_op_vfsqrt_v; break;
3367
                    case 0: op = rv_op_vfsqrt_v; break;
3300
                    case 4: op = rv_op_vfrsqrt7_v; break;
3368
                    case 4: op = rv_op_vfrsqrt7_v; break;
3301
                    case 5: op = rv_op_vfrec7_v; break;
3369
                    case 5: op = rv_op_vfrec7_v; break;
Lines 3330-3336 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3330
                }
3398
                }
3331
                break;
3399
                break;
3332
            case 2:
3400
            case 2:
3333
                switch (((inst >> 26) & 0b111111)) {
3401
                switch ((inst >> 26) & 0b111111) {
3334
                case 0: op = rv_op_vredsum_vs; break;
3402
                case 0: op = rv_op_vredsum_vs; break;
3335
                case 1: op = rv_op_vredand_vs; break;
3403
                case 1: op = rv_op_vredand_vs; break;
3336
                case 2: op = rv_op_vredor_vs; break;
3404
                case 2: op = rv_op_vredor_vs; break;
Lines 3344-3357 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3344
                case 10: op = rv_op_vasubu_vv; break;
3412
                case 10: op = rv_op_vasubu_vv; break;
3345
                case 11: op = rv_op_vasub_vv; break;
3413
                case 11: op = rv_op_vasub_vv; break;
3346
                case 16:
3414
                case 16:
3347
                    switch (((inst >> 15) & 0b11111)) {
3415
                    switch ((inst >> 15) & 0b11111) {
3348
                    case 0: if ((inst >> 25) & 1) op = rv_op_vmv_x_s; break;
3416
                    case 0: if ((inst >> 25) & 1) op = rv_op_vmv_x_s; break;
3349
                    case 16: op = rv_op_vcpop_m; break;
3417
                    case 16: op = rv_op_vcpop_m; break;
3350
                    case 17: op = rv_op_vfirst_m; break;
3418
                    case 17: op = rv_op_vfirst_m; break;
3351
                    }
3419
                    }
3352
                    break;
3420
                    break;
3353
                case 18:
3421
                case 18:
3354
                    switch (((inst >> 15) & 0b11111)) {
3422
                    switch ((inst >> 15) & 0b11111) {
3355
                    case 2: op = rv_op_vzext_vf8; break;
3423
                    case 2: op = rv_op_vzext_vf8; break;
3356
                    case 3: op = rv_op_vsext_vf8; break;
3424
                    case 3: op = rv_op_vsext_vf8; break;
3357
                    case 4: op = rv_op_vzext_vf4; break;
3425
                    case 4: op = rv_op_vzext_vf4; break;
Lines 3361-3372 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3361
                    }
3429
                    }
3362
                    break;
3430
                    break;
3363
                case 20:
3431
                case 20:
3364
                    switch (((inst >> 15) & 0b11111)) {
3432
                    switch ((inst >> 15) & 0b11111) {
3365
                    case 1: op = rv_op_vmsbf_m;  break;
3433
                    case 1: op = rv_op_vmsbf_m;  break;
3366
                    case 2: op = rv_op_vmsof_m; break;
3434
                    case 2: op = rv_op_vmsof_m; break;
3367
                    case 3: op = rv_op_vmsif_m; break;
3435
                    case 3: op = rv_op_vmsif_m; break;
3368
                    case 16: op = rv_op_viota_m; break;
3436
                    case 16: op = rv_op_viota_m; break;
3369
                    case 17: if (((inst >> 20) & 0b11111) == 0) op = rv_op_vid_v; break;
3437
                    case 17:
3438
                        if (((inst >> 20) & 0b11111) == 0) {
3439
                            op = rv_op_vid_v;
3440
                        }
3441
                        break;
3370
                    }
3442
                    }
3371
                    break;
3443
                    break;
3372
                case 23: if ((inst >> 25) & 1) op = rv_op_vcompress_vm; break;
3444
                case 23: if ((inst >> 25) & 1) op = rv_op_vcompress_vm; break;
Lines 3407-3413 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3407
                }
3479
                }
3408
                break;
3480
                break;
3409
            case 3:
3481
            case 3:
3410
                switch (((inst >> 26) & 0b111111)) {
3482
                switch ((inst >> 26) & 0b111111) {
3411
                case 0: op = rv_op_vadd_vi; break;
3483
                case 0: op = rv_op_vadd_vi; break;
3412
                case 3: op = rv_op_vrsub_vi; break;
3484
                case 3: op = rv_op_vrsub_vi; break;
3413
                case 9: op = rv_op_vand_vi; break;
3485
                case 9: op = rv_op_vand_vi; break;
Lines 3416-3422 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3416
                case 12: op = rv_op_vrgather_vi; break;
3488
                case 12: op = rv_op_vrgather_vi; break;
3417
                case 14: op = rv_op_vslideup_vi; break;
3489
                case 14: op = rv_op_vslideup_vi; break;
3418
                case 15: op = rv_op_vslidedown_vi; break;
3490
                case 15: op = rv_op_vslidedown_vi; break;
3419
                case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vim; break;
3491
                case 16:
3492
                    if (((inst >> 25) & 1) == 0) {
3493
                        op = rv_op_vadc_vim;
3494
                    }
3495
                    break;
3420
                case 17: op = rv_op_vmadc_vim; break;
3496
                case 17: op = rv_op_vmadc_vim; break;
3421
                case 23:
3497
                case 23:
3422
                    if (((inst >> 20) & 0b111111) == 32)
3498
                    if (((inst >> 20) & 0b111111) == 32)
Lines 3434-3440 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3434
                case 33: op = rv_op_vsadd_vi; break;
3510
                case 33: op = rv_op_vsadd_vi; break;
3435
                case 37: op = rv_op_vsll_vi; break;
3511
                case 37: op = rv_op_vsll_vi; break;
3436
                case 39:
3512
                case 39:
3437
                    switch (((inst >> 15) & 0b11111)) {
3513
                    switch ((inst >> 15) & 0b11111) {
3438
                    case 0: op = rv_op_vmv1r_v; break;
3514
                    case 0: op = rv_op_vmv1r_v; break;
3439
                    case 1: op = rv_op_vmv2r_v; break;
3515
                    case 1: op = rv_op_vmv2r_v; break;
3440
                    case 3: op = rv_op_vmv4r_v; break;
3516
                    case 3: op = rv_op_vmv4r_v; break;
Lines 3452-3458 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3452
                }
3528
                }
3453
                break;
3529
                break;
3454
            case 4:
3530
            case 4:
3455
                switch (((inst >> 26) & 0b111111)) {
3531
                switch ((inst >> 26) & 0b111111) {
3456
                case 0: op = rv_op_vadd_vx; break;
3532
                case 0: op = rv_op_vadd_vx; break;
3457
                case 2: op = rv_op_vsub_vx; break;
3533
                case 2: op = rv_op_vsub_vx; break;
3458
                case 3: op = rv_op_vrsub_vx; break;
3534
                case 3: op = rv_op_vrsub_vx; break;
Lines 3466-3474 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3466
                case 12: op = rv_op_vrgather_vx; break;
3542
                case 12: op = rv_op_vrgather_vx; break;
3467
                case 14: op = rv_op_vslideup_vx; break;
3543
                case 14: op = rv_op_vslideup_vx; break;
3468
                case 15: op = rv_op_vslidedown_vx; break;
3544
                case 15: op = rv_op_vslidedown_vx; break;
3469
                case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vxm; break;
3545
                case 16:
3546
                    if (((inst >> 25) & 1) == 0) {
3547
                        op = rv_op_vadc_vxm;
3548
                    }
3549
                    break;
3470
                case 17: op = rv_op_vmadc_vxm; break;
3550
                case 17: op = rv_op_vmadc_vxm; break;
3471
                case 18: if (((inst >> 25) & 1) == 0) op = rv_op_vsbc_vxm; break;
3551
                case 18:
3552
                    if (((inst >> 25) & 1) == 0) {
3553
                        op = rv_op_vsbc_vxm;
3554
                    }
3555
                    break;
3472
                case 19: op = rv_op_vmsbc_vxm; break;
3556
                case 19: op = rv_op_vmsbc_vxm; break;
3473
                case 23:
3557
                case 23:
3474
                    if (((inst >> 20) & 0b111111) == 32)
3558
                    if (((inst >> 20) & 0b111111) == 32)
Lines 3501-3507 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3501
                }
3585
                }
3502
                break;
3586
                break;
3503
            case 5:
3587
            case 5:
3504
                switch (((inst >> 26) & 0b111111)) {
3588
                switch ((inst >> 26) & 0b111111) {
3505
                case 0: op = rv_op_vfadd_vf; break;
3589
                case 0: op = rv_op_vfadd_vf; break;
3506
                case 2: op = rv_op_vfsub_vf; break;
3590
                case 2: op = rv_op_vfsub_vf; break;
3507
                case 4: op = rv_op_vfmin_vf; break;
3591
                case 4: op = rv_op_vfmin_vf; break;
Lines 3512-3518 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3512
                case 14: op = rv_op_vfslide1up_vf; break;
3596
                case 14: op = rv_op_vfslide1up_vf; break;
3513
                case 15: op = rv_op_vfslide1down_vf; break;
3597
                case 15: op = rv_op_vfslide1down_vf; break;
3514
                case 16:
3598
                case 16:
3515
                    switch (((inst >> 20) & 0b11111)) {
3599
                    switch ((inst >> 20) & 0b11111) {
3516
                    case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_s_f; break;
3600
                    case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_s_f; break;
3517
                    }
3601
                    }
3518
                    break;
3602
                    break;
Lines 3552-3558 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3552
                }
3636
                }
3553
                break;
3637
                break;
3554
            case 6:
3638
            case 6:
3555
                switch (((inst >> 26) & 0b111111)) {
3639
                switch ((inst >> 26) & 0b111111) {
3556
                case 8: op = rv_op_vaaddu_vx; break;
3640
                case 8: op = rv_op_vaaddu_vx; break;
3557
                case 9: op = rv_op_vaadd_vx; break;
3641
                case 9: op = rv_op_vaadd_vx; break;
3558
                case 10: op = rv_op_vasubu_vx; break;
3642
                case 10: op = rv_op_vasubu_vx; break;
Lines 3560-3566 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3560
                case 14: op = rv_op_vslide1up_vx; break;
3644
                case 14: op = rv_op_vslide1up_vx; break;
3561
                case 15: op = rv_op_vslide1down_vx; break;
3645
                case 15: op = rv_op_vslide1down_vx; break;
3562
                case 16:
3646
                case 16:
3563
                    switch (((inst >> 20) & 0b11111)) {
3647
                    switch ((inst >> 20) & 0b11111) {
3564
                    case 0: if ((inst >> 25) & 1) op = rv_op_vmv_s_x; break;
3648
                    case 0: if ((inst >> 25) & 1) op = rv_op_vmv_s_x; break;
3565
                    }
3649
                    }
3566
                    break;
3650
                    break;
Lines 3605-3619 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3605
            }
3689
            }
3606
            break;
3690
            break;
3607
        case 22:
3691
        case 22:
3608
            switch (((inst >> 12) & 0b111)) {
3692
            switch ((inst >> 12) & 0b111) {
3609
            case 0: op = rv_op_addid; break;
3693
            case 0: op = rv_op_addid; break;
3610
            case 1:
3694
            case 1:
3611
                switch (((inst >> 26) & 0b111111)) {
3695
                switch ((inst >> 26) & 0b111111) {
3612
                case 0: op = rv_op_sllid; break;
3696
                case 0: op = rv_op_sllid; break;
3613
                }
3697
                }
3614
                break;
3698
                break;
3615
            case 5:
3699
            case 5:
3616
                switch (((inst >> 26) & 0b111111)) {
3700
                switch ((inst >> 26) & 0b111111) {
3617
                case 0: op = rv_op_srlid; break;
3701
                case 0: op = rv_op_srlid; break;
3618
                case 16: op = rv_op_sraid; break;
3702
                case 16: op = rv_op_sraid; break;
3619
                }
3703
                }
Lines 3621-3627 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3621
            }
3705
            }
3622
            break;
3706
            break;
3623
        case 24:
3707
        case 24:
3624
            switch (((inst >> 12) & 0b111)) {
3708
            switch ((inst >> 12) & 0b111) {
3625
            case 0: op = rv_op_beq; break;
3709
            case 0: op = rv_op_beq; break;
3626
            case 1: op = rv_op_bne; break;
3710
            case 1: op = rv_op_bne; break;
3627
            case 4: op = rv_op_blt; break;
3711
            case 4: op = rv_op_blt; break;
Lines 3631-3662 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3631
            }
3715
            }
3632
            break;
3716
            break;
3633
        case 25:
3717
        case 25:
3634
            switch (((inst >> 12) & 0b111)) {
3718
            switch ((inst >> 12) & 0b111) {
3635
            case 0: op = rv_op_jalr; break;
3719
            case 0: op = rv_op_jalr; break;
3636
            }
3720
            }
3637
            break;
3721
            break;
3638
        case 27: op = rv_op_jal; break;
3722
        case 27: op = rv_op_jal; break;
3639
        case 28:
3723
        case 28:
3640
            switch (((inst >> 12) & 0b111)) {
3724
            switch ((inst >> 12) & 0b111) {
3641
            case 0:
3725
            case 0:
3642
                switch (((inst >> 20) & 0b111111100000) | ((inst >> 7) & 0b000000011111)) {
3726
                switch (((inst >> 20) & 0b111111100000) |
3727
                        ((inst >> 7) & 0b000000011111)) {
3643
                case 0:
3728
                case 0:
3644
                    switch (((inst >> 15) & 0b1111111111)) {
3729
                    switch ((inst >> 15) & 0b1111111111) {
3645
                    case 0: op = rv_op_ecall; break;
3730
                    case 0: op = rv_op_ecall; break;
3646
                    case 32: op = rv_op_ebreak; break;
3731
                    case 32: op = rv_op_ebreak; break;
3647
                    case 64: op = rv_op_uret; break;
3732
                    case 64: op = rv_op_uret; break;
3648
                    }
3733
                    }
3649
                    break;
3734
                    break;
3650
                case 256:
3735
                case 256:
3651
                    switch (((inst >> 20) & 0b11111)) {
3736
                    switch ((inst >> 20) & 0b11111) {
3652
                    case 2:
3737
                    case 2:
3653
                        switch (((inst >> 15) & 0b11111)) {
3738
                        switch ((inst >> 15) & 0b11111) {
3654
                        case 0: op = rv_op_sret; break;
3739
                        case 0: op = rv_op_sret; break;
3655
                        }
3740
                        }
3656
                        break;
3741
                        break;
3657
                    case 4: op = rv_op_sfence_vm; break;
3742
                    case 4: op = rv_op_sfence_vm; break;
3658
                    case 5:
3743
                    case 5:
3659
                        switch (((inst >> 15) & 0b11111)) {
3744
                        switch ((inst >> 15) & 0b11111) {
3660
                        case 0: op = rv_op_wfi; break;
3745
                        case 0: op = rv_op_wfi; break;
3661
                        }
3746
                        }
3662
                        break;
3747
                        break;
Lines 3664-3680 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3664
                    break;
3749
                    break;
3665
                case 288: op = rv_op_sfence_vma; break;
3750
                case 288: op = rv_op_sfence_vma; break;
3666
                case 512:
3751
                case 512:
3667
                    switch (((inst >> 15) & 0b1111111111)) {
3752
                    switch ((inst >> 15) & 0b1111111111) {
3668
                    case 64: op = rv_op_hret; break;
3753
                    case 64: op = rv_op_hret; break;
3669
                    }
3754
                    }
3670
                    break;
3755
                    break;
3671
                case 768:
3756
                case 768:
3672
                    switch (((inst >> 15) & 0b1111111111)) {
3757
                    switch ((inst >> 15) & 0b1111111111) {
3673
                    case 64: op = rv_op_mret; break;
3758
                    case 64: op = rv_op_mret; break;
3674
                    }
3759
                    }
3675
                    break;
3760
                    break;
3676
                case 1952:
3761
                case 1952:
3677
                    switch (((inst >> 15) & 0b1111111111)) {
3762
                    switch ((inst >> 15) & 0b1111111111) {
3678
                    case 576: op = rv_op_dret; break;
3763
                    case 576: op = rv_op_dret; break;
3679
                    }
3764
                    }
3680
                    break;
3765
                    break;
Lines 3689-3695 static void decode_inst_opcode(rv_decode *dec, rv_isa isa) Link Here
3689
            }
3774
            }
3690
            break;
3775
            break;
3691
        case 30:
3776
        case 30:
3692
            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {
3777
            switch (((inst >> 22) & 0b1111111000) |
3778
                    ((inst >> 12) & 0b0000000111)) {
3693
            case 0: op = rv_op_addd; break;
3779
            case 0: op = rv_op_addd; break;
3694
            case 1: op = rv_op_slld; break;
3780
            case 1: op = rv_op_slld; break;
3695
            case 5: op = rv_op_srld; break;
3781
            case 5: op = rv_op_srld; break;
Lines 4525-4531 static size_t inst_length(rv_inst inst) Link Here
4525
{
4611
{
4526
    /* NOTE: supports maximum instruction size of 64-bits */
4612
    /* NOTE: supports maximum instruction size of 64-bits */
4527
4613
4528
    /* instruction length coding
4614
    /*
4615
     * instruction length coding
4529
     *
4616
     *
4530
     *      aa - 16 bit aa != 11
4617
     *      aa - 16 bit aa != 11
4531
     *   bbb11 - 32 bit bbb != 111
4618
     *   bbb11 - 32 bit bbb != 111
Lines 4591-4606 static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec) Link Here
4591
            append(buf, rv_ireg_name_sym[dec->rs2], buflen);
4678
            append(buf, rv_ireg_name_sym[dec->rs2], buflen);
4592
            break;
4679
            break;
4593
        case '3':
4680
        case '3':
4594
            append(buf, rv_freg_name_sym[dec->rd], buflen);
4681
            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rd] :
4682
                                              rv_freg_name_sym[dec->rd],
4683
                   buflen);
4595
            break;
4684
            break;
4596
        case '4':
4685
        case '4':
4597
            append(buf, rv_freg_name_sym[dec->rs1], buflen);
4686
            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs1] :
4687
                                              rv_freg_name_sym[dec->rs1],
4688
                   buflen);
4598
            break;
4689
            break;
4599
        case '5':
4690
        case '5':
4600
            append(buf, rv_freg_name_sym[dec->rs2], buflen);
4691
            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs2] :
4692
                                              rv_freg_name_sym[dec->rs2],
4693
                   buflen);
4601
            break;
4694
            break;
4602
        case '6':
4695
        case '6':
4603
            append(buf, rv_freg_name_sym[dec->rs3], buflen);
4696
            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs3] :
4697
                                              rv_freg_name_sym[dec->rs3],
4698
                   buflen);
4604
            break;
4699
            break;
4605
        case '7':
4700
        case '7':
4606
            snprintf(tmp, sizeof(tmp), "%d", dec->rs1);
4701
            snprintf(tmp, sizeof(tmp), "%d", dec->rs1);
Lines 4861-4871 static void decode_inst_decompress(rv_decode *dec, rv_isa isa) Link Here
4861
/* disassemble instruction */
4956
/* disassemble instruction */
4862
4957
4863
static void
4958
static void
4864
disasm_inst(char *buf, size_t buflen, rv_isa isa, uint64_t pc, rv_inst inst)
4959
disasm_inst(char *buf, size_t buflen, rv_isa isa, uint64_t pc, rv_inst inst,
4960
            RISCVCPUConfig *cfg)
4865
{
4961
{
4866
    rv_decode dec = { 0 };
4962
    rv_decode dec = { 0 };
4867
    dec.pc = pc;
4963
    dec.pc = pc;
4868
    dec.inst = inst;
4964
    dec.inst = inst;
4965
    dec.cfg = cfg;
4869
    decode_inst_opcode(&dec, isa);
4966
    decode_inst_opcode(&dec, isa);
4870
    decode_inst_operands(&dec, isa);
4967
    decode_inst_operands(&dec, isa);
4871
    decode_inst_decompress(&dec, isa);
4968
    decode_inst_decompress(&dec, isa);
Lines 4920-4926 print_insn_riscv(bfd_vma memaddr, struct disassemble_info *info, rv_isa isa) Link Here
4920
        break;
5017
        break;
4921
    }
5018
    }
4922
5019
4923
    disasm_inst(buf, sizeof(buf), isa, memaddr, inst);
5020
    disasm_inst(buf, sizeof(buf), isa, memaddr, inst,
5021
                (RISCVCPUConfig *)info->target_info);
4924
    (*info->fprintf_func)(info->stream, "%s", buf);
5022
    (*info->fprintf_func)(info->stream, "%s", buf);
4925
5023
4926
    return len;
5024
    return len;
(-)a/docs/system/riscv/virt.rst (+31 lines)
Lines 53-58 with the default OpenSBI firmware image as the -bios. It also supports Link Here
53
the recommended RISC-V bootflow: U-Boot SPL (M-mode) loads OpenSBI fw_dynamic
53
the recommended RISC-V bootflow: U-Boot SPL (M-mode) loads OpenSBI fw_dynamic
54
firmware and U-Boot proper (S-mode), using the standard -bios functionality.
54
firmware and U-Boot proper (S-mode), using the standard -bios functionality.
55
55
56
Using flash devices
57
-------------------
58
59
By default, the first flash device (pflash0) is expected to contain
60
S-mode firmware code. It can be configured as read-only, with the
61
second flash device (pflash1) available to store configuration data.
62
63
For example, booting edk2 looks like
64
65
.. code-block:: bash
66
67
  $ qemu-system-riscv64 \
68
     -blockdev node-name=pflash0,driver=file,read-only=on,filename=<edk2_code> \
69
     -blockdev node-name=pflash1,driver=file,filename=<edk2_vars> \
70
     -M virt,pflash0=pflash0,pflash1=pflash1 \
71
     ... other args ....
72
73
For TCG guests only, it is also possible to boot M-mode firmware from
74
the first flash device (pflash0) by additionally passing ``-bios
75
none``, as in
76
77
.. code-block:: bash
78
79
  $ qemu-system-riscv64 \
80
     -bios none \
81
     -blockdev node-name=pflash0,driver=file,read-only=on,filename=<m_mode_code> \
82
     -M virt,pflash0=pflash0 \
83
     ... other args ....
84
85
Firmware images used for pflash must be exactly 32 MiB in size.
86
56
Machine-specific options
87
Machine-specific options
57
------------------------
88
------------------------
58
89
(-)a/hw/intc/riscv_aplic.c (-2 / +2 lines)
Lines 688-700 static void riscv_aplic_write(void *opaque, hwaddr addr, uint64_t value, Link Here
688
         * domains).
688
         * domains).
689
         */
689
         */
690
        if (aplic->num_children &&
690
        if (aplic->num_children &&
691
            !(aplic->smsicfgaddrH & APLIC_xMSICFGADDRH_L)) {
691
            !(aplic->mmsicfgaddrH & APLIC_xMSICFGADDRH_L)) {
692
            aplic->smsicfgaddr = value;
692
            aplic->smsicfgaddr = value;
693
        }
693
        }
694
    } else if (aplic->mmode && aplic->msimode &&
694
    } else if (aplic->mmode && aplic->msimode &&
695
               (addr == APLIC_SMSICFGADDRH)) {
695
               (addr == APLIC_SMSICFGADDRH)) {
696
        if (aplic->num_children &&
696
        if (aplic->num_children &&
697
            !(aplic->smsicfgaddrH & APLIC_xMSICFGADDRH_L)) {
697
            !(aplic->mmsicfgaddrH & APLIC_xMSICFGADDRH_L)) {
698
            aplic->smsicfgaddrH = value & APLIC_xMSICFGADDRH_VALID_MASK;
698
            aplic->smsicfgaddrH = value & APLIC_xMSICFGADDRH_VALID_MASK;
699
        }
699
        }
700
    } else if ((APLIC_SETIP_BASE <= addr) &&
700
    } else if ((APLIC_SETIP_BASE <= addr) &&
(-)a/hw/riscv/numa.c (+6 lines)
Lines 207-212 int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx) Link Here
207
{
207
{
208
    int64_t nidx = 0;
208
    int64_t nidx = 0;
209
209
210
    if (ms->numa_state->num_nodes > ms->smp.cpus) {
211
        error_report("Number of NUMA nodes (%d)"
212
                     " cannot exceed the number of available CPUs (%d).",
213
                     ms->numa_state->num_nodes, ms->smp.max_cpus);
214
        exit(EXIT_FAILURE);
215
    }
210
    if (ms->numa_state->num_nodes) {
216
    if (ms->numa_state->num_nodes) {
211
        nidx = idx / (ms->smp.cpus / ms->numa_state->num_nodes);
217
        nidx = idx / (ms->smp.cpus / ms->numa_state->num_nodes);
212
        if (ms->numa_state->num_nodes <= nidx) {
218
        if (ms->numa_state->num_nodes <= nidx) {
(-)a/hw/riscv/opentitan.c (-18 / +20 lines)
Lines 75-85 static const MemMapEntry ibex_memmap[] = { Link Here
75
    [IBEX_DEV_FLASH_VIRTUAL] =  {  0x80000000,  0x80000     },
75
    [IBEX_DEV_FLASH_VIRTUAL] =  {  0x80000000,  0x80000     },
76
};
76
};
77
77
78
static void opentitan_board_init(MachineState *machine)
78
static void opentitan_machine_init(MachineState *machine)
79
{
79
{
80
    MachineClass *mc = MACHINE_GET_CLASS(machine);
80
    MachineClass *mc = MACHINE_GET_CLASS(machine);
81
    OpenTitanState *s = OPENTITAN_MACHINE(machine);
81
    const MemMapEntry *memmap = ibex_memmap;
82
    const MemMapEntry *memmap = ibex_memmap;
82
    OpenTitanState *s = g_new0(OpenTitanState, 1);
83
    MemoryRegion *sys_mem = get_system_memory();
83
    MemoryRegion *sys_mem = get_system_memory();
84
84
85
    if (machine->ram_size != mc->default_ram_size) {
85
    if (machine->ram_size != mc->default_ram_size) {
Lines 108-125 static void opentitan_board_init(MachineState *machine) Link Here
108
    }
108
    }
109
}
109
}
110
110
111
static void opentitan_machine_init(MachineClass *mc)
111
static void opentitan_machine_class_init(ObjectClass *oc, void *data)
112
{
112
{
113
    MachineClass *mc = MACHINE_CLASS(oc);
114
113
    mc->desc = "RISC-V Board compatible with OpenTitan";
115
    mc->desc = "RISC-V Board compatible with OpenTitan";
114
    mc->init = opentitan_board_init;
116
    mc->init = opentitan_machine_init;
115
    mc->max_cpus = 1;
117
    mc->max_cpus = 1;
116
    mc->default_cpu_type = TYPE_RISCV_CPU_IBEX;
118
    mc->default_cpu_type = TYPE_RISCV_CPU_IBEX;
117
    mc->default_ram_id = "riscv.lowrisc.ibex.ram";
119
    mc->default_ram_id = "riscv.lowrisc.ibex.ram";
118
    mc->default_ram_size = ibex_memmap[IBEX_DEV_RAM].size;
120
    mc->default_ram_size = ibex_memmap[IBEX_DEV_RAM].size;
119
}
121
}
120
122
121
DEFINE_MACHINE("opentitan", opentitan_machine_init)
122
123
static void lowrisc_ibex_soc_init(Object *obj)
123
static void lowrisc_ibex_soc_init(Object *obj)
124
{
124
{
125
    LowRISCIbexSoCState *s = RISCV_IBEX_SOC(obj);
125
    LowRISCIbexSoCState *s = RISCV_IBEX_SOC(obj);
Lines 320-336 static void lowrisc_ibex_soc_class_init(ObjectClass *oc, void *data) Link Here
320
    dc->user_creatable = false;
320
    dc->user_creatable = false;
321
}
321
}
322
322
323
static const TypeInfo lowrisc_ibex_soc_type_info = {
323
static const TypeInfo open_titan_types[] = {
324
    .name = TYPE_RISCV_IBEX_SOC,
324
    {
325
    .parent = TYPE_DEVICE,
325
        .name           = TYPE_RISCV_IBEX_SOC,
326
    .instance_size = sizeof(LowRISCIbexSoCState),
326
        .parent         = TYPE_DEVICE,
327
    .instance_init = lowrisc_ibex_soc_init,
327
        .instance_size  = sizeof(LowRISCIbexSoCState),
328
    .class_init = lowrisc_ibex_soc_class_init,
328
        .instance_init  = lowrisc_ibex_soc_init,
329
        .class_init     = lowrisc_ibex_soc_class_init,
330
    }, {
331
        .name           = TYPE_OPENTITAN_MACHINE,
332
        .parent         = TYPE_MACHINE,
333
        .instance_size  = sizeof(OpenTitanState),
334
        .class_init     = opentitan_machine_class_init,
335
    }
329
};
336
};
330
337
331
static void lowrisc_ibex_soc_register_types(void)
338
DEFINE_TYPES(open_titan_types)
332
{
333
    type_register_static(&lowrisc_ibex_soc_type_info);
334
}
335
336
type_init(lowrisc_ibex_soc_register_types)
(-)a/hw/riscv/virt.c (-34 / +25 lines)
Lines 1245-1251 static void virt_machine_done(Notifier *notifier, void *data) Link Here
1245
    target_ulong firmware_end_addr, kernel_start_addr;
1245
    target_ulong firmware_end_addr, kernel_start_addr;
1246
    const char *firmware_name = riscv_default_firmware_name(&s->soc[0]);
1246
    const char *firmware_name = riscv_default_firmware_name(&s->soc[0]);
1247
    uint32_t fdt_load_addr;
1247
    uint32_t fdt_load_addr;
1248
    uint64_t kernel_entry;
1248
    uint64_t kernel_entry = 0;
1249
    BlockBackend *pflash_blk0;
1249
1250
1250
    /*
1251
    /*
1251
     * Only direct boot kernel is currently supported for KVM VM,
1252
     * Only direct boot kernel is currently supported for KVM VM,
Lines 1266-1307 static void virt_machine_done(Notifier *notifier, void *data) Link Here
1266
    firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_name,
1267
    firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_name,
1267
                                                     start_addr, NULL);
1268
                                                     start_addr, NULL);
1268
1269
1269
    if (drive_get(IF_PFLASH, 0, 1)) {
1270
    pflash_blk0 = pflash_cfi01_get_blk(s->flash[0]);
1270
        /*
1271
    if (pflash_blk0) {
1271
         * S-mode FW like EDK2 will be kept in second plash (unit 1).
1272
        if (machine->firmware && !strcmp(machine->firmware, "none") &&
1272
         * When both kernel, initrd and pflash options are provided in the
1273
            !kvm_enabled()) {
1273
         * command line, the kernel and initrd will be copied to the fw_cfg
1274
            /*
1274
         * table and opensbi will jump to the flash address which is the
1275
             * Pflash was supplied but bios is none and not KVM guest,
1275
         * entry point of S-mode FW. It is the job of the S-mode FW to load
1276
             * let's overwrite the address we jump to after reset to
1276
         * the kernel and initrd using fw_cfg table.
1277
             * the base of the flash.
1277
         *
1278
             */
1278
         * If only pflash is given but not -kernel, then it is the job of
1279
            start_addr = virt_memmap[VIRT_FLASH].base;
1279
         * of the S-mode firmware to locate and load the kernel.
1280
        } else {
1280
         * In either case, the next_addr for opensbi will be the flash address.
1281
            /*
1281
         */
1282
             * Pflash was supplied but either KVM guest or bios is not none.
1282
        riscv_setup_firmware_boot(machine);
1283
             * In this case, base of the flash would contain S-mode payload.
1283
        kernel_entry = virt_memmap[VIRT_FLASH].base +
1284
             */
1284
                       virt_memmap[VIRT_FLASH].size / 2;
1285
            riscv_setup_firmware_boot(machine);
1285
    } else if (machine->kernel_filename) {
1286
            kernel_entry = virt_memmap[VIRT_FLASH].base;
1287
        }
1288
    }
1289
1290
    if (machine->kernel_filename && !kernel_entry) {
1286
        kernel_start_addr = riscv_calc_kernel_start_addr(&s->soc[0],
1291
        kernel_start_addr = riscv_calc_kernel_start_addr(&s->soc[0],
1287
                                                         firmware_end_addr);
1292
                                                         firmware_end_addr);
1288
1293
1289
        kernel_entry = riscv_load_kernel(machine, &s->soc[0],
1294
        kernel_entry = riscv_load_kernel(machine, &s->soc[0],
1290
                                         kernel_start_addr, true, NULL);
1295
                                         kernel_start_addr, true, NULL);
1291
    } else {
1292
       /*
1293
        * If dynamic firmware is used, it doesn't know where is the next mode
1294
        * if kernel argument is not set.
1295
        */
1296
        kernel_entry = 0;
1297
    }
1298
1299
    if (drive_get(IF_PFLASH, 0, 0)) {
1300
        /*
1301
         * Pflash was supplied, let's overwrite the address we jump to after
1302
         * reset to the base of the flash.
1303
         */
1304
        start_addr = virt_memmap[VIRT_FLASH].base;
1305
    }
1296
    }
1306
1297
1307
    fdt_load_addr = riscv_compute_fdt_addr(memmap[VIRT_DRAM].base,
1298
    fdt_load_addr = riscv_compute_fdt_addr(memmap[VIRT_DRAM].base,
Lines 1510-1517 static void virt_machine_init(MachineState *machine) Link Here
1510
    sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base,
1501
    sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base,
1511
        qdev_get_gpio_in(mmio_irqchip, RTC_IRQ));
1502
        qdev_get_gpio_in(mmio_irqchip, RTC_IRQ));
1512
1503
1513
    virt_flash_create(s);
1514
1515
    for (i = 0; i < ARRAY_SIZE(s->flash); i++) {
1504
    for (i = 0; i < ARRAY_SIZE(s->flash); i++) {
1516
        /* Map legacy -drive if=pflash to machine properties */
1505
        /* Map legacy -drive if=pflash to machine properties */
1517
        pflash_cfi01_legacy_drive(s->flash[i],
1506
        pflash_cfi01_legacy_drive(s->flash[i],
Lines 1538-1543 static void virt_machine_instance_init(Object *obj) Link Here
1538
{
1527
{
1539
    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
1528
    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
1540
1529
1530
    virt_flash_create(s);
1531
1541
    s->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
1532
    s->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
1542
    s->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
1533
    s->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
1543
    s->acpi = ON_OFF_AUTO_AUTO;
1534
    s->acpi = ON_OFF_AUTO_AUTO;
(-)a/include/disas/dis-asm.h (-1 / +1 lines)
Lines 397-403 typedef struct disassemble_info { Link Here
397
  char * disassembler_options;
397
  char * disassembler_options;
398
398
399
  /* Field intended to be used by targets in any way they deem suitable.  */
399
  /* Field intended to be used by targets in any way they deem suitable.  */
400
  int64_t target_info;
400
  void *target_info;
401
401
402
  /* Options for Capstone disassembly.  */
402
  /* Options for Capstone disassembly.  */
403
  int cap_arch;
403
  int cap_arch;
(-)a/include/hw/core/cpu.h (+2 lines)
Lines 544-554 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu); Link Here
544
 * @CPU_DUMP_CODE:
544
 * @CPU_DUMP_CODE:
545
 * @CPU_DUMP_FPU: dump FPU register state, not just integer
545
 * @CPU_DUMP_FPU: dump FPU register state, not just integer
546
 * @CPU_DUMP_CCOP: dump info about TCG QEMU's condition code optimization state
546
 * @CPU_DUMP_CCOP: dump info about TCG QEMU's condition code optimization state
547
 * @CPU_DUMP_VPU: dump VPU registers
547
 */
548
 */
548
enum CPUDumpFlags {
549
enum CPUDumpFlags {
549
    CPU_DUMP_CODE = 0x00010000,
550
    CPU_DUMP_CODE = 0x00010000,
550
    CPU_DUMP_FPU  = 0x00020000,
551
    CPU_DUMP_FPU  = 0x00020000,
551
    CPU_DUMP_CCOP = 0x00040000,
552
    CPU_DUMP_CCOP = 0x00040000,
553
    CPU_DUMP_VPU  = 0x00080000,
552
};
554
};
553
555
554
/**
556
/**
(-)a/include/hw/riscv/opentitan.h (-1 / +5 lines)
Lines 24-29 Link Here
24
#include "hw/char/ibex_uart.h"
24
#include "hw/char/ibex_uart.h"
25
#include "hw/timer/ibex_timer.h"
25
#include "hw/timer/ibex_timer.h"
26
#include "hw/ssi/ibex_spi_host.h"
26
#include "hw/ssi/ibex_spi_host.h"
27
#include "hw/boards.h"
27
#include "qom/object.h"
28
#include "qom/object.h"
28
29
29
#define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc"
30
#define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc"
Lines 53-61 struct LowRISCIbexSoCState { Link Here
53
    MemoryRegion flash_alias;
54
    MemoryRegion flash_alias;
54
};
55
};
55
56
57
#define TYPE_OPENTITAN_MACHINE MACHINE_TYPE_NAME("opentitan")
58
OBJECT_DECLARE_SIMPLE_TYPE(OpenTitanState, OPENTITAN_MACHINE)
59
56
typedef struct OpenTitanState {
60
typedef struct OpenTitanState {
57
    /*< private >*/
61
    /*< private >*/
58
    SysBusDevice parent_obj;
62
    MachineState parent_obj;
59
63
60
    /*< public >*/
64
    /*< public >*/
61
    LowRISCIbexSoCState soc;
65
    LowRISCIbexSoCState soc;
(-)a/include/qemu/log.h (+1 lines)
Lines 35-40 bool qemu_log_separate(void); Link Here
35
/* LOG_STRACE is used for user-mode strace logging. */
35
/* LOG_STRACE is used for user-mode strace logging. */
36
#define LOG_STRACE         (1 << 19)
36
#define LOG_STRACE         (1 << 19)
37
#define LOG_PER_THREAD     (1 << 20)
37
#define LOG_PER_THREAD     (1 << 20)
38
#define CPU_LOG_TB_VPU     (1 << 21)
38
39
39
/* Lock/unlock output. */
40
/* Lock/unlock output. */
40
41
(-)a/target/riscv/cpu.c (-152 / +232 lines)
Lines 119-124 static const struct isa_ext_data isa_edata_arr[] = { Link Here
119
    ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx),
119
    ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx),
120
    ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin),
120
    ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin),
121
    ISA_EXT_DATA_ENTRY(smaia, PRIV_VERSION_1_12_0, ext_smaia),
121
    ISA_EXT_DATA_ENTRY(smaia, PRIV_VERSION_1_12_0, ext_smaia),
122
    ISA_EXT_DATA_ENTRY(smstateen, PRIV_VERSION_1_12_0, ext_smstateen),
122
    ISA_EXT_DATA_ENTRY(ssaia, PRIV_VERSION_1_12_0, ext_ssaia),
123
    ISA_EXT_DATA_ENTRY(ssaia, PRIV_VERSION_1_12_0, ext_ssaia),
123
    ISA_EXT_DATA_ENTRY(sscofpmf, PRIV_VERSION_1_12_0, ext_sscofpmf),
124
    ISA_EXT_DATA_ENTRY(sscofpmf, PRIV_VERSION_1_12_0, ext_sscofpmf),
124
    ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc),
125
    ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc),
Lines 247-262 static void set_misa(CPURISCVState *env, RISCVMXL mxl, uint32_t ext) Link Here
247
    env->misa_ext_mask = env->misa_ext = ext;
248
    env->misa_ext_mask = env->misa_ext = ext;
248
}
249
}
249
250
250
static void set_priv_version(CPURISCVState *env, int priv_ver)
251
{
252
    env->priv_ver = priv_ver;
253
}
254
255
static void set_vext_version(CPURISCVState *env, int vext_ver)
256
{
257
    env->vext_ver = vext_ver;
258
}
259
260
#ifndef CONFIG_USER_ONLY
251
#ifndef CONFIG_USER_ONLY
261
static uint8_t satp_mode_from_str(const char *satp_mode_str)
252
static uint8_t satp_mode_from_str(const char *satp_mode_str)
262
{
253
{
Lines 342-348 static void set_satp_mode_default_map(RISCVCPU *cpu) Link Here
342
333
343
static void riscv_any_cpu_init(Object *obj)
334
static void riscv_any_cpu_init(Object *obj)
344
{
335
{
345
    CPURISCVState *env = &RISCV_CPU(obj)->env;
336
    RISCVCPU *cpu = RISCV_CPU(obj);
337
    CPURISCVState *env = &cpu->env;
346
#if defined(TARGET_RISCV32)
338
#if defined(TARGET_RISCV32)
347
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVD | RVC | RVU);
339
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVD | RVC | RVU);
348
#elif defined(TARGET_RISCV64)
340
#elif defined(TARGET_RISCV64)
Lines 355-361 static void riscv_any_cpu_init(Object *obj) Link Here
355
        VM_1_10_SV32 : VM_1_10_SV57);
347
        VM_1_10_SV32 : VM_1_10_SV57);
356
#endif
348
#endif
357
349
358
    set_priv_version(env, PRIV_VERSION_1_12_0);
350
    env->priv_ver = PRIV_VERSION_LATEST;
351
352
    /* inherited from parent obj via riscv_cpu_init() */
353
    cpu->cfg.ext_ifencei = true;
354
    cpu->cfg.ext_icsr = true;
355
    cpu->cfg.mmu = true;
356
    cpu->cfg.pmp = true;
359
}
357
}
360
358
361
#if defined(TARGET_RISCV64)
359
#if defined(TARGET_RISCV64)
Lines 366-372 static void rv64_base_cpu_init(Object *obj) Link Here
366
    set_misa(env, MXL_RV64, 0);
364
    set_misa(env, MXL_RV64, 0);
367
    riscv_cpu_add_user_properties(obj);
365
    riscv_cpu_add_user_properties(obj);
368
    /* Set latest version of privileged specification */
366
    /* Set latest version of privileged specification */
369
    set_priv_version(env, PRIV_VERSION_1_12_0);
367
    env->priv_ver = PRIV_VERSION_LATEST;
370
#ifndef CONFIG_USER_ONLY
368
#ifndef CONFIG_USER_ONLY
371
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV57);
369
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV57);
372
#endif
370
#endif
Lines 374-385 static void rv64_base_cpu_init(Object *obj) Link Here
374
372
375
static void rv64_sifive_u_cpu_init(Object *obj)
373
static void rv64_sifive_u_cpu_init(Object *obj)
376
{
374
{
377
    CPURISCVState *env = &RISCV_CPU(obj)->env;
375
    RISCVCPU *cpu = RISCV_CPU(obj);
376
    CPURISCVState *env = &cpu->env;
378
    set_misa(env, MXL_RV64, RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
377
    set_misa(env, MXL_RV64, RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
379
    set_priv_version(env, PRIV_VERSION_1_10_0);
378
    env->priv_ver = PRIV_VERSION_1_10_0;
380
#ifndef CONFIG_USER_ONLY
379
#ifndef CONFIG_USER_ONLY
381
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV39);
380
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV39);
382
#endif
381
#endif
382
383
    /* inherited from parent obj via riscv_cpu_init() */
384
    cpu->cfg.ext_ifencei = true;
385
    cpu->cfg.ext_icsr = true;
386
    cpu->cfg.mmu = true;
387
    cpu->cfg.pmp = true;
383
}
388
}
384
389
385
static void rv64_sifive_e_cpu_init(Object *obj)
390
static void rv64_sifive_e_cpu_init(Object *obj)
Lines 388-398 static void rv64_sifive_e_cpu_init(Object *obj) Link Here
388
    RISCVCPU *cpu = RISCV_CPU(obj);
393
    RISCVCPU *cpu = RISCV_CPU(obj);
389
394
390
    set_misa(env, MXL_RV64, RVI | RVM | RVA | RVC | RVU);
395
    set_misa(env, MXL_RV64, RVI | RVM | RVA | RVC | RVU);
391
    set_priv_version(env, PRIV_VERSION_1_10_0);
396
    env->priv_ver = PRIV_VERSION_1_10_0;
392
    cpu->cfg.mmu = false;
393
#ifndef CONFIG_USER_ONLY
397
#ifndef CONFIG_USER_ONLY
394
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
398
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
395
#endif
399
#endif
400
401
    /* inherited from parent obj via riscv_cpu_init() */
402
    cpu->cfg.ext_ifencei = true;
403
    cpu->cfg.ext_icsr = true;
404
    cpu->cfg.pmp = true;
396
}
405
}
397
406
398
static void rv64_thead_c906_cpu_init(Object *obj)
407
static void rv64_thead_c906_cpu_init(Object *obj)
Lines 401-407 static void rv64_thead_c906_cpu_init(Object *obj) Link Here
401
    RISCVCPU *cpu = RISCV_CPU(obj);
410
    RISCVCPU *cpu = RISCV_CPU(obj);
402
411
403
    set_misa(env, MXL_RV64, RVG | RVC | RVS | RVU);
412
    set_misa(env, MXL_RV64, RVG | RVC | RVS | RVU);
404
    set_priv_version(env, PRIV_VERSION_1_11_0);
413
    env->priv_ver = PRIV_VERSION_1_11_0;
405
414
406
    cpu->cfg.ext_zfh = true;
415
    cpu->cfg.ext_zfh = true;
407
    cpu->cfg.mmu = true;
416
    cpu->cfg.mmu = true;
Lines 420-425 static void rv64_thead_c906_cpu_init(Object *obj) Link Here
420
#ifndef CONFIG_USER_ONLY
429
#ifndef CONFIG_USER_ONLY
421
    set_satp_mode_max_supported(cpu, VM_1_10_SV39);
430
    set_satp_mode_max_supported(cpu, VM_1_10_SV39);
422
#endif
431
#endif
432
433
    /* inherited from parent obj via riscv_cpu_init() */
434
    cpu->cfg.pmp = true;
423
}
435
}
424
436
425
static void rv64_veyron_v1_cpu_init(Object *obj)
437
static void rv64_veyron_v1_cpu_init(Object *obj)
Lines 472-478 static void rv128_base_cpu_init(Object *obj) Link Here
472
    set_misa(env, MXL_RV128, 0);
484
    set_misa(env, MXL_RV128, 0);
473
    riscv_cpu_add_user_properties(obj);
485
    riscv_cpu_add_user_properties(obj);
474
    /* Set latest version of privileged specification */
486
    /* Set latest version of privileged specification */
475
    set_priv_version(env, PRIV_VERSION_1_12_0);
487
    env->priv_ver = PRIV_VERSION_LATEST;
476
#ifndef CONFIG_USER_ONLY
488
#ifndef CONFIG_USER_ONLY
477
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV57);
489
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV57);
478
#endif
490
#endif
Lines 485-491 static void rv32_base_cpu_init(Object *obj) Link Here
485
    set_misa(env, MXL_RV32, 0);
497
    set_misa(env, MXL_RV32, 0);
486
    riscv_cpu_add_user_properties(obj);
498
    riscv_cpu_add_user_properties(obj);
487
    /* Set latest version of privileged specification */
499
    /* Set latest version of privileged specification */
488
    set_priv_version(env, PRIV_VERSION_1_12_0);
500
    env->priv_ver = PRIV_VERSION_LATEST;
489
#ifndef CONFIG_USER_ONLY
501
#ifndef CONFIG_USER_ONLY
490
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV32);
502
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV32);
491
#endif
503
#endif
Lines 493-504 static void rv32_base_cpu_init(Object *obj) Link Here
493
505
494
static void rv32_sifive_u_cpu_init(Object *obj)
506
static void rv32_sifive_u_cpu_init(Object *obj)
495
{
507
{
496
    CPURISCVState *env = &RISCV_CPU(obj)->env;
508
    RISCVCPU *cpu = RISCV_CPU(obj);
509
    CPURISCVState *env = &cpu->env;
497
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
510
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
498
    set_priv_version(env, PRIV_VERSION_1_10_0);
511
    env->priv_ver = PRIV_VERSION_1_10_0;
499
#ifndef CONFIG_USER_ONLY
512
#ifndef CONFIG_USER_ONLY
500
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV32);
513
    set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV32);
501
#endif
514
#endif
515
516
    /* inherited from parent obj via riscv_cpu_init() */
517
    cpu->cfg.ext_ifencei = true;
518
    cpu->cfg.ext_icsr = true;
519
    cpu->cfg.mmu = true;
520
    cpu->cfg.pmp = true;
502
}
521
}
503
522
504
static void rv32_sifive_e_cpu_init(Object *obj)
523
static void rv32_sifive_e_cpu_init(Object *obj)
Lines 507-517 static void rv32_sifive_e_cpu_init(Object *obj) Link Here
507
    RISCVCPU *cpu = RISCV_CPU(obj);
526
    RISCVCPU *cpu = RISCV_CPU(obj);
508
527
509
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVC | RVU);
528
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVC | RVU);
510
    set_priv_version(env, PRIV_VERSION_1_10_0);
529
    env->priv_ver = PRIV_VERSION_1_10_0;
511
    cpu->cfg.mmu = false;
512
#ifndef CONFIG_USER_ONLY
530
#ifndef CONFIG_USER_ONLY
513
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
531
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
514
#endif
532
#endif
533
534
    /* inherited from parent obj via riscv_cpu_init() */
535
    cpu->cfg.ext_ifencei = true;
536
    cpu->cfg.ext_icsr = true;
537
    cpu->cfg.pmp = true;
515
}
538
}
516
539
517
static void rv32_ibex_cpu_init(Object *obj)
540
static void rv32_ibex_cpu_init(Object *obj)
Lines 520-531 static void rv32_ibex_cpu_init(Object *obj) Link Here
520
    RISCVCPU *cpu = RISCV_CPU(obj);
543
    RISCVCPU *cpu = RISCV_CPU(obj);
521
544
522
    set_misa(env, MXL_RV32, RVI | RVM | RVC | RVU);
545
    set_misa(env, MXL_RV32, RVI | RVM | RVC | RVU);
523
    set_priv_version(env, PRIV_VERSION_1_11_0);
546
    env->priv_ver = PRIV_VERSION_1_11_0;
524
    cpu->cfg.mmu = false;
525
#ifndef CONFIG_USER_ONLY
547
#ifndef CONFIG_USER_ONLY
526
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
548
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
527
#endif
549
#endif
528
    cpu->cfg.epmp = true;
550
    cpu->cfg.epmp = true;
551
552
    /* inherited from parent obj via riscv_cpu_init() */
553
    cpu->cfg.ext_ifencei = true;
554
    cpu->cfg.ext_icsr = true;
555
    cpu->cfg.pmp = true;
529
}
556
}
530
557
531
static void rv32_imafcu_nommu_cpu_init(Object *obj)
558
static void rv32_imafcu_nommu_cpu_init(Object *obj)
Lines 534-544 static void rv32_imafcu_nommu_cpu_init(Object *obj) Link Here
534
    RISCVCPU *cpu = RISCV_CPU(obj);
561
    RISCVCPU *cpu = RISCV_CPU(obj);
535
562
536
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVC | RVU);
563
    set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVC | RVU);
537
    set_priv_version(env, PRIV_VERSION_1_10_0);
564
    env->priv_ver = PRIV_VERSION_1_10_0;
538
    cpu->cfg.mmu = false;
539
#ifndef CONFIG_USER_ONLY
565
#ifndef CONFIG_USER_ONLY
540
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
566
    set_satp_mode_max_supported(cpu, VM_1_10_MBARE);
541
#endif
567
#endif
568
569
    /* inherited from parent obj via riscv_cpu_init() */
570
    cpu->cfg.ext_ifencei = true;
571
    cpu->cfg.ext_icsr = true;
572
    cpu->cfg.pmp = true;
542
}
573
}
543
#endif
574
#endif
544
575
Lines 690-705 static vaddr riscv_cpu_get_pc(CPUState *cs) Link Here
690
static void riscv_cpu_synchronize_from_tb(CPUState *cs,
721
static void riscv_cpu_synchronize_from_tb(CPUState *cs,
691
                                          const TranslationBlock *tb)
722
                                          const TranslationBlock *tb)
692
{
723
{
693
    RISCVCPU *cpu = RISCV_CPU(cs);
724
    if (!(tb_cflags(tb) & CF_PCREL)) {
694
    CPURISCVState *env = &cpu->env;
725
        RISCVCPU *cpu = RISCV_CPU(cs);
695
    RISCVMXL xl = FIELD_EX32(tb->flags, TB_FLAGS, XL);
726
        CPURISCVState *env = &cpu->env;
727
        RISCVMXL xl = FIELD_EX32(tb->flags, TB_FLAGS, XL);
696
728
697
    tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL));
729
        tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL));
698
730
699
    if (xl == MXL_RV32) {
731
        if (xl == MXL_RV32) {
700
        env->pc = (int32_t) tb->pc;
732
            env->pc = (int32_t) tb->pc;
701
    } else {
733
        } else {
702
        env->pc = tb->pc;
734
            env->pc = tb->pc;
735
        }
703
    }
736
    }
704
}
737
}
705
738
Lines 725-735 static void riscv_restore_state_to_opc(CPUState *cs, Link Here
725
    RISCVCPU *cpu = RISCV_CPU(cs);
758
    RISCVCPU *cpu = RISCV_CPU(cs);
726
    CPURISCVState *env = &cpu->env;
759
    CPURISCVState *env = &cpu->env;
727
    RISCVMXL xl = FIELD_EX32(tb->flags, TB_FLAGS, XL);
760
    RISCVMXL xl = FIELD_EX32(tb->flags, TB_FLAGS, XL);
761
    target_ulong pc;
762
763
    if (tb_cflags(tb) & CF_PCREL) {
764
        pc = (env->pc & TARGET_PAGE_MASK) | data[0];
765
    } else {
766
        pc = data[0];
767
    }
728
768
729
    if (xl == MXL_RV32) {
769
    if (xl == MXL_RV32) {
730
        env->pc = (int32_t)data[0];
770
        env->pc = (int32_t)pc;
731
    } else {
771
    } else {
732
        env->pc = data[0];
772
        env->pc = pc;
733
    }
773
    }
734
    env->bins = data[1];
774
    env->bins = data[1];
735
}
775
}
Lines 818-823 static void riscv_cpu_reset_hold(Object *obj) Link Here
818
static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info)
858
static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info)
819
{
859
{
820
    RISCVCPU *cpu = RISCV_CPU(s);
860
    RISCVCPU *cpu = RISCV_CPU(s);
861
    info->target_info = &cpu->cfg;
821
862
822
    switch (riscv_cpu_mxl(&cpu->env)) {
863
    switch (riscv_cpu_mxl(&cpu->env)) {
823
    case MXL_RV32:
864
    case MXL_RV32:
Lines 834-846 static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info) Link Here
834
    }
875
    }
835
}
876
}
836
877
878
static void riscv_cpu_validate_v(CPURISCVState *env, RISCVCPUConfig *cfg,
879
                                 Error **errp)
880
{
881
    int vext_version = VEXT_VERSION_1_00_0;
882
883
    if (!is_power_of_2(cfg->vlen)) {
884
        error_setg(errp, "Vector extension VLEN must be power of 2");
885
        return;
886
    }
887
    if (cfg->vlen > RV_VLEN_MAX || cfg->vlen < 128) {
888
        error_setg(errp,
889
                   "Vector extension implementation only supports VLEN "
890
                   "in the range [128, %d]", RV_VLEN_MAX);
891
        return;
892
    }
893
    if (!is_power_of_2(cfg->elen)) {
894
        error_setg(errp, "Vector extension ELEN must be power of 2");
895
        return;
896
    }
897
    if (cfg->elen > 64 || cfg->elen < 8) {
898
        error_setg(errp,
899
                   "Vector extension implementation only supports ELEN "
900
                   "in the range [8, 64]");
901
        return;
902
    }
903
    if (cfg->vext_spec) {
904
        if (!g_strcmp0(cfg->vext_spec, "v1.0")) {
905
            vext_version = VEXT_VERSION_1_00_0;
906
        } else {
907
            error_setg(errp, "Unsupported vector spec version '%s'",
908
                       cfg->vext_spec);
909
            return;
910
        }
911
    } else {
912
        qemu_log("vector version is not specified, "
913
                 "use the default value v1.0\n");
914
    }
915
    env->vext_ver = vext_version;
916
}
917
918
static void riscv_cpu_validate_priv_spec(RISCVCPU *cpu, Error **errp)
919
{
920
    CPURISCVState *env = &cpu->env;
921
    int priv_version = -1;
922
923
    if (cpu->cfg.priv_spec) {
924
        if (!g_strcmp0(cpu->cfg.priv_spec, "v1.12.0")) {
925
            priv_version = PRIV_VERSION_1_12_0;
926
        } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.11.0")) {
927
            priv_version = PRIV_VERSION_1_11_0;
928
        } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.10.0")) {
929
            priv_version = PRIV_VERSION_1_10_0;
930
        } else {
931
            error_setg(errp,
932
                       "Unsupported privilege spec version '%s'",
933
                       cpu->cfg.priv_spec);
934
            return;
935
        }
936
937
        env->priv_ver = priv_version;
938
    }
939
}
940
941
static void riscv_cpu_disable_priv_spec_isa_exts(RISCVCPU *cpu)
942
{
943
    CPURISCVState *env = &cpu->env;
944
    int i;
945
946
    /* Force disable extensions if priv spec version does not match */
947
    for (i = 0; i < ARRAY_SIZE(isa_edata_arr); i++) {
948
        if (isa_ext_is_enabled(cpu, &isa_edata_arr[i]) &&
949
            (env->priv_ver < isa_edata_arr[i].min_version)) {
950
            isa_ext_update_enabled(cpu, &isa_edata_arr[i], false);
951
#ifndef CONFIG_USER_ONLY
952
            warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx
953
                        " because privilege spec version does not match",
954
                        isa_edata_arr[i].name, env->mhartid);
955
#else
956
            warn_report("disabling %s extension because "
957
                        "privilege spec version does not match",
958
                        isa_edata_arr[i].name);
959
#endif
960
        }
961
    }
962
}
963
964
static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp)
965
{
966
    RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
967
    CPUClass *cc = CPU_CLASS(mcc);
968
    CPURISCVState *env = &cpu->env;
969
970
    /* Validate that MISA_MXL is set properly. */
971
    switch (env->misa_mxl_max) {
972
#ifdef TARGET_RISCV64
973
    case MXL_RV64:
974
    case MXL_RV128:
975
        cc->gdb_core_xml_file = "riscv-64bit-cpu.xml";
976
        break;
977
#endif
978
    case MXL_RV32:
979
        cc->gdb_core_xml_file = "riscv-32bit-cpu.xml";
980
        break;
981
    default:
982
        g_assert_not_reached();
983
    }
984
985
    if (env->misa_mxl_max != env->misa_mxl) {
986
        error_setg(errp, "misa_mxl_max must be equal to misa_mxl");
987
        return;
988
    }
989
}
990
837
/*
991
/*
838
 * Check consistency between chosen extensions while setting
992
 * Check consistency between chosen extensions while setting
839
 * cpu->cfg accordingly.
993
 * cpu->cfg accordingly.
840
 */
994
 */
841
static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
995
void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
842
{
996
{
843
    CPURISCVState *env = &cpu->env;
997
    CPURISCVState *env = &cpu->env;
998
    Error *local_err = NULL;
844
999
845
    /* Do some ISA extension error checking */
1000
    /* Do some ISA extension error checking */
846
    if (riscv_has_ext(env, RVG) &&
1001
    if (riscv_has_ext(env, RVG) &&
Lines 853-859 static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) Link Here
853
        cpu->cfg.ext_ifencei = true;
1008
        cpu->cfg.ext_ifencei = true;
854
1009
855
        env->misa_ext |= RVI | RVM | RVA | RVF | RVD;
1010
        env->misa_ext |= RVI | RVM | RVA | RVF | RVD;
856
        env->misa_ext_mask = env->misa_ext;
1011
        env->misa_ext_mask |= RVI | RVM | RVA | RVF | RVD;
857
    }
1012
    }
858
1013
859
    if (riscv_has_ext(env, RVI) && riscv_has_ext(env, RVE)) {
1014
    if (riscv_has_ext(env, RVI) && riscv_has_ext(env, RVE)) {
Lines 909-916 static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) Link Here
909
        return;
1064
        return;
910
    }
1065
    }
911
1066
912
    /* The V vector extension depends on the Zve64d extension */
913
    if (riscv_has_ext(env, RVV)) {
1067
    if (riscv_has_ext(env, RVV)) {
1068
        riscv_cpu_validate_v(env, &cpu->cfg, &local_err);
1069
        if (local_err != NULL) {
1070
            error_propagate(errp, local_err);
1071
            return;
1072
        }
1073
1074
        /* The V vector extension depends on the Zve64d extension */
914
        cpu->cfg.ext_zve64d = true;
1075
        cpu->cfg.ext_zve64d = true;
915
    }
1076
    }
916
1077
Lines 1046-1090 static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) Link Here
1046
        cpu->cfg.ext_zksh = true;
1207
        cpu->cfg.ext_zksh = true;
1047
    }
1208
    }
1048
1209
1049
    if (riscv_has_ext(env, RVV)) {
1210
    /*
1050
        int vext_version = VEXT_VERSION_1_00_0;
1211
     * Disable isa extensions based on priv spec after we
1051
        if (!is_power_of_2(cpu->cfg.vlen)) {
1212
     * validated and set everything we need.
1052
            error_setg(errp,
1213
     */
1053
                       "Vector extension VLEN must be power of 2");
1214
    riscv_cpu_disable_priv_spec_isa_exts(cpu);
1054
            return;
1055
        }
1056
        if (cpu->cfg.vlen > RV_VLEN_MAX || cpu->cfg.vlen < 128) {
1057
            error_setg(errp,
1058
                       "Vector extension implementation only supports VLEN "
1059
                       "in the range [128, %d]", RV_VLEN_MAX);
1060
            return;
1061
        }
1062
        if (!is_power_of_2(cpu->cfg.elen)) {
1063
            error_setg(errp,
1064
                       "Vector extension ELEN must be power of 2");
1065
            return;
1066
        }
1067
        if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) {
1068
            error_setg(errp,
1069
                       "Vector extension implementation only supports ELEN "
1070
                       "in the range [8, 64]");
1071
            return;
1072
        }
1073
        if (cpu->cfg.vext_spec) {
1074
            if (!g_strcmp0(cpu->cfg.vext_spec, "v1.0")) {
1075
                vext_version = VEXT_VERSION_1_00_0;
1076
            } else {
1077
                error_setg(errp,
1078
                           "Unsupported vector spec version '%s'",
1079
                           cpu->cfg.vext_spec);
1080
                return;
1081
            }
1082
        } else {
1083
            qemu_log("vector version is not specified, "
1084
                     "use the default value v1.0\n");
1085
        }
1086
        set_vext_version(env, vext_version);
1087
    }
1088
}
1215
}
1089
1216
1090
#ifndef CONFIG_USER_ONLY
1217
#ifndef CONFIG_USER_ONLY
Lines 1183-1190 static void riscv_cpu_realize(DeviceState *dev, Error **errp) Link Here
1183
    RISCVCPU *cpu = RISCV_CPU(dev);
1310
    RISCVCPU *cpu = RISCV_CPU(dev);
1184
    CPURISCVState *env = &cpu->env;
1311
    CPURISCVState *env = &cpu->env;
1185
    RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(dev);
1312
    RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(dev);
1186
    CPUClass *cc = CPU_CLASS(mcc);
1187
    int i, priv_version = -1;
1188
    Error *local_err = NULL;
1313
    Error *local_err = NULL;
1189
1314
1190
    cpu_exec_realizefn(cs, &local_err);
1315
    cpu_exec_realizefn(cs, &local_err);
Lines 1193-1215 static void riscv_cpu_realize(DeviceState *dev, Error **errp) Link Here
1193
        return;
1318
        return;
1194
    }
1319
    }
1195
1320
1196
    if (cpu->cfg.priv_spec) {
1321
    riscv_cpu_validate_misa_mxl(cpu, &local_err);
1197
        if (!g_strcmp0(cpu->cfg.priv_spec, "v1.12.0")) {
1322
    if (local_err != NULL) {
1198
            priv_version = PRIV_VERSION_1_12_0;
1323
        error_propagate(errp, local_err);
1199
        } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.11.0")) {
1324
        return;
1200
            priv_version = PRIV_VERSION_1_11_0;
1201
        } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.10.0")) {
1202
            priv_version = PRIV_VERSION_1_10_0;
1203
        } else {
1204
            error_setg(errp,
1205
                       "Unsupported privilege spec version '%s'",
1206
                       cpu->cfg.priv_spec);
1207
            return;
1208
        }
1209
    }
1325
    }
1210
1326
1211
    if (priv_version >= PRIV_VERSION_1_10_0) {
1327
    riscv_cpu_validate_priv_spec(cpu, &local_err);
1212
        set_priv_version(env, priv_version);
1328
    if (local_err != NULL) {
1329
        error_propagate(errp, local_err);
1330
        return;
1213
    }
1331
    }
1214
1332
1215
    riscv_cpu_validate_misa_priv(env, &local_err);
1333
    riscv_cpu_validate_misa_priv(env, &local_err);
Lines 1218-1240 static void riscv_cpu_realize(DeviceState *dev, Error **errp) Link Here
1218
        return;
1336
        return;
1219
    }
1337
    }
1220
1338
1221
    /* Force disable extensions if priv spec version does not match */
1222
    for (i = 0; i < ARRAY_SIZE(isa_edata_arr); i++) {
1223
        if (isa_ext_is_enabled(cpu, &isa_edata_arr[i]) &&
1224
            (env->priv_ver < isa_edata_arr[i].min_version)) {
1225
            isa_ext_update_enabled(cpu, &isa_edata_arr[i], false);
1226
#ifndef CONFIG_USER_ONLY
1227
            warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx
1228
                        " because privilege spec version does not match",
1229
                        isa_edata_arr[i].name, env->mhartid);
1230
#else
1231
            warn_report("disabling %s extension because "
1232
                        "privilege spec version does not match",
1233
                        isa_edata_arr[i].name);
1234
#endif
1235
        }
1236
    }
1237
1238
    if (cpu->cfg.epmp && !cpu->cfg.pmp) {
1339
    if (cpu->cfg.epmp && !cpu->cfg.pmp) {
1239
        /*
1340
        /*
1240
         * Enhanced PMP should only be available
1341
         * Enhanced PMP should only be available
Lines 1244-1272 static void riscv_cpu_realize(DeviceState *dev, Error **errp) Link Here
1244
        return;
1345
        return;
1245
    }
1346
    }
1246
1347
1247
1248
#ifndef CONFIG_USER_ONLY
1249
    if (cpu->cfg.ext_sstc) {
1250
        riscv_timer_init(cpu);
1251
    }
1252
#endif /* CONFIG_USER_ONLY */
1253
1254
    /* Validate that MISA_MXL is set properly. */
1255
    switch (env->misa_mxl_max) {
1256
#ifdef TARGET_RISCV64
1257
    case MXL_RV64:
1258
    case MXL_RV128:
1259
        cc->gdb_core_xml_file = "riscv-64bit-cpu.xml";
1260
        break;
1261
#endif
1262
    case MXL_RV32:
1263
        cc->gdb_core_xml_file = "riscv-32bit-cpu.xml";
1264
        break;
1265
    default:
1266
        g_assert_not_reached();
1267
    }
1268
    assert(env->misa_mxl_max == env->misa_mxl);
1269
1270
    riscv_cpu_validate_set_extensions(cpu, &local_err);
1348
    riscv_cpu_validate_set_extensions(cpu, &local_err);
1271
    if (local_err != NULL) {
1349
    if (local_err != NULL) {
1272
        error_propagate(errp, local_err);
1350
        error_propagate(errp, local_err);
Lines 1274-1279 static void riscv_cpu_realize(DeviceState *dev, Error **errp) Link Here
1274
    }
1352
    }
1275
1353
1276
#ifndef CONFIG_USER_ONLY
1354
#ifndef CONFIG_USER_ONLY
1355
    cs->tcg_cflags |= CF_PCREL;
1356
1357
    if (cpu->cfg.ext_sstc) {
1358
        riscv_timer_init(cpu);
1359
    }
1360
1277
    if (cpu->cfg.pmu_num) {
1361
    if (cpu->cfg.pmu_num) {
1278
        if (!riscv_pmu_init(cpu, cpu->cfg.pmu_num) && cpu->cfg.ext_sscofpmf) {
1362
        if (!riscv_pmu_init(cpu, cpu->cfg.pmu_num) && cpu->cfg.ext_sscofpmf) {
1279
            cpu->pmu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
1363
            cpu->pmu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
Lines 1410-1420 static void riscv_cpu_init(Object *obj) Link Here
1410
{
1494
{
1411
    RISCVCPU *cpu = RISCV_CPU(obj);
1495
    RISCVCPU *cpu = RISCV_CPU(obj);
1412
1496
1413
    cpu->cfg.ext_ifencei = true;
1414
    cpu->cfg.ext_icsr = true;
1415
    cpu->cfg.mmu = true;
1416
    cpu->cfg.pmp = true;
1417
1418
    cpu_set_cpustate_pointers(cpu);
1497
    cpu_set_cpustate_pointers(cpu);
1419
1498
1420
#ifndef CONFIG_USER_ONLY
1499
#ifndef CONFIG_USER_ONLY
Lines 1535-1542 static Property riscv_cpu_extensions[] = { Link Here
1535
    DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128),
1614
    DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128),
1536
    DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
1615
    DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
1537
1616
1617
    DEFINE_PROP_BOOL("smstateen", RISCVCPU, cfg.ext_smstateen, false),
1538
    DEFINE_PROP_BOOL("svadu", RISCVCPU, cfg.ext_svadu, true),
1618
    DEFINE_PROP_BOOL("svadu", RISCVCPU, cfg.ext_svadu, true),
1539
1540
    DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false),
1619
    DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false),
1541
    DEFINE_PROP_BOOL("svnapot", RISCVCPU, cfg.ext_svnapot, false),
1620
    DEFINE_PROP_BOOL("svnapot", RISCVCPU, cfg.ext_svnapot, false),
1542
    DEFINE_PROP_BOOL("svpbmt", RISCVCPU, cfg.ext_svpbmt, false),
1621
    DEFINE_PROP_BOOL("svpbmt", RISCVCPU, cfg.ext_svpbmt, false),
Lines 1571-1576 static Property riscv_cpu_extensions[] = { Link Here
1571
1650
1572
    DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
1651
    DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
1573
1652
1653
    DEFINE_PROP_BOOL("zca", RISCVCPU, cfg.ext_zca, false),
1654
    DEFINE_PROP_BOOL("zcb", RISCVCPU, cfg.ext_zcb, false),
1655
    DEFINE_PROP_BOOL("zcd", RISCVCPU, cfg.ext_zcd, false),
1656
    DEFINE_PROP_BOOL("zce", RISCVCPU, cfg.ext_zce, false),
1657
    DEFINE_PROP_BOOL("zcf", RISCVCPU, cfg.ext_zcf, false),
1658
    DEFINE_PROP_BOOL("zcmp", RISCVCPU, cfg.ext_zcmp, false),
1659
    DEFINE_PROP_BOOL("zcmt", RISCVCPU, cfg.ext_zcmt, false),
1660
1574
    /* Vendor-specific custom extensions */
1661
    /* Vendor-specific custom extensions */
1575
    DEFINE_PROP_BOOL("xtheadba", RISCVCPU, cfg.ext_xtheadba, false),
1662
    DEFINE_PROP_BOOL("xtheadba", RISCVCPU, cfg.ext_xtheadba, false),
1576
    DEFINE_PROP_BOOL("xtheadbb", RISCVCPU, cfg.ext_xtheadbb, false),
1663
    DEFINE_PROP_BOOL("xtheadbb", RISCVCPU, cfg.ext_xtheadbb, false),
Lines 1588-1601 static Property riscv_cpu_extensions[] = { Link Here
1588
    /* These are experimental so mark with 'x-' */
1675
    /* These are experimental so mark with 'x-' */
1589
    DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false),
1676
    DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false),
1590
1677
1591
    DEFINE_PROP_BOOL("x-zca", RISCVCPU, cfg.ext_zca, false),
1592
    DEFINE_PROP_BOOL("x-zcb", RISCVCPU, cfg.ext_zcb, false),
1593
    DEFINE_PROP_BOOL("x-zcd", RISCVCPU, cfg.ext_zcd, false),
1594
    DEFINE_PROP_BOOL("x-zce", RISCVCPU, cfg.ext_zce, false),
1595
    DEFINE_PROP_BOOL("x-zcf", RISCVCPU, cfg.ext_zcf, false),
1596
    DEFINE_PROP_BOOL("x-zcmp", RISCVCPU, cfg.ext_zcmp, false),
1597
    DEFINE_PROP_BOOL("x-zcmt", RISCVCPU, cfg.ext_zcmt, false),
1598
1599
    /* ePMP 0.9.3 */
1678
    /* ePMP 0.9.3 */
1600
    DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
1679
    DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
1601
    DEFINE_PROP_BOOL("x-smaia", RISCVCPU, cfg.ext_smaia, false),
1680
    DEFINE_PROP_BOOL("x-smaia", RISCVCPU, cfg.ext_smaia, false),
Lines 1761-1767 static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str, Link Here
1761
    int i;
1840
    int i;
1762
1841
1763
    for (i = 0; i < ARRAY_SIZE(isa_edata_arr); i++) {
1842
    for (i = 0; i < ARRAY_SIZE(isa_edata_arr); i++) {
1764
        if (isa_ext_is_enabled(cpu, &isa_edata_arr[i])) {
1843
        if (cpu->env.priv_ver >= isa_edata_arr[i].min_version &&
1844
            isa_ext_is_enabled(cpu, &isa_edata_arr[i])) {
1765
            new = g_strconcat(old, "_", isa_edata_arr[i].name, NULL);
1845
            new = g_strconcat(old, "_", isa_edata_arr[i].name, NULL);
1766
            g_free(old);
1846
            g_free(old);
1767
            old = new;
1847
            old = new;
(-)a/target/riscv/cpu.h (-113 / +4 lines)
Lines 27-32 Link Here
27
#include "qom/object.h"
27
#include "qom/object.h"
28
#include "qemu/int128.h"
28
#include "qemu/int128.h"
29
#include "cpu_bits.h"
29
#include "cpu_bits.h"
30
#include "cpu_cfg.h"
30
#include "qapi/qapi-types-common.h"
31
#include "qapi/qapi-types-common.h"
31
#include "cpu-qom.h"
32
#include "cpu-qom.h"
32
33
Lines 61-66 enum { Link Here
61
    PRIV_VERSION_1_10_0 = 0,
62
    PRIV_VERSION_1_10_0 = 0,
62
    PRIV_VERSION_1_11_0,
63
    PRIV_VERSION_1_11_0,
63
    PRIV_VERSION_1_12_0,
64
    PRIV_VERSION_1_12_0,
65
66
    PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
64
};
67
};
65
68
66
#define VEXT_VERSION_1_00_0 0x00010000
69
#define VEXT_VERSION_1_00_0 0x00010000
Lines 368-486 struct CPUArchState { Link Here
368
    uint64_t kvm_timer_frequency;
371
    uint64_t kvm_timer_frequency;
369
};
372
};
370
373
371
/*
372
 * map is a 16-bit bitmap: the most significant set bit in map is the maximum
373
 * satp mode that is supported. It may be chosen by the user and must respect
374
 * what qemu implements (valid_1_10_32/64) and what the hw is capable of
375
 * (supported bitmap below).
376
 *
377
 * init is a 16-bit bitmap used to make sure the user selected a correct
378
 * configuration as per the specification.
379
 *
380
 * supported is a 16-bit bitmap used to reflect the hw capabilities.
381
 */
382
typedef struct {
383
    uint16_t map, init, supported;
384
} RISCVSATPMap;
385
386
struct RISCVCPUConfig {
387
    bool ext_zba;
388
    bool ext_zbb;
389
    bool ext_zbc;
390
    bool ext_zbkb;
391
    bool ext_zbkc;
392
    bool ext_zbkx;
393
    bool ext_zbs;
394
    bool ext_zca;
395
    bool ext_zcb;
396
    bool ext_zcd;
397
    bool ext_zce;
398
    bool ext_zcf;
399
    bool ext_zcmp;
400
    bool ext_zcmt;
401
    bool ext_zk;
402
    bool ext_zkn;
403
    bool ext_zknd;
404
    bool ext_zkne;
405
    bool ext_zknh;
406
    bool ext_zkr;
407
    bool ext_zks;
408
    bool ext_zksed;
409
    bool ext_zksh;
410
    bool ext_zkt;
411
    bool ext_ifencei;
412
    bool ext_icsr;
413
    bool ext_icbom;
414
    bool ext_icboz;
415
    bool ext_zicond;
416
    bool ext_zihintpause;
417
    bool ext_smstateen;
418
    bool ext_sstc;
419
    bool ext_svadu;
420
    bool ext_svinval;
421
    bool ext_svnapot;
422
    bool ext_svpbmt;
423
    bool ext_zdinx;
424
    bool ext_zawrs;
425
    bool ext_zfh;
426
    bool ext_zfhmin;
427
    bool ext_zfinx;
428
    bool ext_zhinx;
429
    bool ext_zhinxmin;
430
    bool ext_zve32f;
431
    bool ext_zve64f;
432
    bool ext_zve64d;
433
    bool ext_zmmul;
434
    bool ext_zvfh;
435
    bool ext_zvfhmin;
436
    bool ext_smaia;
437
    bool ext_ssaia;
438
    bool ext_sscofpmf;
439
    bool rvv_ta_all_1s;
440
    bool rvv_ma_all_1s;
441
442
    uint32_t mvendorid;
443
    uint64_t marchid;
444
    uint64_t mimpid;
445
446
    /* Vendor-specific custom extensions */
447
    bool ext_xtheadba;
448
    bool ext_xtheadbb;
449
    bool ext_xtheadbs;
450
    bool ext_xtheadcmo;
451
    bool ext_xtheadcondmov;
452
    bool ext_xtheadfmemidx;
453
    bool ext_xtheadfmv;
454
    bool ext_xtheadmac;
455
    bool ext_xtheadmemidx;
456
    bool ext_xtheadmempair;
457
    bool ext_xtheadsync;
458
    bool ext_XVentanaCondOps;
459
460
    uint8_t pmu_num;
461
    char *priv_spec;
462
    char *user_spec;
463
    char *bext_spec;
464
    char *vext_spec;
465
    uint16_t vlen;
466
    uint16_t elen;
467
    uint16_t cbom_blocksize;
468
    uint16_t cboz_blocksize;
469
    bool mmu;
470
    bool pmp;
471
    bool epmp;
472
    bool debug;
473
    bool misa_w;
474
475
    bool short_isa_string;
476
477
#ifndef CONFIG_USER_ONLY
478
    RISCVSATPMap satp_mode;
479
#endif
480
};
481
482
typedef struct RISCVCPUConfig RISCVCPUConfig;
483
484
/*
374
/*
485
 * RISCVCPU:
375
 * RISCVCPU:
486
 * @env: #CPURISCVState
376
 * @env: #CPURISCVState
Lines 546-551 bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, Link Here
546
                        bool probe, uintptr_t retaddr);
436
                        bool probe, uintptr_t retaddr);
547
char *riscv_isa_string(RISCVCPU *cpu);
437
char *riscv_isa_string(RISCVCPU *cpu);
548
void riscv_cpu_list(void);
438
void riscv_cpu_list(void);
439
void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp);
549
440
550
#define cpu_list riscv_cpu_list
441
#define cpu_list riscv_cpu_list
551
#define cpu_mmu_index riscv_cpu_mmu_index
442
#define cpu_mmu_index riscv_cpu_mmu_index
(-)a/target/riscv/cpu_cfg.h (+136 lines)
Line 0 Link Here
1
/*
2
 * QEMU RISC-V CPU CFG
3
 *
4
 * Copyright (c) 2016-2017 Sagar Karandikar, sagark@eecs.berkeley.edu
5
 * Copyright (c) 2017-2018 SiFive, Inc.
6
 * Copyright (c) 2021-2023 PLCT Lab
7
 *
8
 * This program is free software; you can redistribute it and/or modify it
9
 * under the terms and conditions of the GNU General Public License,
10
 * version 2 or later, as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope it will be useful, but WITHOUT
13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15
 * more details.
16
 *
17
 * You should have received a copy of the GNU General Public License along with
18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef RISCV_CPU_CFG_H
22
#define RISCV_CPU_CFG_H
23
24
/*
25
 * map is a 16-bit bitmap: the most significant set bit in map is the maximum
26
 * satp mode that is supported. It may be chosen by the user and must respect
27
 * what qemu implements (valid_1_10_32/64) and what the hw is capable of
28
 * (supported bitmap below).
29
 *
30
 * init is a 16-bit bitmap used to make sure the user selected a correct
31
 * configuration as per the specification.
32
 *
33
 * supported is a 16-bit bitmap used to reflect the hw capabilities.
34
 */
35
typedef struct {
36
    uint16_t map, init, supported;
37
} RISCVSATPMap;
38
39
struct RISCVCPUConfig {
40
    bool ext_zba;
41
    bool ext_zbb;
42
    bool ext_zbc;
43
    bool ext_zbkb;
44
    bool ext_zbkc;
45
    bool ext_zbkx;
46
    bool ext_zbs;
47
    bool ext_zca;
48
    bool ext_zcb;
49
    bool ext_zcd;
50
    bool ext_zce;
51
    bool ext_zcf;
52
    bool ext_zcmp;
53
    bool ext_zcmt;
54
    bool ext_zk;
55
    bool ext_zkn;
56
    bool ext_zknd;
57
    bool ext_zkne;
58
    bool ext_zknh;
59
    bool ext_zkr;
60
    bool ext_zks;
61
    bool ext_zksed;
62
    bool ext_zksh;
63
    bool ext_zkt;
64
    bool ext_ifencei;
65
    bool ext_icsr;
66
    bool ext_icbom;
67
    bool ext_icboz;
68
    bool ext_zicond;
69
    bool ext_zihintpause;
70
    bool ext_smstateen;
71
    bool ext_sstc;
72
    bool ext_svadu;
73
    bool ext_svinval;
74
    bool ext_svnapot;
75
    bool ext_svpbmt;
76
    bool ext_zdinx;
77
    bool ext_zawrs;
78
    bool ext_zfh;
79
    bool ext_zfhmin;
80
    bool ext_zfinx;
81
    bool ext_zhinx;
82
    bool ext_zhinxmin;
83
    bool ext_zve32f;
84
    bool ext_zve64f;
85
    bool ext_zve64d;
86
    bool ext_zmmul;
87
    bool ext_zvfh;
88
    bool ext_zvfhmin;
89
    bool ext_smaia;
90
    bool ext_ssaia;
91
    bool ext_sscofpmf;
92
    bool rvv_ta_all_1s;
93
    bool rvv_ma_all_1s;
94
95
    uint32_t mvendorid;
96
    uint64_t marchid;
97
    uint64_t mimpid;
98
99
    /* Vendor-specific custom extensions */
100
    bool ext_xtheadba;
101
    bool ext_xtheadbb;
102
    bool ext_xtheadbs;
103
    bool ext_xtheadcmo;
104
    bool ext_xtheadcondmov;
105
    bool ext_xtheadfmemidx;
106
    bool ext_xtheadfmv;
107
    bool ext_xtheadmac;
108
    bool ext_xtheadmemidx;
109
    bool ext_xtheadmempair;
110
    bool ext_xtheadsync;
111
    bool ext_XVentanaCondOps;
112
113
    uint8_t pmu_num;
114
    char *priv_spec;
115
    char *user_spec;
116
    char *bext_spec;
117
    char *vext_spec;
118
    uint16_t vlen;
119
    uint16_t elen;
120
    uint16_t cbom_blocksize;
121
    uint16_t cboz_blocksize;
122
    bool mmu;
123
    bool pmp;
124
    bool epmp;
125
    bool debug;
126
    bool misa_w;
127
128
    bool short_isa_string;
129
130
#ifndef CONFIG_USER_ONLY
131
    RISCVSATPMap satp_mode;
132
#endif
133
};
134
135
typedef struct RISCVCPUConfig RISCVCPUConfig;
136
#endif
(-)a/target/riscv/cpu_helper.c (-19 / +18 lines)
Lines 120-125 void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, Link Here
120
        vs = MIN(vs, get_field(env->mstatus_hs, MSTATUS_VS));
120
        vs = MIN(vs, get_field(env->mstatus_hs, MSTATUS_VS));
121
    }
121
    }
122
122
123
    /* With Zfinx, floating point is enabled/disabled by Smstateen. */
124
    if (!riscv_has_ext(env, RVF)) {
125
        fs = (smstateen_acc_ok(env, 0, SMSTATEEN0_FCSR) == RISCV_EXCP_NONE)
126
             ? EXT_STATUS_DIRTY : EXT_STATUS_DISABLED;
127
    }
128
123
    if (cpu->cfg.debug && !icount_enabled()) {
129
    if (cpu->cfg.debug && !icount_enabled()) {
124
        flags = FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enabled);
130
        flags = FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enabled);
125
    }
131
    }
Lines 128-134 void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, Link Here
128
    flags = FIELD_DP32(flags, TB_FLAGS, FS, fs);
134
    flags = FIELD_DP32(flags, TB_FLAGS, FS, fs);
129
    flags = FIELD_DP32(flags, TB_FLAGS, VS, vs);
135
    flags = FIELD_DP32(flags, TB_FLAGS, VS, vs);
130
    flags = FIELD_DP32(flags, TB_FLAGS, XL, env->xl);
136
    flags = FIELD_DP32(flags, TB_FLAGS, XL, env->xl);
131
    if (env->cur_pmmask < (env->xl == MXL_RV32 ? UINT32_MAX : UINT64_MAX)) {
137
    if (env->cur_pmmask != 0) {
132
        flags = FIELD_DP32(flags, TB_FLAGS, PM_MASK_ENABLED, 1);
138
        flags = FIELD_DP32(flags, TB_FLAGS, PM_MASK_ENABLED, 1);
133
    }
139
    }
134
    if (env->cur_pmbase != 0) {
140
    if (env->cur_pmbase != 0) {
Lines 140-146 void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, Link Here
140
146
141
void riscv_cpu_update_mask(CPURISCVState *env)
147
void riscv_cpu_update_mask(CPURISCVState *env)
142
{
148
{
143
    target_ulong mask = -1, base = 0;
149
    target_ulong mask = 0, base = 0;
144
    /*
150
    /*
145
     * TODO: Current RVJ spec does not specify
151
     * TODO: Current RVJ spec does not specify
146
     * how the extension interacts with XLEN.
152
     * how the extension interacts with XLEN.
Lines 688-726 void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv) Link Here
688
 *
694
 *
689
 * @env: CPURISCVState
695
 * @env: CPURISCVState
690
 * @prot: The returned protection attributes
696
 * @prot: The returned protection attributes
691
 * @tlb_size: TLB page size containing addr. It could be modified after PMP
692
 *            permission checking. NULL if not set TLB page for addr.
693
 * @addr: The physical address to be checked permission
697
 * @addr: The physical address to be checked permission
694
 * @access_type: The type of MMU access
698
 * @access_type: The type of MMU access
695
 * @mode: Indicates current privilege level.
699
 * @mode: Indicates current privilege level.
696
 */
700
 */
697
static int get_physical_address_pmp(CPURISCVState *env, int *prot,
701
static int get_physical_address_pmp(CPURISCVState *env, int *prot, hwaddr addr,
698
                                    target_ulong *tlb_size, hwaddr addr,
699
                                    int size, MMUAccessType access_type,
702
                                    int size, MMUAccessType access_type,
700
                                    int mode)
703
                                    int mode)
701
{
704
{
702
    pmp_priv_t pmp_priv;
705
    pmp_priv_t pmp_priv;
703
    int pmp_index = -1;
706
    bool pmp_has_privs;
704
707
705
    if (!riscv_cpu_cfg(env)->pmp) {
708
    if (!riscv_cpu_cfg(env)->pmp) {
706
        *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
709
        *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
707
        return TRANSLATE_SUCCESS;
710
        return TRANSLATE_SUCCESS;
708
    }
711
    }
709
712
710
    pmp_index = pmp_hart_has_privs(env, addr, size, 1 << access_type,
713
    pmp_has_privs = pmp_hart_has_privs(env, addr, size, 1 << access_type,
711
                                   &pmp_priv, mode);
714
                                       &pmp_priv, mode);
712
    if (pmp_index < 0) {
715
    if (!pmp_has_privs) {
713
        *prot = 0;
716
        *prot = 0;
714
        return TRANSLATE_PMP_FAIL;
717
        return TRANSLATE_PMP_FAIL;
715
    }
718
    }
716
719
717
    *prot = pmp_priv_to_page_prot(pmp_priv);
720
    *prot = pmp_priv_to_page_prot(pmp_priv);
718
    if ((tlb_size != NULL) && pmp_index != MAX_RISCV_PMPS) {
719
        target_ulong tlb_sa = addr & ~(TARGET_PAGE_SIZE - 1);
720
        target_ulong tlb_ea = tlb_sa + TARGET_PAGE_SIZE - 1;
721
722
        *tlb_size = pmp_get_tlb_size(env, pmp_index, tlb_sa, tlb_ea);
723
    }
724
721
725
    return TRANSLATE_SUCCESS;
722
    return TRANSLATE_SUCCESS;
726
}
723
}
Lines 909-915 restart: Link Here
909
        }
906
        }
910
907
911
        int pmp_prot;
908
        int pmp_prot;
912
        int pmp_ret = get_physical_address_pmp(env, &pmp_prot, NULL, pte_addr,
909
        int pmp_ret = get_physical_address_pmp(env, &pmp_prot, pte_addr,
913
                                               sizeof(target_ulong),
910
                                               sizeof(target_ulong),
914
                                               MMU_DATA_LOAD, PRV_S);
911
                                               MMU_DATA_LOAD, PRV_S);
915
        if (pmp_ret != TRANSLATE_SUCCESS) {
912
        if (pmp_ret != TRANSLATE_SUCCESS) {
Lines 1305-1312 bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, Link Here
1305
            prot &= prot2;
1302
            prot &= prot2;
1306
1303
1307
            if (ret == TRANSLATE_SUCCESS) {
1304
            if (ret == TRANSLATE_SUCCESS) {
1308
                ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
1305
                ret = get_physical_address_pmp(env, &prot_pmp, pa,
1309
                                               size, access_type, mode);
1306
                                               size, access_type, mode);
1307
                tlb_size = pmp_get_tlb_size(env, pa);
1310
1308
1311
                qemu_log_mask(CPU_LOG_MMU,
1309
                qemu_log_mask(CPU_LOG_MMU,
1312
                              "%s PMP address=" HWADDR_FMT_plx " ret %d prot"
1310
                              "%s PMP address=" HWADDR_FMT_plx " ret %d prot"
Lines 1338-1345 bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, Link Here
1338
                      __func__, address, ret, pa, prot);
1336
                      __func__, address, ret, pa, prot);
1339
1337
1340
        if (ret == TRANSLATE_SUCCESS) {
1338
        if (ret == TRANSLATE_SUCCESS) {
1341
            ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
1339
            ret = get_physical_address_pmp(env, &prot_pmp, pa,
1342
                                           size, access_type, mode);
1340
                                           size, access_type, mode);
1341
            tlb_size = pmp_get_tlb_size(env, pa);
1343
1342
1344
            qemu_log_mask(CPU_LOG_MMU,
1343
            qemu_log_mask(CPU_LOG_MMU,
1345
                          "%s PMP address=" HWADDR_FMT_plx " ret %d prot"
1344
                          "%s PMP address=" HWADDR_FMT_plx " ret %d prot"
(-)a/target/riscv/csr.c (-28 / +47 lines)
Lines 82-87 static RISCVException fs(CPURISCVState *env, int csrno) Link Here
82
        !riscv_cpu_cfg(env)->ext_zfinx) {
82
        !riscv_cpu_cfg(env)->ext_zfinx) {
83
        return RISCV_EXCP_ILLEGAL_INST;
83
        return RISCV_EXCP_ILLEGAL_INST;
84
    }
84
    }
85
86
    if (!env->debugger && !riscv_cpu_fp_enabled(env)) {
87
        return smstateen_acc_ok(env, 0, SMSTATEEN0_FCSR);
88
    }
85
#endif
89
#endif
86
    return RISCV_EXCP_NONE;
90
    return RISCV_EXCP_NONE;
87
}
91
}
Lines 1324-1331 static RISCVException write_mstatus(CPURISCVState *env, int csrno, Link Here
1324
        mstatus = set_field(mstatus, MSTATUS64_SXL, xl);
1328
        mstatus = set_field(mstatus, MSTATUS64_SXL, xl);
1325
    }
1329
    }
1326
    env->mstatus = mstatus;
1330
    env->mstatus = mstatus;
1327
    env->xl = cpu_recompute_xl(env);
1328
1331
1332
    /*
1333
     * Except in debug mode, UXL/SXL can only be modified by higher
1334
     * privilege mode. So xl will not be changed in normal mode.
1335
     */
1336
    if (env->debugger) {
1337
        env->xl = cpu_recompute_xl(env);
1338
        riscv_cpu_update_mask(env);
1339
    }
1329
    return RISCV_EXCP_NONE;
1340
    return RISCV_EXCP_NONE;
1330
}
1341
}
1331
1342
Lines 1387-1425 static RISCVException read_misa(CPURISCVState *env, int csrno, Link Here
1387
static RISCVException write_misa(CPURISCVState *env, int csrno,
1398
static RISCVException write_misa(CPURISCVState *env, int csrno,
1388
                                 target_ulong val)
1399
                                 target_ulong val)
1389
{
1400
{
1401
    RISCVCPU *cpu = env_archcpu(env);
1402
    uint32_t orig_misa_ext = env->misa_ext;
1403
    Error *local_err = NULL;
1404
1390
    if (!riscv_cpu_cfg(env)->misa_w) {
1405
    if (!riscv_cpu_cfg(env)->misa_w) {
1391
        /* drop write to misa */
1406
        /* drop write to misa */
1392
        return RISCV_EXCP_NONE;
1407
        return RISCV_EXCP_NONE;
1393
    }
1408
    }
1394
1409
1395
    /* 'I' or 'E' must be present */
1396
    if (!(val & (RVI | RVE))) {
1397
        /* It is not, drop write to misa */
1398
        return RISCV_EXCP_NONE;
1399
    }
1400
1401
    /* 'E' excludes all other extensions */
1402
    if (val & RVE) {
1403
        /*
1404
         * when we support 'E' we can do "val = RVE;" however
1405
         * for now we just drop writes if 'E' is present.
1406
         */
1407
        return RISCV_EXCP_NONE;
1408
    }
1409
1410
    /*
1411
     * misa.MXL writes are not supported by QEMU.
1412
     * Drop writes to those bits.
1413
     */
1414
1415
    /* Mask extensions that are not supported by this hart */
1410
    /* Mask extensions that are not supported by this hart */
1416
    val &= env->misa_ext_mask;
1411
    val &= env->misa_ext_mask;
1417
1412
1418
    /* 'D' depends on 'F', so clear 'D' if 'F' is not present */
1419
    if ((val & RVD) && !(val & RVF)) {
1420
        val &= ~RVD;
1421
    }
1422
1423
    /*
1413
    /*
1424
     * Suppress 'C' if next instruction is not aligned
1414
     * Suppress 'C' if next instruction is not aligned
1425
     * TODO: this should check next_pc
1415
     * TODO: this should check next_pc
Lines 1428-1445 static RISCVException write_misa(CPURISCVState *env, int csrno, Link Here
1428
        val &= ~RVC;
1418
        val &= ~RVC;
1429
    }
1419
    }
1430
1420
1421
    /* Disable RVG if any of its dependencies are disabled */
1422
    if (!(val & RVI && val & RVM && val & RVA &&
1423
          val & RVF && val & RVD)) {
1424
        val &= ~RVG;
1425
    }
1426
1431
    /* If nothing changed, do nothing. */
1427
    /* If nothing changed, do nothing. */
1432
    if (val == env->misa_ext) {
1428
    if (val == env->misa_ext) {
1433
        return RISCV_EXCP_NONE;
1429
        return RISCV_EXCP_NONE;
1434
    }
1430
    }
1435
1431
1436
    if (!(val & RVF)) {
1432
    env->misa_ext = val;
1433
    riscv_cpu_validate_set_extensions(cpu, &local_err);
1434
    if (local_err != NULL) {
1435
        /* Rollback on validation error */
1436
        qemu_log_mask(LOG_GUEST_ERROR, "Unable to write MISA ext value "
1437
                      "0x%x, keeping existing MISA ext 0x%x\n",
1438
                      env->misa_ext, orig_misa_ext);
1439
1440
        env->misa_ext = orig_misa_ext;
1441
1442
        return RISCV_EXCP_NONE;
1443
    }
1444
1445
    if (!(env->misa_ext & RVF)) {
1437
        env->mstatus &= ~MSTATUS_FS;
1446
        env->mstatus &= ~MSTATUS_FS;
1438
    }
1447
    }
1439
1448
1440
    /* flush translation cache */
1449
    /* flush translation cache */
1441
    tb_flush(env_cpu(env));
1450
    tb_flush(env_cpu(env));
1442
    env->misa_ext = val;
1443
    env->xl = riscv_cpu_mxl(env);
1451
    env->xl = riscv_cpu_mxl(env);
1444
    return RISCV_EXCP_NONE;
1452
    return RISCV_EXCP_NONE;
1445
}
1453
}
Lines 2100-2105 static RISCVException write_mstateen0(CPURISCVState *env, int csrno, Link Here
2100
                                      target_ulong new_val)
2108
                                      target_ulong new_val)
2101
{
2109
{
2102
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2110
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2111
    if (!riscv_has_ext(env, RVF)) {
2112
        wr_mask |= SMSTATEEN0_FCSR;
2113
    }
2103
2114
2104
    return write_mstateen(env, csrno, wr_mask, new_val);
2115
    return write_mstateen(env, csrno, wr_mask, new_val);
2105
}
2116
}
Lines 2173-2178 static RISCVException write_hstateen0(CPURISCVState *env, int csrno, Link Here
2173
{
2184
{
2174
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2185
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2175
2186
2187
    if (!riscv_has_ext(env, RVF)) {
2188
        wr_mask |= SMSTATEEN0_FCSR;
2189
    }
2190
2176
    return write_hstateen(env, csrno, wr_mask, new_val);
2191
    return write_hstateen(env, csrno, wr_mask, new_val);
2177
}
2192
}
2178
2193
Lines 2259-2264 static RISCVException write_sstateen0(CPURISCVState *env, int csrno, Link Here
2259
{
2274
{
2260
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2275
    uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
2261
2276
2277
    if (!riscv_has_ext(env, RVF)) {
2278
        wr_mask |= SMSTATEEN0_FCSR;
2279
    }
2280
2262
    return write_sstateen(env, csrno, wr_mask, new_val);
2281
    return write_sstateen(env, csrno, wr_mask, new_val);
2263
}
2282
}
2264
2283
(-)a/target/riscv/insn_trans/trans_privileged.c.inc (-1 / +1 lines)
Lines 108-114 static bool trans_wfi(DisasContext *ctx, arg_wfi *a) Link Here
108
{
108
{
109
#ifndef CONFIG_USER_ONLY
109
#ifndef CONFIG_USER_ONLY
110
    decode_save_opc(ctx);
110
    decode_save_opc(ctx);
111
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
111
    gen_update_pc(ctx, ctx->cur_insn_len);
112
    gen_helper_wfi(cpu_env);
112
    gen_helper_wfi(cpu_env);
113
    return true;
113
    return true;
114
#else
114
#else
(-)a/target/riscv/insn_trans/trans_rvd.c.inc (-5 / +7 lines)
Lines 31-39 Link Here
31
    } \
31
    } \
32
} while (0)
32
} while (0)
33
33
34
#define REQUIRE_ZCD(ctx) do { \
34
#define REQUIRE_ZCD_OR_DC(ctx) do { \
35
    if (!ctx->cfg_ptr->ext_zcd) {  \
35
    if (!ctx->cfg_ptr->ext_zcd) { \
36
        return false;     \
36
        if (!has_ext(ctx, RVD) || !has_ext(ctx, RVC)) { \
37
            return false; \
38
        } \
37
    } \
39
    } \
38
} while (0)
40
} while (0)
39
41
Lines 67-79 static bool trans_fsd(DisasContext *ctx, arg_fsd *a) Link Here
67
69
68
static bool trans_c_fld(DisasContext *ctx, arg_fld *a)
70
static bool trans_c_fld(DisasContext *ctx, arg_fld *a)
69
{
71
{
70
    REQUIRE_ZCD(ctx);
72
    REQUIRE_ZCD_OR_DC(ctx);
71
    return trans_fld(ctx, a);
73
    return trans_fld(ctx, a);
72
}
74
}
73
75
74
static bool trans_c_fsd(DisasContext *ctx, arg_fsd *a)
76
static bool trans_c_fsd(DisasContext *ctx, arg_fsd *a)
75
{
77
{
76
    REQUIRE_ZCD(ctx);
78
    REQUIRE_ZCD_OR_DC(ctx);
77
    return trans_fsd(ctx, a);
79
    return trans_fsd(ctx, a);
78
}
80
}
79
81
(-)a/target/riscv/insn_trans/trans_rvf.c.inc (-9 / +12 lines)
Lines 19-27 Link Here
19
 */
19
 */
20
20
21
#define REQUIRE_FPU do {\
21
#define REQUIRE_FPU do {\
22
    if (ctx->mstatus_fs == EXT_STATUS_DISABLED) \
22
    if (ctx->mstatus_fs == EXT_STATUS_DISABLED) {                           \
23
        if (!ctx->cfg_ptr->ext_zfinx) \
23
        ctx->virt_inst_excp = ctx->virt_enabled && ctx->cfg_ptr->ext_zfinx; \
24
            return false; \
24
        return false;                                                       \
25
    }                                                                       \
25
} while (0)
26
} while (0)
26
27
27
#define REQUIRE_ZFINX_OR_F(ctx) do {\
28
#define REQUIRE_ZFINX_OR_F(ctx) do {\
Lines 30-39 Link Here
30
    } \
31
    } \
31
} while (0)
32
} while (0)
32
33
33
#define REQUIRE_ZCF(ctx) do {                  \
34
#define REQUIRE_ZCF_OR_FC(ctx) do {                     \
34
    if (!ctx->cfg_ptr->ext_zcf) {              \
35
    if (!ctx->cfg_ptr->ext_zcf) {                       \
35
        return false;                          \
36
        if (!has_ext(ctx, RVF) || !has_ext(ctx, RVC)) { \
36
    }                                          \
37
            return false;                               \
38
        }                                               \
39
    }                                                   \
37
} while (0)
40
} while (0)
38
41
39
static bool trans_flw(DisasContext *ctx, arg_flw *a)
42
static bool trans_flw(DisasContext *ctx, arg_flw *a)
Lines 69-81 static bool trans_fsw(DisasContext *ctx, arg_fsw *a) Link Here
69
72
70
static bool trans_c_flw(DisasContext *ctx, arg_flw *a)
73
static bool trans_c_flw(DisasContext *ctx, arg_flw *a)
71
{
74
{
72
    REQUIRE_ZCF(ctx);
75
    REQUIRE_ZCF_OR_FC(ctx);
73
    return trans_flw(ctx, a);
76
    return trans_flw(ctx, a);
74
}
77
}
75
78
76
static bool trans_c_fsw(DisasContext *ctx, arg_fsw *a)
79
static bool trans_c_fsw(DisasContext *ctx, arg_fsw *a)
77
{
80
{
78
    REQUIRE_ZCF(ctx);
81
    REQUIRE_ZCF_OR_FC(ctx);
79
    return trans_fsw(ctx, a);
82
    return trans_fsw(ctx, a);
80
}
83
}
81
84
(-)a/target/riscv/insn_trans/trans_rvi.c.inc (-15 / +31 lines)
Lines 38-44 static bool trans_lui(DisasContext *ctx, arg_lui *a) Link Here
38
38
39
static bool trans_auipc(DisasContext *ctx, arg_auipc *a)
39
static bool trans_auipc(DisasContext *ctx, arg_auipc *a)
40
{
40
{
41
    gen_set_gpri(ctx, a->rd, a->imm + ctx->base.pc_next);
41
    TCGv target_pc = dest_gpr(ctx, a->rd);
42
    gen_pc_plus_diff(target_pc, ctx, a->imm);
43
    gen_set_gpr(ctx, a->rd, target_pc);
42
    return true;
44
    return true;
43
}
45
}
44
46
Lines 51-75 static bool trans_jal(DisasContext *ctx, arg_jal *a) Link Here
51
static bool trans_jalr(DisasContext *ctx, arg_jalr *a)
53
static bool trans_jalr(DisasContext *ctx, arg_jalr *a)
52
{
54
{
53
    TCGLabel *misaligned = NULL;
55
    TCGLabel *misaligned = NULL;
56
    TCGv target_pc = tcg_temp_new();
57
    TCGv succ_pc = dest_gpr(ctx, a->rd);
54
58
55
    tcg_gen_addi_tl(cpu_pc, get_gpr(ctx, a->rs1, EXT_NONE), a->imm);
59
    tcg_gen_addi_tl(target_pc, get_gpr(ctx, a->rs1, EXT_NONE), a->imm);
56
    tcg_gen_andi_tl(cpu_pc, cpu_pc, (target_ulong)-2);
60
    tcg_gen_andi_tl(target_pc, target_pc, (target_ulong)-2);
57
61
58
    gen_set_pc(ctx, cpu_pc);
62
    if (get_xl(ctx) == MXL_RV32) {
59
    if (!ctx->cfg_ptr->ext_zca) {
63
        tcg_gen_ext32s_tl(target_pc, target_pc);
64
    }
65
66
    if (!has_ext(ctx, RVC) && !ctx->cfg_ptr->ext_zca) {
60
        TCGv t0 = tcg_temp_new();
67
        TCGv t0 = tcg_temp_new();
61
68
62
        misaligned = gen_new_label();
69
        misaligned = gen_new_label();
63
        tcg_gen_andi_tl(t0, cpu_pc, 0x2);
70
        tcg_gen_andi_tl(t0, target_pc, 0x2);
64
        tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x0, misaligned);
71
        tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x0, misaligned);
65
    }
72
    }
66
73
67
    gen_set_gpri(ctx, a->rd, ctx->pc_succ_insn);
74
    gen_pc_plus_diff(succ_pc, ctx, ctx->cur_insn_len);
75
    gen_set_gpr(ctx, a->rd, succ_pc);
76
77
    tcg_gen_mov_tl(cpu_pc, target_pc);
68
    lookup_and_goto_ptr(ctx);
78
    lookup_and_goto_ptr(ctx);
69
79
70
    if (misaligned) {
80
    if (misaligned) {
71
        gen_set_label(misaligned);
81
        gen_set_label(misaligned);
72
        gen_exception_inst_addr_mis(ctx);
82
        gen_exception_inst_addr_mis(ctx, target_pc);
73
    }
83
    }
74
    ctx->base.is_jmp = DISAS_NORETURN;
84
    ctx->base.is_jmp = DISAS_NORETURN;
75
85
Lines 153-158 static bool gen_branch(DisasContext *ctx, arg_b *a, TCGCond cond) Link Here
153
    TCGLabel *l = gen_new_label();
163
    TCGLabel *l = gen_new_label();
154
    TCGv src1 = get_gpr(ctx, a->rs1, EXT_SIGN);
164
    TCGv src1 = get_gpr(ctx, a->rs1, EXT_SIGN);
155
    TCGv src2 = get_gpr(ctx, a->rs2, EXT_SIGN);
165
    TCGv src2 = get_gpr(ctx, a->rs2, EXT_SIGN);
166
    target_ulong orig_pc_save = ctx->pc_save;
156
167
157
    if (get_xl(ctx) == MXL_RV128) {
168
    if (get_xl(ctx) == MXL_RV128) {
158
        TCGv src1h = get_gprh(ctx, a->rs1);
169
        TCGv src1h = get_gprh(ctx, a->rs1);
Lines 165-180 static bool gen_branch(DisasContext *ctx, arg_b *a, TCGCond cond) Link Here
165
    } else {
176
    } else {
166
        tcg_gen_brcond_tl(cond, src1, src2, l);
177
        tcg_gen_brcond_tl(cond, src1, src2, l);
167
    }
178
    }
168
    gen_goto_tb(ctx, 1, ctx->pc_succ_insn);
179
    gen_goto_tb(ctx, 1, ctx->cur_insn_len);
180
    ctx->pc_save = orig_pc_save;
169
181
170
    gen_set_label(l); /* branch taken */
182
    gen_set_label(l); /* branch taken */
171
183
172
    if (!ctx->cfg_ptr->ext_zca && ((ctx->base.pc_next + a->imm) & 0x3)) {
184
    if (!has_ext(ctx, RVC) && !ctx->cfg_ptr->ext_zca &&
185
        (a->imm & 0x3)) {
173
        /* misaligned */
186
        /* misaligned */
174
        gen_exception_inst_addr_mis(ctx);
187
        TCGv target_pc = tcg_temp_new();
188
        gen_pc_plus_diff(target_pc, ctx, a->imm);
189
        gen_exception_inst_addr_mis(ctx, target_pc);
175
    } else {
190
    } else {
176
        gen_goto_tb(ctx, 0, ctx->base.pc_next + a->imm);
191
        gen_goto_tb(ctx, 0, a->imm);
177
    }
192
    }
193
    ctx->pc_save = -1;
178
    ctx->base.is_jmp = DISAS_NORETURN;
194
    ctx->base.is_jmp = DISAS_NORETURN;
179
195
180
    return true;
196
    return true;
Lines 767-773 static bool trans_pause(DisasContext *ctx, arg_pause *a) Link Here
767
     * PAUSE is a no-op in QEMU,
783
     * PAUSE is a no-op in QEMU,
768
     * end the TB and return to main loop
784
     * end the TB and return to main loop
769
     */
785
     */
770
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
786
    gen_update_pc(ctx, ctx->cur_insn_len);
771
    exit_tb(ctx);
787
    exit_tb(ctx);
772
    ctx->base.is_jmp = DISAS_NORETURN;
788
    ctx->base.is_jmp = DISAS_NORETURN;
773
789
Lines 791-797 static bool trans_fence_i(DisasContext *ctx, arg_fence_i *a) Link Here
791
     * FENCE_I is a no-op in QEMU,
807
     * FENCE_I is a no-op in QEMU,
792
     * however we need to end the translation block
808
     * however we need to end the translation block
793
     */
809
     */
794
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
810
    gen_update_pc(ctx, ctx->cur_insn_len);
795
    exit_tb(ctx);
811
    exit_tb(ctx);
796
    ctx->base.is_jmp = DISAS_NORETURN;
812
    ctx->base.is_jmp = DISAS_NORETURN;
797
    return true;
813
    return true;
Lines 802-808 static bool do_csr_post(DisasContext *ctx) Link Here
802
    /* The helper may raise ILLEGAL_INSN -- record binv for unwind. */
818
    /* The helper may raise ILLEGAL_INSN -- record binv for unwind. */
803
    decode_save_opc(ctx);
819
    decode_save_opc(ctx);
804
    /* We may have changed important cpu state -- exit to main loop. */
820
    /* We may have changed important cpu state -- exit to main loop. */
805
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
821
    gen_update_pc(ctx, ctx->cur_insn_len);
806
    exit_tb(ctx);
822
    exit_tb(ctx);
807
    ctx->base.is_jmp = DISAS_NORETURN;
823
    ctx->base.is_jmp = DISAS_NORETURN;
808
    return true;
824
    return true;
(-)a/target/riscv/insn_trans/trans_rvv.c.inc (-2 / +2 lines)
Lines 169-175 static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) Link Here
169
    gen_set_gpr(s, rd, dst);
169
    gen_set_gpr(s, rd, dst);
170
    mark_vs_dirty(s);
170
    mark_vs_dirty(s);
171
171
172
    gen_set_pc_imm(s, s->pc_succ_insn);
172
    gen_update_pc(s, s->cur_insn_len);
173
    lookup_and_goto_ptr(s);
173
    lookup_and_goto_ptr(s);
174
    s->base.is_jmp = DISAS_NORETURN;
174
    s->base.is_jmp = DISAS_NORETURN;
175
    return true;
175
    return true;
Lines 188-194 static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) Link Here
188
    gen_helper_vsetvl(dst, cpu_env, s1, s2);
188
    gen_helper_vsetvl(dst, cpu_env, s1, s2);
189
    gen_set_gpr(s, rd, dst);
189
    gen_set_gpr(s, rd, dst);
190
    mark_vs_dirty(s);
190
    mark_vs_dirty(s);
191
    gen_set_pc_imm(s, s->pc_succ_insn);
191
    gen_update_pc(s, s->cur_insn_len);
192
    lookup_and_goto_ptr(s);
192
    lookup_and_goto_ptr(s);
193
    s->base.is_jmp = DISAS_NORETURN;
193
    s->base.is_jmp = DISAS_NORETURN;
194
194
(-)a/target/riscv/insn_trans/trans_rvzawrs.c.inc (-1 / +1 lines)
Lines 33-39 static bool trans_wrs(DisasContext *ctx) Link Here
33
    /* Clear the load reservation  (if any).  */
33
    /* Clear the load reservation  (if any).  */
34
    tcg_gen_movi_tl(load_res, -1);
34
    tcg_gen_movi_tl(load_res, -1);
35
35
36
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
36
    gen_update_pc(ctx, ctx->cur_insn_len);
37
    tcg_gen_exit_tb(NULL, 0);
37
    tcg_gen_exit_tb(NULL, 0);
38
    ctx->base.is_jmp = DISAS_NORETURN;
38
    ctx->base.is_jmp = DISAS_NORETURN;
39
39
(-)a/target/riscv/insn_trans/trans_rvzce.c.inc (-4 / +6 lines)
Lines 202-209 static bool gen_pop(DisasContext *ctx, arg_cmpp *a, bool ret, bool ret_val) Link Here
202
    }
202
    }
203
203
204
    if (ret) {
204
    if (ret) {
205
        TCGv ret_addr = get_gpr(ctx, xRA, EXT_NONE);
205
        TCGv ret_addr = get_gpr(ctx, xRA, EXT_SIGN);
206
        gen_set_pc(ctx, ret_addr);
206
        tcg_gen_mov_tl(cpu_pc, ret_addr);
207
        tcg_gen_lookup_and_goto_ptr();
207
        tcg_gen_lookup_and_goto_ptr();
208
        ctx->base.is_jmp = DISAS_NORETURN;
208
        ctx->base.is_jmp = DISAS_NORETURN;
209
    }
209
    }
Lines 297-308 static bool trans_cm_jalt(DisasContext *ctx, arg_cm_jalt *a) Link Here
297
     * Update pc to current for the non-unwinding exception
297
     * Update pc to current for the non-unwinding exception
298
     * that might come from cpu_ld*_code() in the helper.
298
     * that might come from cpu_ld*_code() in the helper.
299
     */
299
     */
300
    tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
300
    gen_update_pc(ctx, 0);
301
    gen_helper_cm_jalt(cpu_pc, cpu_env, tcg_constant_i32(a->index));
301
    gen_helper_cm_jalt(cpu_pc, cpu_env, tcg_constant_i32(a->index));
302
302
303
    /* c.jt vs c.jalt depends on the index. */
303
    /* c.jt vs c.jalt depends on the index. */
304
    if (a->index >= 32) {
304
    if (a->index >= 32) {
305
        gen_set_gpri(ctx, xRA, ctx->pc_succ_insn);
305
        TCGv succ_pc = dest_gpr(ctx, xRA);
306
        gen_pc_plus_diff(succ_pc, ctx, ctx->cur_insn_len);
307
        gen_set_gpr(ctx, xRA, succ_pc);
306
    }
308
    }
307
309
308
    tcg_gen_lookup_and_goto_ptr();
310
    tcg_gen_lookup_and_goto_ptr();
(-)a/target/riscv/insn_trans/trans_xthead.c.inc (-1 / +1 lines)
Lines 999-1005 static void gen_th_sync_local(DisasContext *ctx) Link Here
999
     * Emulate out-of-order barriers with pipeline flush
999
     * Emulate out-of-order barriers with pipeline flush
1000
     * by exiting the translation block.
1000
     * by exiting the translation block.
1001
     */
1001
     */
1002
    gen_set_pc_imm(ctx, ctx->pc_succ_insn);
1002
    gen_update_pc(ctx, ctx->cur_insn_len);
1003
    tcg_gen_exit_tb(NULL, 0);
1003
    tcg_gen_exit_tb(NULL, 0);
1004
    ctx->base.is_jmp = DISAS_NORETURN;
1004
    ctx->base.is_jmp = DISAS_NORETURN;
1005
}
1005
}
(-)a/target/riscv/pmp.c (-87 / +118 lines)
Lines 26-35 Link Here
26
#include "trace.h"
26
#include "trace.h"
27
#include "exec/exec-all.h"
27
#include "exec/exec-all.h"
28
28
29
static void pmp_write_cfg(CPURISCVState *env, uint32_t addr_index,
29
static bool pmp_write_cfg(CPURISCVState *env, uint32_t addr_index,
30
                          uint8_t val);
30
                          uint8_t val);
31
static uint8_t pmp_read_cfg(CPURISCVState *env, uint32_t addr_index);
31
static uint8_t pmp_read_cfg(CPURISCVState *env, uint32_t addr_index);
32
static void pmp_update_rule(CPURISCVState *env, uint32_t pmp_index);
33
32
34
/*
33
/*
35
 * Accessor method to extract address matching type 'a field' from cfg reg
34
 * Accessor method to extract address matching type 'a field' from cfg reg
Lines 83-89 static inline uint8_t pmp_read_cfg(CPURISCVState *env, uint32_t pmp_index) Link Here
83
 * Accessor to set the cfg reg for a specific PMP/HART
82
 * Accessor to set the cfg reg for a specific PMP/HART
84
 * Bounds checks and relevant lock bit.
83
 * Bounds checks and relevant lock bit.
85
 */
84
 */
86
static void pmp_write_cfg(CPURISCVState *env, uint32_t pmp_index, uint8_t val)
85
static bool pmp_write_cfg(CPURISCVState *env, uint32_t pmp_index, uint8_t val)
87
{
86
{
88
    if (pmp_index < MAX_RISCV_PMPS) {
87
    if (pmp_index < MAX_RISCV_PMPS) {
89
        bool locked = true;
88
        bool locked = true;
Lines 119-132 static void pmp_write_cfg(CPURISCVState *env, uint32_t pmp_index, uint8_t val) Link Here
119
118
120
        if (locked) {
119
        if (locked) {
121
            qemu_log_mask(LOG_GUEST_ERROR, "ignoring pmpcfg write - locked\n");
120
            qemu_log_mask(LOG_GUEST_ERROR, "ignoring pmpcfg write - locked\n");
122
        } else {
121
        } else if (env->pmp_state.pmp[pmp_index].cfg_reg != val) {
123
            env->pmp_state.pmp[pmp_index].cfg_reg = val;
122
            env->pmp_state.pmp[pmp_index].cfg_reg = val;
124
            pmp_update_rule(env, pmp_index);
123
            pmp_update_rule_addr(env, pmp_index);
124
            return true;
125
        }
125
        }
126
    } else {
126
    } else {
127
        qemu_log_mask(LOG_GUEST_ERROR,
127
        qemu_log_mask(LOG_GUEST_ERROR,
128
                      "ignoring pmpcfg write - out of bounds\n");
128
                      "ignoring pmpcfg write - out of bounds\n");
129
    }
129
    }
130
131
    return false;
130
}
132
}
131
133
132
static void pmp_decode_napot(target_ulong a, target_ulong *sa,
134
static void pmp_decode_napot(target_ulong a, target_ulong *sa,
Lines 206-223 void pmp_update_rule_nums(CPURISCVState *env) Link Here
206
    }
208
    }
207
}
209
}
208
210
209
/*
210
 * Convert cfg/addr reg values here into simple 'sa' --> start address and 'ea'
211
 *   end address values.
212
 *   This function is called relatively infrequently whereas the check that
213
 *   an address is within a pmp rule is called often, so optimise that one
214
 */
215
static void pmp_update_rule(CPURISCVState *env, uint32_t pmp_index)
216
{
217
    pmp_update_rule_addr(env, pmp_index);
218
    pmp_update_rule_nums(env);
219
}
220
221
static int pmp_is_in_range(CPURISCVState *env, int pmp_index,
211
static int pmp_is_in_range(CPURISCVState *env, int pmp_index,
222
                           target_ulong addr)
212
                           target_ulong addr)
223
{
213
{
Lines 236-272 static int pmp_is_in_range(CPURISCVState *env, int pmp_index, Link Here
236
/*
226
/*
237
 * Check if the address has required RWX privs when no PMP entry is matched.
227
 * Check if the address has required RWX privs when no PMP entry is matched.
238
 */
228
 */
239
static bool pmp_hart_has_privs_default(CPURISCVState *env, target_ulong addr,
229
static bool pmp_hart_has_privs_default(CPURISCVState *env, pmp_priv_t privs,
240
                                       target_ulong size, pmp_priv_t privs,
241
                                       pmp_priv_t *allowed_privs,
230
                                       pmp_priv_t *allowed_privs,
242
                                       target_ulong mode)
231
                                       target_ulong mode)
243
{
232
{
244
    bool ret;
233
    bool ret;
245
234
246
    if (riscv_cpu_cfg(env)->epmp) {
235
    if (MSECCFG_MMWP_ISSET(env)) {
247
        if (MSECCFG_MMWP_ISSET(env)) {
236
        /*
248
            /*
237
         * The Machine Mode Whitelist Policy (mseccfg.MMWP) is set
249
             * The Machine Mode Whitelist Policy (mseccfg.MMWP) is set
238
         * so we default to deny all, even for M-mode.
250
             * so we default to deny all, even for M-mode.
239
         */
251
             */
240
        *allowed_privs = 0;
241
        return false;
242
    } else if (MSECCFG_MML_ISSET(env)) {
243
        /*
244
         * The Machine Mode Lockdown (mseccfg.MML) bit is set
245
         * so we can only execute code in M-mode with an applicable
246
         * rule. Other modes are disabled.
247
         */
248
        if (mode == PRV_M && !(privs & PMP_EXEC)) {
249
            ret = true;
250
            *allowed_privs = PMP_READ | PMP_WRITE;
251
        } else {
252
            ret = false;
252
            *allowed_privs = 0;
253
            *allowed_privs = 0;
253
            return false;
254
        } else if (MSECCFG_MML_ISSET(env)) {
255
            /*
256
             * The Machine Mode Lockdown (mseccfg.MML) bit is set
257
             * so we can only execute code in M-mode with an applicable
258
             * rule. Other modes are disabled.
259
             */
260
            if (mode == PRV_M && !(privs & PMP_EXEC)) {
261
                ret = true;
262
                *allowed_privs = PMP_READ | PMP_WRITE;
263
            } else {
264
                ret = false;
265
                *allowed_privs = 0;
266
            }
267
268
            return ret;
269
        }
254
        }
255
256
        return ret;
270
    }
257
    }
271
258
272
    if (!riscv_cpu_cfg(env)->pmp || (mode == PRV_M)) {
259
    if (!riscv_cpu_cfg(env)->pmp || (mode == PRV_M)) {
Lines 296-321 static bool pmp_hart_has_privs_default(CPURISCVState *env, target_ulong addr, Link Here
296
283
297
/*
284
/*
298
 * Check if the address has required RWX privs to complete desired operation
285
 * Check if the address has required RWX privs to complete desired operation
299
 * Return PMP rule index if a pmp rule match
286
 * Return true if a pmp rule match or default match
300
 * Return MAX_RISCV_PMPS if default match
287
 * Return false if no match
301
 * Return negtive value if no match
302
 */
288
 */
303
int pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
289
bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
304
                       target_ulong size, pmp_priv_t privs,
290
                        target_ulong size, pmp_priv_t privs,
305
                       pmp_priv_t *allowed_privs, target_ulong mode)
291
                        pmp_priv_t *allowed_privs, target_ulong mode)
306
{
292
{
307
    int i = 0;
293
    int i = 0;
308
    int ret = -1;
309
    int pmp_size = 0;
294
    int pmp_size = 0;
310
    target_ulong s = 0;
295
    target_ulong s = 0;
311
    target_ulong e = 0;
296
    target_ulong e = 0;
312
297
313
    /* Short cut if no rules */
298
    /* Short cut if no rules */
314
    if (0 == pmp_get_num_rules(env)) {
299
    if (0 == pmp_get_num_rules(env)) {
315
        if (pmp_hart_has_privs_default(env, addr, size, privs,
300
        return pmp_hart_has_privs_default(env, privs, allowed_privs, mode);
316
                                       allowed_privs, mode)) {
317
            ret = MAX_RISCV_PMPS;
318
        }
319
    }
301
    }
320
302
321
    if (size == 0) {
303
    if (size == 0) {
Lines 344-351 int pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, Link Here
344
        if ((s + e) == 1) {
326
        if ((s + e) == 1) {
345
            qemu_log_mask(LOG_GUEST_ERROR,
327
            qemu_log_mask(LOG_GUEST_ERROR,
346
                          "pmp violation - access is partially inside\n");
328
                          "pmp violation - access is partially inside\n");
347
            ret = -1;
329
            *allowed_privs = 0;
348
            break;
330
            return false;
349
        }
331
        }
350
332
351
        /* fully inside */
333
        /* fully inside */
Lines 452-471 int pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, Link Here
452
             * defined with PMP must be used. We shouldn't fallback on
434
             * defined with PMP must be used. We shouldn't fallback on
453
             * finding default privileges.
435
             * finding default privileges.
454
             */
436
             */
455
            ret = i;
437
            return (privs & *allowed_privs) == privs;
456
            break;
457
        }
438
        }
458
    }
439
    }
459
440
460
    /* No rule matched */
441
    /* No rule matched */
461
    if (ret == -1) {
442
    return pmp_hart_has_privs_default(env, privs, allowed_privs, mode);
462
        if (pmp_hart_has_privs_default(env, addr, size, privs,
463
                                       allowed_privs, mode)) {
464
            ret = MAX_RISCV_PMPS;
465
        }
466
    }
467
468
    return ret;
469
}
443
}
470
444
471
/*
445
/*
Lines 477-492 void pmpcfg_csr_write(CPURISCVState *env, uint32_t reg_index, Link Here
477
    int i;
451
    int i;
478
    uint8_t cfg_val;
452
    uint8_t cfg_val;
479
    int pmpcfg_nums = 2 << riscv_cpu_mxl(env);
453
    int pmpcfg_nums = 2 << riscv_cpu_mxl(env);
454
    bool modified = false;
480
455
481
    trace_pmpcfg_csr_write(env->mhartid, reg_index, val);
456
    trace_pmpcfg_csr_write(env->mhartid, reg_index, val);
482
457
483
    for (i = 0; i < pmpcfg_nums; i++) {
458
    for (i = 0; i < pmpcfg_nums; i++) {
484
        cfg_val = (val >> 8 * i)  & 0xff;
459
        cfg_val = (val >> 8 * i)  & 0xff;
485
        pmp_write_cfg(env, (reg_index * 4) + i, cfg_val);
460
        modified |= pmp_write_cfg(env, (reg_index * 4) + i, cfg_val);
486
    }
461
    }
487
462
488
    /* If PMP permission of any addr has been changed, flush TLB pages. */
463
    /* If PMP permission of any addr has been changed, flush TLB pages. */
489
    tlb_flush(env_cpu(env));
464
    if (modified) {
465
        pmp_update_rule_nums(env);
466
        tlb_flush(env_cpu(env));
467
    }
490
}
468
}
491
469
492
470
Lines 517-522 void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index, Link Here
517
                       target_ulong val)
495
                       target_ulong val)
518
{
496
{
519
    trace_pmpaddr_csr_write(env->mhartid, addr_index, val);
497
    trace_pmpaddr_csr_write(env->mhartid, addr_index, val);
498
    bool is_next_cfg_tor = false;
520
499
521
    if (addr_index < MAX_RISCV_PMPS) {
500
    if (addr_index < MAX_RISCV_PMPS) {
522
        /*
501
        /*
Lines 525-533 void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index, Link Here
525
         */
504
         */
526
        if (addr_index + 1 < MAX_RISCV_PMPS) {
505
        if (addr_index + 1 < MAX_RISCV_PMPS) {
527
            uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
506
            uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
507
            is_next_cfg_tor = PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg);
528
508
529
            if (pmp_cfg & PMP_LOCK &&
509
            if (pmp_cfg & PMP_LOCK && is_next_cfg_tor) {
530
                PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg)) {
531
                qemu_log_mask(LOG_GUEST_ERROR,
510
                qemu_log_mask(LOG_GUEST_ERROR,
532
                              "ignoring pmpaddr write - pmpcfg + 1 locked\n");
511
                              "ignoring pmpaddr write - pmpcfg + 1 locked\n");
533
                return;
512
                return;
Lines 535-542 void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index, Link Here
535
        }
514
        }
536
515
537
        if (!pmp_is_locked(env, addr_index)) {
516
        if (!pmp_is_locked(env, addr_index)) {
538
            env->pmp_state.pmp[addr_index].addr_reg = val;
517
            if (env->pmp_state.pmp[addr_index].addr_reg != val) {
539
            pmp_update_rule(env, addr_index);
518
                env->pmp_state.pmp[addr_index].addr_reg = val;
519
                pmp_update_rule_addr(env, addr_index);
520
                if (is_next_cfg_tor) {
521
                    pmp_update_rule_addr(env, addr_index + 1);
522
                }
523
                tlb_flush(env_cpu(env));
524
            }
540
        } else {
525
        } else {
541
            qemu_log_mask(LOG_GUEST_ERROR,
526
            qemu_log_mask(LOG_GUEST_ERROR,
542
                          "ignoring pmpaddr write - locked\n");
527
                          "ignoring pmpaddr write - locked\n");
Lines 585-592 void mseccfg_csr_write(CPURISCVState *env, target_ulong val) Link Here
585
        }
570
        }
586
    }
571
    }
587
572
588
    /* Sticky bits */
573
    if (riscv_cpu_cfg(env)->epmp) {
589
    val |= (env->mseccfg & (MSECCFG_MMWP | MSECCFG_MML));
574
        /* Sticky bits */
575
        val |= (env->mseccfg & (MSECCFG_MMWP | MSECCFG_MML));
576
        if ((val ^ env->mseccfg) & (MSECCFG_MMWP | MSECCFG_MML)) {
577
            tlb_flush(env_cpu(env));
578
        }
579
    } else {
580
        val &= ~(MSECCFG_MMWP | MSECCFG_MML | MSECCFG_RLB);
581
    }
590
582
591
    env->mseccfg = val;
583
    env->mseccfg = val;
592
}
584
}
Lines 601-628 target_ulong mseccfg_csr_read(CPURISCVState *env) Link Here
601
}
593
}
602
594
603
/*
595
/*
604
 * Calculate the TLB size if the start address or the end address of
596
 * Calculate the TLB size.
605
 * PMP entry is presented in the TLB page.
597
 * It's possible that PMP regions only cover partial of the TLB page, and
598
 * this may split the page into regions with different permissions.
599
 * For example if PMP0 is (0x80000008~0x8000000F, R) and PMP1 is (0x80000000
600
 * ~0x80000FFF, RWX), then region 0x80000008~0x8000000F has R permission, and
601
 * the other regions in this page have RWX permissions.
602
 * A write access to 0x80000000 will match PMP1. However we cannot cache the
603
 * translation result in the TLB since this will make the write access to
604
 * 0x80000008 bypass the check of PMP0.
605
 * To avoid this we return a size of 1 (which means no caching) if the PMP
606
 * region only covers partial of the TLB page.
606
 */
607
 */
607
target_ulong pmp_get_tlb_size(CPURISCVState *env, int pmp_index,
608
target_ulong pmp_get_tlb_size(CPURISCVState *env, target_ulong addr)
608
                              target_ulong tlb_sa, target_ulong tlb_ea)
609
{
609
{
610
    target_ulong pmp_sa = env->pmp_state.addr[pmp_index].sa;
610
    target_ulong pmp_sa;
611
    target_ulong pmp_ea = env->pmp_state.addr[pmp_index].ea;
611
    target_ulong pmp_ea;
612
    target_ulong tlb_sa = addr & ~(TARGET_PAGE_SIZE - 1);
613
    target_ulong tlb_ea = tlb_sa + TARGET_PAGE_SIZE - 1;
614
    int i;
612
615
613
    if (pmp_sa <= tlb_sa && pmp_ea >= tlb_ea) {
616
    /*
617
     * If PMP is not supported or there are no PMP rules, the TLB page will not
618
     * be split into regions with different permissions by PMP so we set the
619
     * size to TARGET_PAGE_SIZE.
620
     */
621
    if (!riscv_cpu_cfg(env)->pmp || !pmp_get_num_rules(env)) {
614
        return TARGET_PAGE_SIZE;
622
        return TARGET_PAGE_SIZE;
615
    } else {
623
    }
624
625
    for (i = 0; i < MAX_RISCV_PMPS; i++) {
626
        if (pmp_get_a_field(env->pmp_state.pmp[i].cfg_reg) == PMP_AMATCH_OFF) {
627
            continue;
628
        }
629
630
        pmp_sa = env->pmp_state.addr[i].sa;
631
        pmp_ea = env->pmp_state.addr[i].ea;
632
616
        /*
633
        /*
617
         * At this point we have a tlb_size that is the smallest possible size
634
         * Only the first PMP entry that covers (whole or partial of) the TLB
618
         * That fits within a TARGET_PAGE_SIZE and the PMP region.
635
         * page really matters:
619
         *
636
         * If it covers the whole TLB page, set the size to TARGET_PAGE_SIZE,
620
         * If the size is less then TARGET_PAGE_SIZE we drop the size to 1.
637
         * since the following PMP entries have lower priority and will not
621
         * This means the result isn't cached in the TLB and is only used for
638
         * affect the permissions of the page.
622
         * a single translation.
639
         * If it only covers partial of the TLB page, set the size to 1 since
640
         * the allowed permissions of the region may be different from other
641
         * region of the page.
623
         */
642
         */
624
        return 1;
643
        if (pmp_sa <= tlb_sa && pmp_ea >= tlb_ea) {
644
            return TARGET_PAGE_SIZE;
645
        } else if ((pmp_sa >= tlb_sa && pmp_sa <= tlb_ea) ||
646
                   (pmp_ea >= tlb_sa && pmp_ea <= tlb_ea)) {
647
            return 1;
648
        }
625
    }
649
    }
650
651
    /*
652
     * If no PMP entry matches the TLB page, the TLB page will also not be
653
     * split into regions with different permissions by PMP so we set the size
654
     * to TARGET_PAGE_SIZE.
655
     */
656
    return TARGET_PAGE_SIZE;
626
}
657
}
627
658
628
/*
659
/*
(-)a/target/riscv/pmp.h (-6 / +5 lines)
Lines 72-83 target_ulong mseccfg_csr_read(CPURISCVState *env); Link Here
72
void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
72
void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
73
                       target_ulong val);
73
                       target_ulong val);
74
target_ulong pmpaddr_csr_read(CPURISCVState *env, uint32_t addr_index);
74
target_ulong pmpaddr_csr_read(CPURISCVState *env, uint32_t addr_index);
75
int pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
75
bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
76
                       target_ulong size, pmp_priv_t privs,
76
                        target_ulong size, pmp_priv_t privs,
77
                       pmp_priv_t *allowed_privs,
77
                        pmp_priv_t *allowed_privs,
78
                       target_ulong mode);
78
                        target_ulong mode);
79
target_ulong pmp_get_tlb_size(CPURISCVState *env, int pmp_index,
79
target_ulong pmp_get_tlb_size(CPURISCVState *env, target_ulong addr);
80
                              target_ulong tlb_sa, target_ulong tlb_ea);
81
void pmp_update_rule_addr(CPURISCVState *env, uint32_t pmp_index);
80
void pmp_update_rule_addr(CPURISCVState *env, uint32_t pmp_index);
82
void pmp_update_rule_nums(CPURISCVState *env);
81
void pmp_update_rule_nums(CPURISCVState *env);
83
uint32_t pmp_get_num_rules(CPURISCVState *env);
82
uint32_t pmp_get_num_rules(CPURISCVState *env);
(-)a/target/riscv/translate.c (-34 / +65 lines)
Lines 59-66 typedef enum { Link Here
59
59
60
typedef struct DisasContext {
60
typedef struct DisasContext {
61
    DisasContextBase base;
61
    DisasContextBase base;
62
    /* pc_succ_insn points to the instruction following base.pc_next */
62
    target_ulong cur_insn_len;
63
    target_ulong pc_succ_insn;
63
    target_ulong pc_save;
64
    target_ulong priv_ver;
64
    target_ulong priv_ver;
65
    RISCVMXL misa_mxl_max;
65
    RISCVMXL misa_mxl_max;
66
    RISCVMXL xl;
66
    RISCVMXL xl;
Lines 224-249 static void decode_save_opc(DisasContext *ctx) Link Here
224
    ctx->insn_start = NULL;
224
    ctx->insn_start = NULL;
225
}
225
}
226
226
227
static void gen_set_pc_imm(DisasContext *ctx, target_ulong dest)
227
static void gen_pc_plus_diff(TCGv target, DisasContext *ctx,
228
                             target_long diff)
228
{
229
{
229
    if (get_xl(ctx) == MXL_RV32) {
230
    target_ulong dest = ctx->base.pc_next + diff;
230
        dest = (int32_t)dest;
231
232
    assert(ctx->pc_save != -1);
233
    if (tb_cflags(ctx->base.tb) & CF_PCREL) {
234
        tcg_gen_addi_tl(target, cpu_pc, dest - ctx->pc_save);
235
        if (get_xl(ctx) == MXL_RV32) {
236
            tcg_gen_ext32s_tl(target, target);
237
        }
238
    } else {
239
        if (get_xl(ctx) == MXL_RV32) {
240
            dest = (int32_t)dest;
241
        }
242
        tcg_gen_movi_tl(target, dest);
231
    }
243
    }
232
    tcg_gen_movi_tl(cpu_pc, dest);
233
}
244
}
234
245
235
static void gen_set_pc(DisasContext *ctx, TCGv dest)
246
static void gen_update_pc(DisasContext *ctx, target_long diff)
236
{
247
{
237
    if (get_xl(ctx) == MXL_RV32) {
248
    gen_pc_plus_diff(cpu_pc, ctx, diff);
238
        tcg_gen_ext32s_tl(cpu_pc, dest);
249
    ctx->pc_save = ctx->base.pc_next + diff;
239
    } else {
240
        tcg_gen_mov_tl(cpu_pc, dest);
241
    }
242
}
250
}
243
251
244
static void generate_exception(DisasContext *ctx, int excp)
252
static void generate_exception(DisasContext *ctx, int excp)
245
{
253
{
246
    gen_set_pc_imm(ctx, ctx->base.pc_next);
254
    gen_update_pc(ctx, 0);
247
    gen_helper_raise_exception(cpu_env, tcg_constant_i32(excp));
255
    gen_helper_raise_exception(cpu_env, tcg_constant_i32(excp));
248
    ctx->base.is_jmp = DISAS_NORETURN;
256
    ctx->base.is_jmp = DISAS_NORETURN;
249
}
257
}
Lines 259-267 static void gen_exception_illegal(DisasContext *ctx) Link Here
259
    }
267
    }
260
}
268
}
261
269
262
static void gen_exception_inst_addr_mis(DisasContext *ctx)
270
static void gen_exception_inst_addr_mis(DisasContext *ctx, TCGv target)
263
{
271
{
264
    tcg_gen_st_tl(cpu_pc, cpu_env, offsetof(CPURISCVState, badaddr));
272
    tcg_gen_st_tl(target, cpu_env, offsetof(CPURISCVState, badaddr));
265
    generate_exception(ctx, RISCV_EXCP_INST_ADDR_MIS);
273
    generate_exception(ctx, RISCV_EXCP_INST_ADDR_MIS);
266
}
274
}
267
275
Lines 285-302 static void exit_tb(DisasContext *ctx) Link Here
285
    tcg_gen_exit_tb(NULL, 0);
293
    tcg_gen_exit_tb(NULL, 0);
286
}
294
}
287
295
288
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
296
static void gen_goto_tb(DisasContext *ctx, int n, target_long diff)
289
{
297
{
298
    target_ulong dest = ctx->base.pc_next + diff;
299
290
     /*
300
     /*
291
      * Under itrigger, instruction executes one by one like singlestep,
301
      * Under itrigger, instruction executes one by one like singlestep,
292
      * direct block chain benefits will be small.
302
      * direct block chain benefits will be small.
293
      */
303
      */
294
    if (translator_use_goto_tb(&ctx->base, dest) && !ctx->itrigger) {
304
    if (translator_use_goto_tb(&ctx->base, dest) && !ctx->itrigger) {
295
        tcg_gen_goto_tb(n);
305
        /*
296
        gen_set_pc_imm(ctx, dest);
306
         * For pcrel, the pc must always be up-to-date on entry to
307
         * the linked TB, so that it can use simple additions for all
308
         * further adjustments.  For !pcrel, the linked TB is compiled
309
         * to know its full virtual address, so we can delay the
310
         * update to pc to the unlinked path.  A long chain of links
311
         * can thus avoid many updates to the PC.
312
         */
313
        if (tb_cflags(ctx->base.tb) & CF_PCREL) {
314
            gen_update_pc(ctx, diff);
315
            tcg_gen_goto_tb(n);
316
        } else {
317
            tcg_gen_goto_tb(n);
318
            gen_update_pc(ctx, diff);
319
        }
297
        tcg_gen_exit_tb(ctx->base.tb, n);
320
        tcg_gen_exit_tb(ctx->base.tb, n);
298
    } else {
321
    } else {
299
        gen_set_pc_imm(ctx, dest);
322
        gen_update_pc(ctx, diff);
300
        lookup_and_goto_ptr(ctx);
323
        lookup_and_goto_ptr(ctx);
301
    }
324
    }
302
}
325
}
Lines 547-565 static void gen_set_fpr_d(DisasContext *ctx, int reg_num, TCGv_i64 t) Link Here
547
570
548
static void gen_jal(DisasContext *ctx, int rd, target_ulong imm)
571
static void gen_jal(DisasContext *ctx, int rd, target_ulong imm)
549
{
572
{
550
    target_ulong next_pc;
573
    TCGv succ_pc = dest_gpr(ctx, rd);
551
574
552
    /* check misaligned: */
575
    /* check misaligned: */
553
    next_pc = ctx->base.pc_next + imm;
576
    if (!has_ext(ctx, RVC) && !ctx->cfg_ptr->ext_zca) {
554
    if (!ctx->cfg_ptr->ext_zca) {
577
        if ((imm & 0x3) != 0) {
555
        if ((next_pc & 0x3) != 0) {
578
            TCGv target_pc = tcg_temp_new();
556
            gen_exception_inst_addr_mis(ctx);
579
            gen_pc_plus_diff(target_pc, ctx, imm);
580
            gen_exception_inst_addr_mis(ctx, target_pc);
557
            return;
581
            return;
558
        }
582
        }
559
    }
583
    }
560
584
561
    gen_set_gpri(ctx, rd, ctx->pc_succ_insn);
585
    gen_pc_plus_diff(succ_pc, ctx, ctx->cur_insn_len);
562
    gen_goto_tb(ctx, 0, ctx->base.pc_next + imm); /* must use this for safety */
586
    gen_set_gpr(ctx, rd, succ_pc);
587
588
    gen_goto_tb(ctx, 0, imm); /* must use this for safety */
563
    ctx->base.is_jmp = DISAS_NORETURN;
589
    ctx->base.is_jmp = DISAS_NORETURN;
564
}
590
}
565
591
Lines 1117-1131 static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) Link Here
1117
    };
1143
    };
1118
1144
1119
    ctx->virt_inst_excp = false;
1145
    ctx->virt_inst_excp = false;
1146
    ctx->cur_insn_len = insn_len(opcode);
1120
    /* Check for compressed insn */
1147
    /* Check for compressed insn */
1121
    if (insn_len(opcode) == 2) {
1148
    if (ctx->cur_insn_len == 2) {
1122
        ctx->opcode = opcode;
1149
        ctx->opcode = opcode;
1123
        ctx->pc_succ_insn = ctx->base.pc_next + 2;
1124
        /*
1150
        /*
1125
         * The Zca extension is added as way to refer to instructions in the C
1151
         * The Zca extension is added as way to refer to instructions in the C
1126
         * extension that do not include the floating-point loads and stores
1152
         * extension that do not include the floating-point loads and stores
1127
         */
1153
         */
1128
        if (ctx->cfg_ptr->ext_zca && decode_insn16(ctx, opcode)) {
1154
        if ((has_ext(ctx, RVC) || ctx->cfg_ptr->ext_zca) &&
1155
            decode_insn16(ctx, opcode)) {
1129
            return;
1156
            return;
1130
        }
1157
        }
1131
    } else {
1158
    } else {
Lines 1134-1140 static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) Link Here
1134
                             translator_lduw(env, &ctx->base,
1161
                             translator_lduw(env, &ctx->base,
1135
                                             ctx->base.pc_next + 2));
1162
                                             ctx->base.pc_next + 2));
1136
        ctx->opcode = opcode32;
1163
        ctx->opcode = opcode32;
1137
        ctx->pc_succ_insn = ctx->base.pc_next + 4;
1138
1164
1139
        for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) {
1165
        for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) {
1140
            if (decoders[i].guard_func(ctx) &&
1166
            if (decoders[i].guard_func(ctx) &&
Lines 1154-1160 static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) Link Here
1154
    RISCVCPU *cpu = RISCV_CPU(cs);
1180
    RISCVCPU *cpu = RISCV_CPU(cs);
1155
    uint32_t tb_flags = ctx->base.tb->flags;
1181
    uint32_t tb_flags = ctx->base.tb->flags;
1156
1182
1157
    ctx->pc_succ_insn = ctx->base.pc_first;
1183
    ctx->pc_save = ctx->base.pc_first;
1158
    ctx->priv = FIELD_EX32(tb_flags, TB_FLAGS, PRIV);
1184
    ctx->priv = FIELD_EX32(tb_flags, TB_FLAGS, PRIV);
1159
    ctx->mem_idx = FIELD_EX32(tb_flags, TB_FLAGS, MEM_IDX);
1185
    ctx->mem_idx = FIELD_EX32(tb_flags, TB_FLAGS, MEM_IDX);
1160
    ctx->mstatus_fs = FIELD_EX32(tb_flags, TB_FLAGS, FS);
1186
    ctx->mstatus_fs = FIELD_EX32(tb_flags, TB_FLAGS, FS);
Lines 1189-1196 static void riscv_tr_tb_start(DisasContextBase *db, CPUState *cpu) Link Here
1189
static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
1215
static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
1190
{
1216
{
1191
    DisasContext *ctx = container_of(dcbase, DisasContext, base);
1217
    DisasContext *ctx = container_of(dcbase, DisasContext, base);
1218
    target_ulong pc_next = ctx->base.pc_next;
1219
1220
    if (tb_cflags(dcbase->tb) & CF_PCREL) {
1221
        pc_next &= ~TARGET_PAGE_MASK;
1222
    }
1192
1223
1193
    tcg_gen_insn_start(ctx->base.pc_next, 0);
1224
    tcg_gen_insn_start(pc_next, 0);
1194
    ctx->insn_start = tcg_last_op();
1225
    ctx->insn_start = tcg_last_op();
1195
}
1226
}
1196
1227
Lines 1202-1208 static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) Link Here
1202
1233
1203
    ctx->ol = ctx->xl;
1234
    ctx->ol = ctx->xl;
1204
    decode_opc(env, ctx, opcode16);
1235
    decode_opc(env, ctx, opcode16);
1205
    ctx->base.pc_next = ctx->pc_succ_insn;
1236
    ctx->base.pc_next += ctx->cur_insn_len;
1206
1237
1207
    /* Only the first insn within a TB is allowed to cross a page boundary. */
1238
    /* Only the first insn within a TB is allowed to cross a page boundary. */
1208
    if (ctx->base.is_jmp == DISAS_NEXT) {
1239
    if (ctx->base.is_jmp == DISAS_NEXT) {
Lines 1229-1235 static void riscv_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) Link Here
1229
1260
1230
    switch (ctx->base.is_jmp) {
1261
    switch (ctx->base.is_jmp) {
1231
    case DISAS_TOO_MANY:
1262
    case DISAS_TOO_MANY:
1232
        gen_goto_tb(ctx, 0, ctx->base.pc_next);
1263
        gen_goto_tb(ctx, 0, 0);
1233
        break;
1264
        break;
1234
    case DISAS_NORETURN:
1265
    case DISAS_NORETURN:
1235
        break;
1266
        break;
(-)a/target/riscv/vector_helper.c (-21 / +12 lines)
Lines 169-175 static inline uint32_t vext_get_total_elems(CPURISCVState *env, uint32_t desc, Link Here
169
169
170
static inline target_ulong adjust_addr(CPURISCVState *env, target_ulong addr)
170
static inline target_ulong adjust_addr(CPURISCVState *env, target_ulong addr)
171
{
171
{
172
    return (addr & env->cur_pmmask) | env->cur_pmbase;
172
    return (addr & ~env->cur_pmmask) | env->cur_pmbase;
173
}
173
}
174
174
175
/*
175
/*
Lines 264-289 GEN_VEXT_ST_ELEM(ste_h, int16_t, H2, stw) Link Here
264
GEN_VEXT_ST_ELEM(ste_w, int32_t, H4, stl)
264
GEN_VEXT_ST_ELEM(ste_w, int32_t, H4, stl)
265
GEN_VEXT_ST_ELEM(ste_d, int64_t, H8, stq)
265
GEN_VEXT_ST_ELEM(ste_d, int64_t, H8, stq)
266
266
267
static void vext_set_tail_elems_1s(CPURISCVState *env, target_ulong vl,
267
static void vext_set_tail_elems_1s(target_ulong vl, void *vd,
268
                                   void *vd, uint32_t desc, uint32_t nf,
268
                                   uint32_t desc, uint32_t nf,
269
                                   uint32_t esz, uint32_t max_elems)
269
                                   uint32_t esz, uint32_t max_elems)
270
{
270
{
271
    uint32_t total_elems = vext_get_total_elems(env, desc, esz);
272
    uint32_t vlenb = riscv_cpu_cfg(env)->vlen >> 3;
273
    uint32_t vta = vext_vta(desc);
271
    uint32_t vta = vext_vta(desc);
274
    uint32_t registers_used;
275
    int k;
272
    int k;
276
273
274
    if (vta == 0) {
275
        return;
276
    }
277
277
    for (k = 0; k < nf; ++k) {
278
    for (k = 0; k < nf; ++k) {
278
        vext_set_elems_1s(vd, vta, (k * max_elems + vl) * esz,
279
        vext_set_elems_1s(vd, vta, (k * max_elems + vl) * esz,
279
                          (k * max_elems + max_elems) * esz);
280
                          (k * max_elems + max_elems) * esz);
280
    }
281
    }
281
282
    if (nf * max_elems % total_elems != 0) {
283
        registers_used = ((nf * max_elems) * esz + (vlenb - 1)) / vlenb;
284
        vext_set_elems_1s(vd, vta, (nf * max_elems) * esz,
285
                          registers_used * vlenb);
286
    }
287
}
282
}
288
283
289
/*
284
/*
Lines 319-325 vext_ldst_stride(void *vd, void *v0, target_ulong base, Link Here
319
    }
314
    }
320
    env->vstart = 0;
315
    env->vstart = 0;
321
316
322
    vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems);
317
    vext_set_tail_elems_1s(env->vl, vd, desc, nf, esz, max_elems);
323
}
318
}
324
319
325
#define GEN_VEXT_LD_STRIDE(NAME, ETYPE, LOAD_FN)                        \
320
#define GEN_VEXT_LD_STRIDE(NAME, ETYPE, LOAD_FN)                        \
Lines 378-389 vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc, Link Here
378
    }
373
    }
379
    env->vstart = 0;
374
    env->vstart = 0;
380
375
381
    vext_set_tail_elems_1s(env, evl, vd, desc, nf, esz, max_elems);
376
    vext_set_tail_elems_1s(evl, vd, desc, nf, esz, max_elems);
382
}
377
}
383
378
384
/*
379
/*
385
 * masked unit-stride load and store operation will be a special case of
380
 * masked unit-stride load and store operation will be a special case of
386
 * stride, stride = NF * sizeof (MTYPE)
381
 * stride, stride = NF * sizeof (ETYPE)
387
 */
382
 */
388
383
389
#define GEN_VEXT_LD_US(NAME, ETYPE, LOAD_FN)                            \
384
#define GEN_VEXT_LD_US(NAME, ETYPE, LOAD_FN)                            \
Lines 499-505 vext_ldst_index(void *vd, void *v0, target_ulong base, Link Here
499
    }
494
    }
500
    env->vstart = 0;
495
    env->vstart = 0;
501
496
502
    vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems);
497
    vext_set_tail_elems_1s(env->vl, vd, desc, nf, esz, max_elems);
503
}
498
}
504
499
505
#define GEN_VEXT_LD_INDEX(NAME, ETYPE, INDEX_FN, LOAD_FN)                  \
500
#define GEN_VEXT_LD_INDEX(NAME, ETYPE, INDEX_FN, LOAD_FN)                  \
Lines 629-635 ProbeSuccess: Link Here
629
    }
624
    }
630
    env->vstart = 0;
625
    env->vstart = 0;
631
626
632
    vext_set_tail_elems_1s(env, env->vl, vd, desc, nf, esz, max_elems);
627
    vext_set_tail_elems_1s(env->vl, vd, desc, nf, esz, max_elems);
633
}
628
}
634
629
635
#define GEN_VEXT_LDFF(NAME, ETYPE, LOAD_FN)               \
630
#define GEN_VEXT_LDFF(NAME, ETYPE, LOAD_FN)               \
Lines 655-664 GEN_VEXT_LDFF(vle64ff_v, int64_t, lde_d) Link Here
655
#define DO_MAX(N, M)  ((N) >= (M) ? (N) : (M))
650
#define DO_MAX(N, M)  ((N) >= (M) ? (N) : (M))
656
#define DO_MIN(N, M)  ((N) >= (M) ? (M) : (N))
651
#define DO_MIN(N, M)  ((N) >= (M) ? (M) : (N))
657
652
658
/* Unsigned min/max */
659
#define DO_MAXU(N, M) DO_MAX((UMTYPE)N, (UMTYPE)M)
660
#define DO_MINU(N, M) DO_MIN((UMTYPE)N, (UMTYPE)M)
661
662
/*
653
/*
663
 * load and store whole register instructions
654
 * load and store whole register instructions
664
 */
655
 */
(-)a/util/log.c (+2 lines)
Lines 495-500 const QEMULogItem qemu_log_items[] = { Link Here
495
      "log every user-mode syscall, its input, and its result" },
495
      "log every user-mode syscall, its input, and its result" },
496
    { LOG_PER_THREAD, "tid",
496
    { LOG_PER_THREAD, "tid",
497
      "open a separate log file per thread; filename must contain '%d'" },
497
      "open a separate log file per thread; filename must contain '%d'" },
498
    { CPU_LOG_TB_VPU, "vpu",
499
      "include VPU registers in the 'cpu' logging" },
498
    { 0, NULL, NULL },
500
    { 0, NULL, NULL },
499
};
501
};
500
502

Return to bug 908699