mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
target/riscv: Reassign instructions to the Zba-extension
The following instructions are part of Zba: - add.uw (RV64 only) - sh[123]add (RV32 and RV64) - sh[123]add.uw (RV64-only) - slli.uw (RV64-only) Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: Bin Meng <bmeng.cn@gmail.com> Message-id: 20210911140016.834071-6-philipp.tomsich@vrull.eu Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
878dd0e9ac
commit
bb4dc158e0
2 changed files with 23 additions and 13 deletions
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* RISC-V translation routines for the RVB Standard Extension.
|
||||
* RISC-V translation routines for the RVB draft and Zba Standard Extension.
|
||||
*
|
||||
* Copyright (c) 2020 Kito Cheng, kito.cheng@sifive.com
|
||||
* Copyright (c) 2020 Frank Chang, frank.chang@sifive.com
|
||||
* Copyright (c) 2021 Philipp Tomsich, philipp.tomsich@vrull.eu
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -17,6 +18,11 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define REQUIRE_ZBA(ctx) do { \
|
||||
if (!RISCV_CPU(ctx->cs)->cfg.ext_zba) { \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void gen_clz(TCGv ret, TCGv arg1)
|
||||
{
|
||||
|
@ -339,7 +345,7 @@ GEN_SHADD(3)
|
|||
#define GEN_TRANS_SHADD(SHAMT) \
|
||||
static bool trans_sh##SHAMT##add(DisasContext *ctx, arg_sh##SHAMT##add *a) \
|
||||
{ \
|
||||
REQUIRE_EXT(ctx, RVB); \
|
||||
REQUIRE_ZBA(ctx); \
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_sh##SHAMT##add); \
|
||||
}
|
||||
|
||||
|
@ -616,7 +622,7 @@ static bool trans_sh##SHAMT##add_uw(DisasContext *ctx, \
|
|||
arg_sh##SHAMT##add_uw *a) \
|
||||
{ \
|
||||
REQUIRE_64BIT(ctx); \
|
||||
REQUIRE_EXT(ctx, RVB); \
|
||||
REQUIRE_ZBA(ctx); \
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_sh##SHAMT##add_uw); \
|
||||
}
|
||||
|
||||
|
@ -635,7 +641,7 @@ static void gen_add_uw(TCGv ret, TCGv arg1, TCGv arg2)
|
|||
static bool trans_add_uw(DisasContext *ctx, arg_add_uw *a)
|
||||
{
|
||||
REQUIRE_64BIT(ctx);
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
REQUIRE_ZBA(ctx);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_add_uw);
|
||||
}
|
||||
|
||||
|
@ -647,6 +653,6 @@ static void gen_slli_uw(TCGv dest, TCGv src, target_long shamt)
|
|||
static bool trans_slli_uw(DisasContext *ctx, arg_slli_uw *a)
|
||||
{
|
||||
REQUIRE_64BIT(ctx);
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
REQUIRE_ZBA(ctx);
|
||||
return gen_shift_imm_fn(ctx, a, EXT_NONE, gen_slli_uw);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue