diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index 51830b6a..e285c26e 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -2160,11 +2160,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc, tcg_gen_andi_tl(tcg_ctx, t0, t0, ~7); tcg_gen_qemu_ld_tl(ctx->uc, t0, t0, ctx->mem_idx, MO_TEQ); tcg_gen_shl_tl(tcg_ctx, t0, t0, t1); - tcg_gen_xori_tl(tcg_ctx, t1, t1, 63); - t2 = tcg_const_tl(tcg_ctx, 0x7fffffffffffffffull); - tcg_gen_shr_tl(tcg_ctx, t2, t2, t1); + t2 = tcg_const_tl(tcg_ctx, -1); + tcg_gen_shl_tl(tcg_ctx, t2, t2, t1); gen_load_gpr(ctx, t1, rt); - tcg_gen_and_tl(tcg_ctx, t1, t1, t2); + tcg_gen_andc_tl(tcg_ctx, t1, t1, t2); tcg_temp_free(tcg_ctx, t2); tcg_gen_or_tl(tcg_ctx, t0, t0, t1); tcg_temp_free(tcg_ctx, t1); @@ -2253,11 +2252,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc, tcg_gen_andi_tl(tcg_ctx, t0, t0, ~3); tcg_gen_qemu_ld_tl(ctx->uc, t0, t0, ctx->mem_idx, MO_TEUL); tcg_gen_shl_tl(tcg_ctx, t0, t0, t1); - tcg_gen_xori_tl(tcg_ctx, t1, t1, 31); - t2 = tcg_const_tl(tcg_ctx, 0x7fffffffull); - tcg_gen_shr_tl(tcg_ctx, t2, t2, t1); + t2 = tcg_const_tl(tcg_ctx, -1); + tcg_gen_shl_tl(tcg_ctx, t2, t2, t1); gen_load_gpr(ctx, t1, rt); - tcg_gen_and_tl(tcg_ctx, t1, t1, t2); + tcg_gen_andc_tl(tcg_ctx, t1, t1, t2); tcg_temp_free(tcg_ctx, t2); tcg_gen_or_tl(tcg_ctx, t0, t0, t1); tcg_temp_free(tcg_ctx, t1);