@@ -339,14 +339,14 @@ static bool trans_srow(DisasContext *ctx, arg_srow *a)
{
REQUIRE_64BIT(ctx);
REQUIRE_EXT(ctx, RVB);
- return gen_shiftw(ctx, a, gen_sro);
+ return gen_shiftw(ctx, a, gen_srow);
}
static bool trans_sroiw(DisasContext *ctx, arg_sroiw *a)
{
REQUIRE_64BIT(ctx);
REQUIRE_EXT(ctx, RVB);
- return gen_shiftiw(ctx, a, gen_sro);
+ return gen_shiftiw(ctx, a, gen_srow);
}
static bool trans_rorw(DisasContext *ctx, arg_rorw *a)
@@ -669,6 +669,13 @@ static void gen_sro(TCGv ret, TCGv arg1, TCGv arg2)
tcg_gen_not_tl(ret, ret);
}
+static void gen_srow(TCGv ret, TCGv arg1, TCGv arg2)
+{
+ TCGv ones = tcg_constant_tl(UINT32_MAX);
+ tcg_gen_deposit_tl(arg1, arg1, ones, 32, 32);
+ gen_sro(ret, arg1, arg2);
+}
+
static bool gen_grevi(DisasContext *ctx, arg_grevi *a)
{
TCGv dest = gpr_dst(ctx, a->rd);
Always fill MSB 32 bits with 1s in source register before calling gen_sro. Otherwise it may not only shift in 1s. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> --- target/riscv/insn_trans/trans_rvb.c.inc | 4 ++-- target/riscv/translate.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)