translate: don't touch registers in CMPD

This commit is contained in:
fridtjof 2025-09-02 22:27:21 +02:00
parent df75f9a10b
commit 365c275958

View file

@ -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;
}