diff --git a/target/cr16c/translate.c b/target/cr16c/translate.c index e204af9fa3..d93302a27f 100644 --- a/target/cr16c/translate.c +++ b/target/cr16c/translate.c @@ -743,14 +743,19 @@ static bool trans_CMP_reg(DisasContext *ctx, arg_CMP_reg *a) { } static bool trans_CMPD_reg(DisasContext *ctx, arg_CMPD_reg *a) { + TCGv tmp_a = tcg_temp_new_i32(); + TCGv tmp_b = tcg_temp_new_i32(); + tcg_gen_mov_i32(tmp_a, r[a->rs1]); + tcg_gen_mov_i32(tmp_b, r[a->rs2]); + if (a->rs1 < CR16C_FIRST_32B_REG) { - tcg_gen_deposit_i32(r[a->rs1], r[a->rs1], r[a->rs1+1], 16, 16); + tcg_gen_deposit_i32(tmp_a, tmp_a, r[a->rs1+1], 16, 16); } if (a->rs2 < CR16C_FIRST_32B_REG) { - tcg_gen_deposit_i32(r[a->rs2], r[a->rs2], r[a->rs2+1], 16, 16); + tcg_gen_deposit_i32(tmp_b, tmp_b, r[a->rs2+1], 16, 16); } - gen_cmp(r[a->rs2], r[a->rs1]); + gen_cmp(tmp_b, tmp_a); return true; }