From ac9e1ccb1c816ae698e3d96455183733172cc99a Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 6 Feb 2021 21:21:55 +0000 Subject: [PATCH] A32/thumb16: Fix bug in CBZ/CBNZ --- src/frontend/A32/translate/impl/thumb16.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/frontend/A32/translate/impl/thumb16.cpp b/src/frontend/A32/translate/impl/thumb16.cpp index 380cf408..d7c9e4cd 100644 --- a/src/frontend/A32/translate/impl/thumb16.cpp +++ b/src/frontend/A32/translate/impl/thumb16.cpp @@ -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);