target/riscv: Use {get, dest}_gpr for integer load/store
Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20210823195529.560295-16-richard.henderson@linaro.org Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
9b21b64345
commit
6ecf39e2dd
@ -138,15 +138,17 @@ static bool trans_bgeu(DisasContext *ctx, arg_bgeu *a)
|
|||||||
|
|
||||||
static bool gen_load(DisasContext *ctx, arg_lb *a, MemOp memop)
|
static bool gen_load(DisasContext *ctx, arg_lb *a, MemOp memop)
|
||||||
{
|
{
|
||||||
TCGv t0 = tcg_temp_new();
|
TCGv dest = dest_gpr(ctx, a->rd);
|
||||||
TCGv t1 = tcg_temp_new();
|
TCGv addr = get_gpr(ctx, a->rs1, EXT_NONE);
|
||||||
gen_get_gpr(ctx, t0, a->rs1);
|
|
||||||
tcg_gen_addi_tl(t0, t0, a->imm);
|
|
||||||
|
|
||||||
tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, memop);
|
if (a->imm) {
|
||||||
gen_set_gpr(ctx, a->rd, t1);
|
TCGv temp = temp_new(ctx);
|
||||||
tcg_temp_free(t0);
|
tcg_gen_addi_tl(temp, addr, a->imm);
|
||||||
tcg_temp_free(t1);
|
addr = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, memop);
|
||||||
|
gen_set_gpr(ctx, a->rd, dest);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,18 +179,18 @@ static bool trans_lhu(DisasContext *ctx, arg_lhu *a)
|
|||||||
|
|
||||||
static bool gen_store(DisasContext *ctx, arg_sb *a, MemOp memop)
|
static bool gen_store(DisasContext *ctx, arg_sb *a, MemOp memop)
|
||||||
{
|
{
|
||||||
TCGv t0 = tcg_temp_new();
|
TCGv addr = get_gpr(ctx, a->rs1, EXT_NONE);
|
||||||
TCGv dat = tcg_temp_new();
|
TCGv data = get_gpr(ctx, a->rs2, EXT_NONE);
|
||||||
gen_get_gpr(ctx, t0, a->rs1);
|
|
||||||
tcg_gen_addi_tl(t0, t0, a->imm);
|
|
||||||
gen_get_gpr(ctx, dat, a->rs2);
|
|
||||||
|
|
||||||
tcg_gen_qemu_st_tl(dat, t0, ctx->mem_idx, memop);
|
if (a->imm) {
|
||||||
tcg_temp_free(t0);
|
TCGv temp = temp_new(ctx);
|
||||||
tcg_temp_free(dat);
|
tcg_gen_addi_tl(temp, addr, a->imm);
|
||||||
return true;
|
addr = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tcg_gen_qemu_st_tl(data, addr, ctx->mem_idx, memop);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool trans_sb(DisasContext *ctx, arg_sb *a)
|
static bool trans_sb(DisasContext *ctx, arg_sb *a)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user