mirror of https://github.com/xemu-project/xemu.git
target/riscv: Move gen_cmpxchg before adding amocas.[b|h]
Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20240709113652.1239-9-zhiwei_liu@linux.alibaba.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
be4a8db7f3
commit
8d07887bcb
|
@ -22,19 +22,6 @@
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static bool gen_cmpxchg(DisasContext *ctx, arg_atomic *a, MemOp mop)
|
|
||||||
{
|
|
||||||
TCGv dest = get_gpr(ctx, a->rd, EXT_NONE);
|
|
||||||
TCGv src1 = get_address(ctx, a->rs1, 0);
|
|
||||||
TCGv src2 = get_gpr(ctx, a->rs2, EXT_NONE);
|
|
||||||
|
|
||||||
decode_save_opc(ctx);
|
|
||||||
tcg_gen_atomic_cmpxchg_tl(dest, src1, dest, src2, ctx->mem_idx, mop);
|
|
||||||
|
|
||||||
gen_set_gpr(ctx, a->rd, dest);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool trans_amocas_w(DisasContext *ctx, arg_amocas_w *a)
|
static bool trans_amocas_w(DisasContext *ctx, arg_amocas_w *a)
|
||||||
{
|
{
|
||||||
REQUIRE_ZACAS(ctx);
|
REQUIRE_ZACAS(ctx);
|
||||||
|
|
|
@ -1099,6 +1099,19 @@ static bool gen_amo(DisasContext *ctx, arg_atomic *a,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool gen_cmpxchg(DisasContext *ctx, arg_atomic *a, MemOp mop)
|
||||||
|
{
|
||||||
|
TCGv dest = get_gpr(ctx, a->rd, EXT_NONE);
|
||||||
|
TCGv src1 = get_address(ctx, a->rs1, 0);
|
||||||
|
TCGv src2 = get_gpr(ctx, a->rs2, EXT_NONE);
|
||||||
|
|
||||||
|
decode_save_opc(ctx);
|
||||||
|
tcg_gen_atomic_cmpxchg_tl(dest, src1, dest, src2, ctx->mem_idx, mop);
|
||||||
|
|
||||||
|
gen_set_gpr(ctx, a->rd, dest);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
|
static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
|
|
Loading…
Reference in New Issue