From: Vladimir Isaev Date: Sat, 4 Feb 2023 08:23:12 +0000 (+0300) Subject: target/riscv: fix ctzw behavior X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5fc0fc8788e08f151f5d0c47d205e009aeb33844;p=qemu.git target/riscv: fix ctzw behavior According to spec, ctzw should work with 32-bit register, not 64. For example, previous implementation returns 33 for (1<<33) input when the new one returns 32. Signed-off-by: Vladimir Isaev Reviewed-by: Alistair Francis Suggested-by: Richard Henderson Message-Id: <20230204082312.43557-1-vladimir.isaev@syntacore.com> Signed-off-by: Alistair Francis --- diff --git a/target/riscv/insn_trans/trans_rvb.c.inc b/target/riscv/insn_trans/trans_rvb.c.inc index e2b8329f1e..990bc94b98 100644 --- a/target/riscv/insn_trans/trans_rvb.c.inc +++ b/target/riscv/insn_trans/trans_rvb.c.inc @@ -401,6 +401,7 @@ static bool trans_ctzw(DisasContext *ctx, arg_ctzw *a) { REQUIRE_64BIT(ctx); REQUIRE_ZBB(ctx); + ctx->ol = MXL_RV32; return gen_unary(ctx, a, EXT_ZERO, gen_ctzw); }