A32/thumb16: Fix bug in CBZ/CBNZ

This commit is contained in:
MerryMage 2021-02-06 21:21:55 +00:00
parent 5918cd48e6
commit ac9e1ccb1c

View file

@ -879,9 +879,8 @@ bool ThumbTranslatorVisitor::thumb16_CBZ_CBNZ(bool nonzero, Imm<1> i, Imm<5> imm
ir.SetCheckBit(ir.IsZero(rn));
const auto [cond_pass, cond_fail] = [this, imm, nonzero] {
const u32 target = ir.PC() + imm;
const auto skip = IR::Term::LinkBlock{ir.current_location.AdvancePC(2)};
const auto branch = IR::Term::LinkBlock{ir.current_location.AdvancePC(target)};
const auto branch = IR::Term::LinkBlock{ir.current_location.AdvancePC(imm + 4)};
if (nonzero) {
return std::make_pair(skip, branch);