From 5f3cf35354d2e2fc45aeb47d85948b427a8e9074 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 7 Apr 2024 17:35:27 -0300 Subject: [PATCH] feat: optimized interpreter with computed gotos --- src/Makefile | 2 - src/interpret-jump-table.h | 2193 ++++++++++++++++++++++++++++++++++++ src/interpret.cpp | 579 +++++----- src/machine.cpp | 1 + src/riscv-constants.h | 152 --- src/soft-float.h | 2 +- 6 files changed, 2495 insertions(+), 434 deletions(-) create mode 100644 src/interpret-jump-table.h diff --git a/src/Makefile b/src/Makefile index 31f2b203c..45d9c3bcc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -205,8 +205,6 @@ ifneq (,$(filter gcc,$(CC))) # but we don't use -O3 because it enables some other flags that are not worth for the interpreter. OPTFLAGS+=-fgcse-after-reload -fpredictive-commoning -fsplit-paths -ftree-partial-pre endif -# Enable large jump tables to improve performance of instruction decoding in interpret.cpp -OPTFLAGS+=-fjump-tables --param jump-table-max-growth-ratio-for-speed=4096 endif # Link time optimizations diff --git a/src/interpret-jump-table.h b/src/interpret-jump-table.h new file mode 100644 index 000000000..9de1731ff --- /dev/null +++ b/src/interpret-jump-table.h @@ -0,0 +1,2193 @@ +// Copyright Cartesi and individual authors (see AUTHORS) +// SPDX-License-Identifier: LGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the Free +// Software Foundation, either version 3 of the License, or (at your option) any +// later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License along +// with this program (see COPYING). If not, see . +// + +#if !defined(NO_COMPUTED_GOTO) && defined(__GNUC__) && !defined(__wasm__) +#define USE_COMPUTED_GOTO +#endif + +#ifdef USE_COMPUTED_GOTO + +// NOLINTBEGIN(cppcoreguidelines-macro-usage) +#define INSN_LABEL(x) &&x +#define INSN_CASE(x) x +#define INSN_BREAK() goto NEXT_INSN +#define INSN_SWITCH(x) goto *insn_jumptable[x]; +#define INSN_SWITCH_OUT() \ + NEXT_INSN: +#define INSN_JUMPTABLE_TYPE void * +// NOLINTEND(cppcoreguidelines-macro-usage) + +#else + +// NOLINTBEGIN(cppcoreguidelines-macro-usage) +#define INSN_LABEL(x) insn_label_id::x +#define INSN_CASE(x) case insn_label_id::x +#define INSN_BREAK() break +#define INSN_SWITCH(x) switch (insn_jumptable[x]) +#define INSN_SWITCH_OUT() +#define INSN_JUMPTABLE_TYPE insn_label_id +// NOLINTEND(cppcoreguidelines-macro-usage) + +enum class insn_label_id : uint8_t { + ILLEGAL, + LB, + LH, + LW, + LD, + LBU, + LHU, + LWU, + SB, + SH, + SW, + SD, + FENCE, + FENCE_I, + ADDI, + SLLI, + SLTI, + SLTIU, + XORI, + ORI, + ANDI, + ADDIW, + SLLIW, + SLLW, + DIVW, + REMW, + REMUW, + BEQ, + BNE, + BLT, + BGE, + BLTU, + BGEU, + JALR, + CSRRW, + CSRRS, + CSRRC, + CSRRWI, + CSRRSI, + CSRRCI, + AUIPC, + LUI, + JAL, + SRLI_SRAI, + SRLIW_SRAIW, + AMO_W, + AMO_D, + ADD_MUL_SUB, + SLL_MULH, + SLT_MULHSU, + SLTU_MULHU, + XOR_DIV, + SRL_DIVU_SRA, + OR_REM, + AND_REMU, + ADDW_MULW_SUBW, + SRLW_DIVUW_SRAW, + PRIVILEGED, + FSW, + FSD, + FLW, + FLD, + FMADD, + FMSUB, + FNMSUB, + FNMADD, + FD, + C_ADDI4SPN, + C_LW, + C_LD, + C_SW, + C_SD, + C_Q1_SET0, + C_ADDIW, + C_LI, + C_Q1_SET1, + C_Q1_SET2, + C_J, + C_BEQZ, + C_BNEZ, + C_SLLI, + C_LWSP, + C_LDSP, + C_Q2_SET0, + C_SWSP, + C_SDSP, + C_FLD, + C_FSD, + C_FLDSP, + C_FSDSP, +}; + +#endif + +#pragma GCC diagnostic ignored "-Wpedantic" +#pragma GCC diagnostic push + +// This table is auto generated +static const INSN_JUMPTABLE_TYPE insn_jumptable[2048] = { + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(LB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FENCE), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ADDI), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(AUIPC), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ADDIW), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ADD_MUL_SUB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(LUI), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ADDW_MULW_SUBW), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FMADD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FMSUB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FNMADD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(BEQ), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(JALR), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(JAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(PRIVILEGED), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(LH), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FENCE_I), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SLLI), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(AUIPC), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SLLIW), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SH), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SLL_MULH), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(LUI), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(SLLW), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FMADD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FMSUB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FNMADD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(FD), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(BNE), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(JAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(CSRRW), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_ADDI4SPN), + INSN_LABEL(C_Q1_SET0), + INSN_LABEL(C_SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(LW), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FLW), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SLTI), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SW), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FSW), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(AMO_W), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SLT_MULHSU), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(CSRRS), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(LD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FLD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SLTIU), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FSD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(AMO_D), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(SLTU_MULHU), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(FD), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(CSRRC), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FLD), + INSN_LABEL(C_ADDIW), + INSN_LABEL(C_FLDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(LBU), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(XORI), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(XOR_DIV), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(LUI), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(DIVW), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(FD), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(BLT), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(JAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(LHU), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(SRLI_SRAI), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(SRLIW_SRAIW), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(SRL_DIVU_SRA), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(LUI), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(SRLW_DIVUW_SRAW), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(BGE), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(JAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(CSRRWI), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LW), + INSN_LABEL(C_LI), + INSN_LABEL(C_LWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(LWU), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ORI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(OR_REM), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(REMW), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(BLTU), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(CSRRSI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ANDI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(AND_REMU), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(REMUW), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(FD), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(BGEU), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(CSRRCI), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_LD), + INSN_LABEL(C_Q1_SET1), + INSN_LABEL(C_LDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(LB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FENCE), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ADDI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(AUIPC), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ADDIW), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ADD_MUL_SUB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(LUI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ADDW_MULW_SUBW), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FMADD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FMSUB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FNMSUB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FNMADD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(BEQ), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(JALR), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(JAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(PRIVILEGED), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(LH), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FENCE_I), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SLLI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(AUIPC), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SLLIW), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SH), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SLL_MULH), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(LUI), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(SLLW), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FMADD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FMSUB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FNMSUB), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FNMADD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(FD), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(BNE), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(JAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(CSRRW), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_Q1_SET2), + INSN_LABEL(C_Q2_SET0), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(LW), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FLW), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SLTI), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SW), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FSW), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(AMO_W), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SLT_MULHSU), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(CSRRS), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(LD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FLD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SLTIU), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FSD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(AMO_D), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(SLTU_MULHU), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(FD), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(CSRRC), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_FSD), + INSN_LABEL(C_J), + INSN_LABEL(C_FSDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(LBU), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(XORI), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(XOR_DIV), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(LUI), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(DIVW), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(FD), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(BLT), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(JAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(LHU), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(SRLI_SRAI), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(SRLIW_SRAIW), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(SRL_DIVU_SRA), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(LUI), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(SRLW_DIVUW_SRAW), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(BGE), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(JAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(CSRRWI), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SW), + INSN_LABEL(C_BEQZ), + INSN_LABEL(C_SWSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(LWU), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ORI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(OR_REM), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(REMW), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(BLTU), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(CSRRSI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ANDI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(AUIPC), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(AND_REMU), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(LUI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(REMUW), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(FMADD), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(FMSUB), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(FNMSUB), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(FNMADD), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(FD), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(BGEU), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(JAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(CSRRCI), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), + INSN_LABEL(C_SD), + INSN_LABEL(C_BNEZ), + INSN_LABEL(C_SDSP), + INSN_LABEL(ILLEGAL), +}; +#pragma GCC diagnostic pop diff --git a/src/interpret.cpp b/src/interpret.cpp index cbdde6c3c..26f5cab30 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -533,10 +533,10 @@ static inline void set_rtc_interrupt(STATE_ACCESS &a, uint64_t mcycle) { } } -/// \brief Obtains the funct3 and opcode fields an instruction. +/// \brief Obtains the id fields an instruction. /// \param insn Instruction. -static FORCE_INLINE uint32_t insn_get_funct3_opcode(uint32_t insn) { - return ((insn >> 5) & 0b111'0000000) | (insn & 0b1111111); +static FORCE_INLINE uint32_t insn_get_id(uint32_t insn) { + return ((insn >> 5) & 0b1111'0000000) | (insn & 0b1111111); } /// \brief Obtains the funct3 and trailing 0 bits from an instruction. @@ -658,12 +658,6 @@ static inline uint32_t insn_get_rs3(uint32_t insn) { return (insn >> 27); } -/// \brief Obtains the compressed instruction funct3 and opcode fields an instruction. -/// \param insn Instruction. -static FORCE_INLINE uint32_t insn_get_c_funct3(uint32_t insn) { - return ((insn >> 11) & 0b111'00) | (insn & 0b11); -} - /// \brief Obtains the compressed instruction funct6, funct2 and opcode fields an instruction. /// \param insn Instruction. static inline uint32_t insn_get_CA_funct6_funct2(uint32_t insn) { @@ -5128,18 +5122,20 @@ static FORCE_INLINE execute_status execute_C_Q2_SET0(STATE_ACCESS &a, uint64_t & const uint32_t rs1 = insn_get_rd(insn); const uint32_t rs2 = insn_get_CR_CSS_rs2(insn); if (insn & 0b0001000000000000) { - if (rs2 == 0) { - if (rs1 == 0) { - return execute_C_EBREAK(a, pc, insn); - } + if (rs2 != 0) { + return execute_C_ADD(a, pc, insn, rs1, rs2); + } else if (rs1 != 0) { return execute_C_JALR(a, pc, insn, rs1); + } else { + return execute_C_EBREAK(a, pc, insn); + } + } else { + if (rs2 != 0) { + return execute_C_MV(a, pc, insn, rs1, rs2); + } else { + return execute_C_JR(a, pc, insn, rs1); } - return execute_C_ADD(a, pc, insn, rs1, rs2); - } - if (rs2 == 0) { - return execute_C_JR(a, pc, insn, rs1); } - return execute_C_MV(a, pc, insn, rs1, rs2); } /// \brief Implementation of the C.FSDSP instruction. @@ -5174,265 +5170,6 @@ static FORCE_INLINE execute_status execute_C_SDSP(STATE_ACCESS &a, uint64_t &pc, return execute_C_S(a, pc, mcycle, rs2, 0x2, imm); } -/// \brief Decodes and executes an instruction. -/// \tparam STATE_ACCESS Class of machine state accessor object. -/// \param a Machine state accessor object. -/// \param pc Current pc. -/// \param insn Instruction. -/// \return execute_status::failure if an exception was raised, or -/// execute_status::success otherwise. -/// \details The execute_insn function decodes the instruction in multiple levels. When we know for sure that -/// the instruction could only be a <FOO>, a function with the name execute_<FOO> will be called. -/// See [RV32/64G Instruction Set -/// Listings](https://content.riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf#chapter.19) and [Instruction -/// listings for RISC-V](https://content.riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf#table.19.2). -template -static FORCE_INLINE execute_status execute_insn(STATE_ACCESS &a, uint64_t &pc, uint64_t &mcycle, uint32_t insn) { - // Is compressed instruction - if ((insn & 3) != 3) { - // The fetch may read 4 bytes as an optimization, - // but the compressed instruction uses only the 2 less significant bytes - insn = static_cast(insn); - auto c_funct3 = static_cast(insn_get_c_funct3(insn)); - switch (c_funct3) { - case insn_c_funct3::C_ADDI4SPN: - return execute_C_ADDI4SPN(a, pc, insn); - case insn_c_funct3::C_LW: - return execute_C_LW(a, pc, mcycle, insn); - case insn_c_funct3::C_LD: - return execute_C_LD(a, pc, mcycle, insn); - case insn_c_funct3::C_SW: - return execute_C_SW(a, pc, mcycle, insn); - case insn_c_funct3::C_SD: - return execute_C_SD(a, pc, mcycle, insn); - case insn_c_funct3::C_Q1_SET0: - return execute_C_Q1_SET0(a, pc, insn); - case insn_c_funct3::C_ADDIW: - return execute_C_ADDIW(a, pc, insn); - case insn_c_funct3::C_LI: - return execute_C_LI(a, pc, insn); - case insn_c_funct3::C_Q1_SET1: - return execute_C_Q1_SET1(a, pc, insn); - case insn_c_funct3::C_Q1_SET2: - return execute_C_Q1_SET2(a, pc, insn); - case insn_c_funct3::C_J: - return execute_C_J(a, pc, insn); - case insn_c_funct3::C_BEQZ: - return execute_C_BEQZ(a, pc, insn); - case insn_c_funct3::C_BNEZ: - return execute_C_BNEZ(a, pc, insn); - case insn_c_funct3::C_SLLI: - return execute_C_SLLI(a, pc, insn); - case insn_c_funct3::C_LWSP: - return execute_C_LWSP(a, pc, mcycle, insn); - case insn_c_funct3::C_LDSP: - return execute_C_LDSP(a, pc, mcycle, insn); - case insn_c_funct3::C_Q2_SET0: - return execute_C_Q2_SET0(a, pc, insn); - case insn_c_funct3::C_SWSP: - return execute_C_SWSP(a, pc, mcycle, insn); - case insn_c_funct3::C_SDSP: - return execute_C_SDSP(a, pc, mcycle, insn); - case insn_c_funct3::C_FLD: - return execute_C_FLD(a, pc, mcycle, insn); - case insn_c_funct3::C_FSD: - return execute_C_FSD(a, pc, mcycle, insn); - case insn_c_funct3::C_FLDSP: - return execute_C_FLDSP(a, pc, mcycle, insn); - case insn_c_funct3::C_FSDSP: - return execute_C_FSDSP(a, pc, mcycle, insn); - default: - return raise_illegal_insn_exception(a, pc, insn); - } - } else { - auto funct3_opcode = static_cast(insn_get_funct3_opcode(insn)); - // This switch will be optimized as a single jump in conjuction with GCC flags - // -fjump-tables --param jump-table-max-growth-ratio-for-speed=4096 - switch (funct3_opcode) { - case insn_funct3_opcode::LB: - return execute_LB(a, pc, mcycle, insn); - case insn_funct3_opcode::LH: - return execute_LH(a, pc, mcycle, insn); - case insn_funct3_opcode::LW: - return execute_LW(a, pc, mcycle, insn); - case insn_funct3_opcode::LD: - return execute_LD(a, pc, mcycle, insn); - case insn_funct3_opcode::LBU: - return execute_LBU(a, pc, mcycle, insn); - case insn_funct3_opcode::LHU: - return execute_LHU(a, pc, mcycle, insn); - case insn_funct3_opcode::LWU: - return execute_LWU(a, pc, mcycle, insn); - case insn_funct3_opcode::SB: - return execute_SB(a, pc, mcycle, insn); - case insn_funct3_opcode::SH: - return execute_SH(a, pc, mcycle, insn); - case insn_funct3_opcode::SW: - return execute_SW(a, pc, mcycle, insn); - case insn_funct3_opcode::SD: - return execute_SD(a, pc, mcycle, insn); - case insn_funct3_opcode::FENCE: - return execute_FENCE(a, pc, insn); - case insn_funct3_opcode::FENCE_I: - return execute_FENCE_I(a, pc, insn); - case insn_funct3_opcode::ADDI: - return execute_ADDI(a, pc, insn); - case insn_funct3_opcode::SLLI: - return execute_SLLI(a, pc, insn); - case insn_funct3_opcode::SLTI: - return execute_SLTI(a, pc, insn); - case insn_funct3_opcode::SLTIU: - return execute_SLTIU(a, pc, insn); - case insn_funct3_opcode::XORI: - return execute_XORI(a, pc, insn); - case insn_funct3_opcode::ORI: - return execute_ORI(a, pc, insn); - case insn_funct3_opcode::ANDI: - return execute_ANDI(a, pc, insn); - case insn_funct3_opcode::ADDIW: - return execute_ADDIW(a, pc, insn); - case insn_funct3_opcode::SLLIW: - return execute_SLLIW(a, pc, insn); - case insn_funct3_opcode::SLLW: - return execute_SLLW(a, pc, insn); - case insn_funct3_opcode::DIVW: - return execute_DIVW(a, pc, insn); - case insn_funct3_opcode::REMW: - return execute_REMW(a, pc, insn); - case insn_funct3_opcode::REMUW: - return execute_REMUW(a, pc, insn); - case insn_funct3_opcode::BEQ: - return execute_BEQ(a, pc, insn); - case insn_funct3_opcode::BNE: - return execute_BNE(a, pc, insn); - case insn_funct3_opcode::BLT: - return execute_BLT(a, pc, insn); - case insn_funct3_opcode::BGE: - return execute_BGE(a, pc, insn); - case insn_funct3_opcode::BLTU: - return execute_BLTU(a, pc, insn); - case insn_funct3_opcode::BGEU: - return execute_BGEU(a, pc, insn); - case insn_funct3_opcode::JALR: - return execute_JALR(a, pc, insn); - case insn_funct3_opcode::CSRRW: - return execute_CSRRW(a, pc, mcycle, insn); - case insn_funct3_opcode::CSRRS: - return execute_CSRRS(a, pc, mcycle, insn); - case insn_funct3_opcode::CSRRC: - return execute_CSRRC(a, pc, mcycle, insn); - case insn_funct3_opcode::CSRRWI: - return execute_CSRRWI(a, pc, mcycle, insn); - case insn_funct3_opcode::CSRRSI: - return execute_CSRRSI(a, pc, mcycle, insn); - case insn_funct3_opcode::CSRRCI: - return execute_CSRRCI(a, pc, mcycle, insn); - case insn_funct3_opcode::AUIPC_000: - case insn_funct3_opcode::AUIPC_001: - case insn_funct3_opcode::AUIPC_010: - case insn_funct3_opcode::AUIPC_011: - case insn_funct3_opcode::AUIPC_100: - case insn_funct3_opcode::AUIPC_101: - case insn_funct3_opcode::AUIPC_110: - case insn_funct3_opcode::AUIPC_111: - return execute_AUIPC(a, pc, insn); - case insn_funct3_opcode::LUI_000: - case insn_funct3_opcode::LUI_001: - case insn_funct3_opcode::LUI_010: - case insn_funct3_opcode::LUI_011: - case insn_funct3_opcode::LUI_100: - case insn_funct3_opcode::LUI_101: - case insn_funct3_opcode::LUI_110: - case insn_funct3_opcode::LUI_111: - return execute_LUI(a, pc, insn); - case insn_funct3_opcode::JAL_000: - case insn_funct3_opcode::JAL_001: - case insn_funct3_opcode::JAL_010: - case insn_funct3_opcode::JAL_011: - case insn_funct3_opcode::JAL_100: - case insn_funct3_opcode::JAL_101: - case insn_funct3_opcode::JAL_110: - case insn_funct3_opcode::JAL_111: - return execute_JAL(a, pc, insn); - case insn_funct3_opcode::SRLI_SRAI: - return execute_SRLI_SRAI(a, pc, insn); - case insn_funct3_opcode::SRLIW_SRAIW: - return execute_SRLIW_SRAIW(a, pc, insn); - case insn_funct3_opcode::AMO_W: - return execute_AMO_W(a, pc, mcycle, insn); - case insn_funct3_opcode::AMO_D: - return execute_AMO_D(a, pc, mcycle, insn); - case insn_funct3_opcode::ADD_MUL_SUB: - return execute_ADD_MUL_SUB(a, pc, insn); - case insn_funct3_opcode::SLL_MULH: - return execute_SLL_MULH(a, pc, insn); - case insn_funct3_opcode::SLT_MULHSU: - return execute_SLT_MULHSU(a, pc, insn); - case insn_funct3_opcode::SLTU_MULHU: - return execute_SLTU_MULHU(a, pc, insn); - case insn_funct3_opcode::XOR_DIV: - return execute_XOR_DIV(a, pc, insn); - case insn_funct3_opcode::SRL_DIVU_SRA: - return execute_SRL_DIVU_SRA(a, pc, insn); - case insn_funct3_opcode::OR_REM: - return execute_OR_REM(a, pc, insn); - case insn_funct3_opcode::AND_REMU: - return execute_AND_REMU(a, pc, insn); - case insn_funct3_opcode::ADDW_MULW_SUBW: - return execute_ADDW_MULW_SUBW(a, pc, insn); - case insn_funct3_opcode::SRLW_DIVUW_SRAW: - return execute_SRLW_DIVUW_SRAW(a, pc, insn); - case insn_funct3_opcode::PRIVILEGED: - return execute_privileged(a, pc, mcycle, insn); - case insn_funct3_opcode::FSW: - return execute_FSW(a, pc, mcycle, insn); - case insn_funct3_opcode::FSD: - return execute_FSD(a, pc, mcycle, insn); - case insn_funct3_opcode::FLW: - return execute_FLW(a, pc, mcycle, insn); - case insn_funct3_opcode::FLD: - return execute_FLD(a, pc, mcycle, insn); - case insn_funct3_opcode::FMADD_RNE: - case insn_funct3_opcode::FMADD_RTZ: - case insn_funct3_opcode::FMADD_RDN: - case insn_funct3_opcode::FMADD_RUP: - case insn_funct3_opcode::FMADD_RMM: - case insn_funct3_opcode::FMADD_DYN: - return execute_FMADD(a, pc, insn); - case insn_funct3_opcode::FMSUB_RNE: - case insn_funct3_opcode::FMSUB_RTZ: - case insn_funct3_opcode::FMSUB_RDN: - case insn_funct3_opcode::FMSUB_RUP: - case insn_funct3_opcode::FMSUB_RMM: - case insn_funct3_opcode::FMSUB_DYN: - return execute_FMSUB(a, pc, insn); - case insn_funct3_opcode::FNMSUB_RNE: - case insn_funct3_opcode::FNMSUB_RTZ: - case insn_funct3_opcode::FNMSUB_RDN: - case insn_funct3_opcode::FNMSUB_RUP: - case insn_funct3_opcode::FNMSUB_RMM: - case insn_funct3_opcode::FNMSUB_DYN: - return execute_FNMSUB(a, pc, insn); - case insn_funct3_opcode::FNMADD_RNE: - case insn_funct3_opcode::FNMADD_RTZ: - case insn_funct3_opcode::FNMADD_RDN: - case insn_funct3_opcode::FNMADD_RUP: - case insn_funct3_opcode::FNMADD_RMM: - case insn_funct3_opcode::FNMADD_DYN: - return execute_FNMADD(a, pc, insn); - case insn_funct3_opcode::FD_000: - case insn_funct3_opcode::FD_001: - case insn_funct3_opcode::FD_010: - case insn_funct3_opcode::FD_011: - case insn_funct3_opcode::FD_100: - case insn_funct3_opcode::FD_111: - return execute_FD(a, pc, insn); - default: - return raise_illegal_insn_exception(a, pc, insn); - } - } -} - /// \brief Instruction fetch status code enum class fetch_status : int { exception, ///< Instruction fetch failed: exception raised @@ -5625,8 +5362,292 @@ static NO_INLINE execute_status interpret_loop(STATE_ACCESS &a, uint64_t mcycle_ // Try to fetch the next instruction if (likely(fetch_insn(a, pc, insn, fetch_vaddr_page, fetch_vh_offset) == fetch_status::success)) { - // Try to execute it - const execute_status status = execute_insn(a, pc, mcycle, insn); + // clang-format off + + // NOLINTNEXTLINE(cppcoreguidelines-init-variables) + execute_status status; // explicit uninitialized as an optimization + + // This header define the instruction jump table table, which is very large. + // It also defines the jump table related macros used in the next big switch. + #include "interpret-jump-table.h" + + // This will use computed goto on supported compilers, + // otherwise normal switch in unsupported platforms. + INSN_SWITCH(insn_get_id(insn)) { + INSN_CASE(LB): + status = execute_LB(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LH): + status = execute_LH(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LW): + status = execute_LW(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LD): + status = execute_LD(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LBU): + status = execute_LBU(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LHU): + status = execute_LHU(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(LWU): + status = execute_LWU(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(SB): + status = execute_SB(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(SH): + status = execute_SH(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(SW): + status = execute_SW(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(SD): + status = execute_SD(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FENCE): + status = execute_FENCE(a, pc, insn); + INSN_BREAK(); + INSN_CASE(FENCE_I): + status = execute_FENCE_I(a, pc, insn); + INSN_BREAK(); + INSN_CASE(ADDI): + status = execute_ADDI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLLI): + status = execute_SLLI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLTI): + status = execute_SLTI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLTIU): + status = execute_SLTIU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(XORI): + status = execute_XORI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(ORI): + status = execute_ORI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(ANDI): + status = execute_ANDI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(ADDIW): + status = execute_ADDIW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLLIW): + status = execute_SLLIW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLLW): + status = execute_SLLW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(DIVW): + status = execute_DIVW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(REMW): + status = execute_REMW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(REMUW): + status = execute_REMUW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BEQ): + status = execute_BEQ(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BNE): + status = execute_BNE(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BLT): + status = execute_BLT(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BGE): + status = execute_BGE(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BLTU): + status = execute_BLTU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(BGEU): + status = execute_BGEU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(JALR): + status = execute_JALR(a, pc, insn); + INSN_BREAK(); + INSN_CASE(CSRRW): + status = execute_CSRRW(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(CSRRS): + status = execute_CSRRS(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(CSRRC): + status = execute_CSRRC(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(CSRRWI): + status = execute_CSRRWI(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(CSRRSI): + status = execute_CSRRSI(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(CSRRCI): + status = execute_CSRRCI(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(AUIPC): + status = execute_AUIPC(a, pc, insn); + INSN_BREAK(); + INSN_CASE(LUI): + status = execute_LUI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(JAL): + status = execute_JAL(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SRLI_SRAI): + status = execute_SRLI_SRAI(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SRLIW_SRAIW): + status = execute_SRLIW_SRAIW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(AMO_W): + status = execute_AMO_W(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(AMO_D): + status = execute_AMO_D(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(ADD_MUL_SUB): + status = execute_ADD_MUL_SUB(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLL_MULH): + status = execute_SLL_MULH(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLT_MULHSU): + status = execute_SLT_MULHSU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SLTU_MULHU): + status = execute_SLTU_MULHU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(XOR_DIV): + status = execute_XOR_DIV(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SRL_DIVU_SRA): + status = execute_SRL_DIVU_SRA(a, pc, insn); + INSN_BREAK(); + INSN_CASE(OR_REM): + status = execute_OR_REM(a, pc, insn); + INSN_BREAK(); + INSN_CASE(AND_REMU): + status = execute_AND_REMU(a, pc, insn); + INSN_BREAK(); + INSN_CASE(ADDW_MULW_SUBW): + status = execute_ADDW_MULW_SUBW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(SRLW_DIVUW_SRAW): + status = execute_SRLW_DIVUW_SRAW(a, pc, insn); + INSN_BREAK(); + INSN_CASE(PRIVILEGED): + status = execute_privileged(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FSW): + status = execute_FSW(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FSD): + status = execute_FSD(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FLW): + status = execute_FLW(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FLD): + status = execute_FLD(a, pc, mcycle, insn); + INSN_BREAK(); + INSN_CASE(FMADD): + status = execute_FMADD(a, pc, insn); + INSN_BREAK(); + INSN_CASE(FMSUB): + status = execute_FMSUB(a, pc, insn); + INSN_BREAK(); + INSN_CASE(FNMSUB): + status = execute_FNMSUB(a, pc, insn); + INSN_BREAK(); + INSN_CASE(FNMADD): + status = execute_FNMADD(a, pc, insn); + INSN_BREAK(); + INSN_CASE(FD): + status = execute_FD(a, pc, insn); + INSN_BREAK(); + INSN_CASE(C_ADDI4SPN): + status = execute_C_ADDI4SPN(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_LW): + status = execute_C_LW(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_LD): + status = execute_C_LD(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_SW): + status = execute_C_SW(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_SD): + status = execute_C_SD(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_Q1_SET0): + status = execute_C_Q1_SET0(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_ADDIW): + status = execute_C_ADDIW(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_LI): + status = execute_C_LI(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_Q1_SET1): + status = execute_C_Q1_SET1(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_Q1_SET2): + status = execute_C_Q1_SET2(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_J): + status = execute_C_J(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_BEQZ): + status = execute_C_BEQZ(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_BNEZ): + status = execute_C_BNEZ(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_SLLI): + status = execute_C_SLLI(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_LWSP): + status = execute_C_LWSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_LDSP): + status = execute_C_LDSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_Q2_SET0): + status = execute_C_Q2_SET0(a, pc, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_SWSP): + status = execute_C_SWSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_SDSP): + status = execute_C_SDSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_FLD): + status = execute_C_FLD(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_FSD): + status = execute_C_FSD(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_FLDSP): + status = execute_C_FLDSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(C_FSDSP): + status = execute_C_FSDSP(a, pc, mcycle, static_cast(insn)); + INSN_BREAK(); + INSN_CASE(ILLEGAL): + status = raise_illegal_insn_exception(a, pc, ((insn & 3) != 3) ? static_cast(insn) : insn); + INSN_BREAK(); + } + INSN_SWITCH_OUT(); + + // clang-format on // When execute status is above success, we have to deal with special loop conditions, // this is very unlikely to happen most of the time diff --git a/src/machine.cpp b/src/machine.cpp index 16778de5e..8ee1b385f 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -17,6 +17,7 @@ #include "machine.h" #include +#include #include #include #include diff --git a/src/riscv-constants.h b/src/riscv-constants.h index d3132df8b..50cf8c966 100644 --- a/src/riscv-constants.h +++ b/src/riscv-constants.h @@ -630,40 +630,6 @@ enum class CSR_address : uint32_t { tdata3 = 0x7a3, }; -/// \brief The result of insn_get_c_funct3(insn) can be used to identify -/// most compressed instructions directly -enum class insn_c_funct3 : uint32_t { - // Quadrant 0 - C_ADDI4SPN = 0b000'00, - C_FLD = 0b001'00, - C_LW = 0b010'00, - C_LD = 0b011'00, - C_FSD = 0b101'00, - C_SW = 0b110'00, - C_SD = 0b111'00, - - // Quadrant 1 - C_Q1_SET0 = 0b000'01, // C_NOP and C_ADDI - C_ADDIW = 0b001'01, - C_LI = 0b010'01, - C_Q1_SET1 = 0b011'01, // C_ADDI16SP and C_LUI - C_Q1_SET2 = 0b100'01, // C_SRLI64, C_SRAI64, C_ANDI, C_SUB - // C_XOR, C_OR, C_AND, C_SUBW and C_ADDW - C_J = 0b101'01, - C_BEQZ = 0b110'01, - C_BNEZ = 0b111'01, - - // Quadrant 2 - C_SLLI = 0b000'10, - C_FLDSP = 0b001'10, - C_LWSP = 0b010'10, - C_LDSP = 0b011'10, - C_Q2_SET0 = 0b100'10, // C_JR, C_MV, C_EBREAK, C_JALR, C_ADD - C_FSDSP = 0b101'10, - C_SWSP = 0b110'10, - C_SDSP = 0b111'10, -}; - /// \brief The result of insn & 0b1110110000000011 can be used to identify /// most compressed instructions directly enum class insn_CB_funct2 : uint32_t { @@ -683,124 +649,6 @@ enum class insn_CA_funct6_funct2 : uint32_t { C_ADDW = 0b1001110000100001, }; -/// \brief The result of insn_get_funct3_opcode(insn), can be used to identify -/// most instructions directly -enum class insn_funct3_opcode : uint32_t { - LB = 0b000'0000011, - LH = 0b001'0000011, - LW = 0b010'0000011, - LD = 0b011'0000011, - LBU = 0b100'0000011, - LHU = 0b101'0000011, - LWU = 0b110'0000011, - SB = 0b000'0100011, - SH = 0b001'0100011, - SW = 0b010'0100011, - SD = 0b011'0100011, - FENCE = 0b000'0001111, - FENCE_I = 0b001'0001111, - ADDI = 0b000'0010011, - SLLI = 0b001'0010011, - SLTI = 0b010'0010011, - SLTIU = 0b011'0010011, - XORI = 0b100'0010011, - ORI = 0b110'0010011, - ANDI = 0b111'0010011, - ADDIW = 0b000'0011011, - SLLIW = 0b001'0011011, - SLLW = 0b001'0111011, - DIVW = 0b100'0111011, - REMW = 0b110'0111011, - REMUW = 0b111'0111011, - BEQ = 0b000'1100011, - BNE = 0b001'1100011, - BLT = 0b100'1100011, - BGE = 0b101'1100011, - BLTU = 0b110'1100011, - BGEU = 0b111'1100011, - JALR = 0b000'1100111, - CSRRW = 0b001'1110011, - CSRRS = 0b010'1110011, - CSRRC = 0b011'1110011, - CSRRWI = 0b101'1110011, - CSRRSI = 0b110'1110011, - CSRRCI = 0b111'1110011, - AUIPC_000 = 0b000'0010111, - AUIPC_001 = 0b001'0010111, - AUIPC_010 = 0b010'0010111, - AUIPC_011 = 0b011'0010111, - AUIPC_100 = 0b100'0010111, - AUIPC_101 = 0b101'0010111, - AUIPC_110 = 0b110'0010111, - AUIPC_111 = 0b111'0010111, - LUI_000 = 0b000'0110111, - LUI_001 = 0b001'0110111, - LUI_010 = 0b010'0110111, - LUI_011 = 0b011'0110111, - LUI_100 = 0b100'0110111, - LUI_101 = 0b101'0110111, - LUI_110 = 0b110'0110111, - LUI_111 = 0b111'0110111, - JAL_000 = 0b000'1101111, - JAL_001 = 0b001'1101111, - JAL_010 = 0b010'1101111, - JAL_011 = 0b011'1101111, - JAL_100 = 0b100'1101111, - JAL_101 = 0b101'1101111, - JAL_110 = 0b110'1101111, - JAL_111 = 0b111'1101111, - FSW = 0b010'0100111, - FSD = 0b011'0100111, - FLW = 0b010'0000111, - FLD = 0b011'0000111, - FMADD_RNE = 0b000'1000011, - FMADD_RTZ = 0b001'1000011, - FMADD_RDN = 0b010'1000011, - FMADD_RUP = 0b011'1000011, - FMADD_RMM = 0b100'1000011, - FMADD_DYN = 0b111'1000011, - FMSUB_RNE = 0b000'1000111, - FMSUB_RTZ = 0b001'1000111, - FMSUB_RDN = 0b010'1000111, - FMSUB_RUP = 0b011'1000111, - FMSUB_RMM = 0b100'1000111, - FMSUB_DYN = 0b111'1000111, - FNMSUB_RNE = 0b000'1001011, - FNMSUB_RTZ = 0b001'1001011, - FNMSUB_RDN = 0b010'1001011, - FNMSUB_RUP = 0b011'1001011, - FNMSUB_RMM = 0b100'1001011, - FNMSUB_DYN = 0b111'1001011, - FNMADD_RNE = 0b000'1001111, - FNMADD_RTZ = 0b001'1001111, - FNMADD_RDN = 0b010'1001111, - FNMADD_RUP = 0b011'1001111, - FNMADD_RMM = 0b100'1001111, - FNMADD_DYN = 0b111'1001111, - // some instructions need additional inspection of funct7 (or part thereof) - FD_000 = 0b000'1010011, - FD_001 = 0b001'1010011, - FD_010 = 0b010'1010011, - FD_011 = 0b011'1010011, - FD_100 = 0b100'1010011, - FD_111 = 0b111'1010011, - SRLI_SRAI = 0b101'0010011, - SRLIW_SRAIW = 0b101'0011011, - AMO_W = 0b010'0101111, - AMO_D = 0b011'0101111, - ADD_MUL_SUB = 0b000'0110011, - SLL_MULH = 0b001'0110011, - SLT_MULHSU = 0b010'0110011, - SLTU_MULHU = 0b011'0110011, - XOR_DIV = 0b100'0110011, - SRL_DIVU_SRA = 0b101'0110011, - OR_REM = 0b110'0110011, - AND_REMU = 0b111'0110011, - ADDW_MULW_SUBW = 0b000'0111011, - SRLW_DIVUW_SRAW = 0b101'0111011, - PRIVILEGED = 0b000'1110011, -}; - /// \brief The result of insn >> 26 (6 most significant bits of funct7) can be /// used to identify the SRI instructions enum insn_SRLI_SRAI_funct7_sr1 : uint32_t { SRLI = 0b000000, SRAI = 0b010000 }; diff --git a/src/soft-float.h b/src/soft-float.h index 77c5bed1c..95e138237 100644 --- a/src/soft-float.h +++ b/src/soft-float.h @@ -194,7 +194,7 @@ struct i_sfloat { /// \brief Right shift that takes rounding in account, used for adjust mantissa. static inline F_UINT mant_rshift_rnd(F_UINT a, int d) { - if (d != 0) { + if (d > 0) { if (d >= F_SIZE) { return (a != 0); } else {