@@ -9,7 +9,7 @@ static bool gen_ll(DisasContext *ctx, arg_rr_i *a, MemOp mop)
TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
TCGv t0 = make_address_i(ctx, src1, a->imm);
- tcg_gen_qemu_ld_i64(t1, t0, ctx->mem_idx, mop);
+ tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, mop);
tcg_gen_st_tl(t0, tcg_env, offsetof(CPULoongArchState, lladdr));
tcg_gen_st_tl(t1, tcg_env, offsetof(CPULoongArchState, llval));
gen_set_gpr(a->rd, t1, EXT_NONE);
@@ -28,7 +28,8 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop)
TCGLabel *l1 = gen_new_label();
TCGLabel *done = gen_new_label();
- tcg_gen_addi_tl(t0, src1, a->imm);
+ tcg_gen_mov_tl(t0, src1);
+ t0 = make_address_i(ctx, t0, a->imm);
tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lladdr, l1);
tcg_gen_movi_tl(dest, 0);
tcg_gen_br(done);
gen_ll should use tcg_gen_qemu_ld_tl to load t1, as t1 is in TCGv which means it should be a tl type value. gen_sc should use make_address_i to obtain source address to ensure that address is properly truncated. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)