OpcodeDispatcher: optimize JP/JNP

fuse and+cbnz into tbz/tbnz.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig committed 2024-08-21 17:52:22 -04:00
1 parent b893bdb8df
commit b03c613fbf
2 files changed
+10 -6

No files matched your search

@@ -742,15 +742,13 @@ void OpDispatchBuilder::CondJUMPOp(OpcodeArgs) {
auto CurrentBlock = GetCurrentBlock();
// Fallback
{
IRPair<IR::IROp_CondJump> CondJump_;
auto [Complex, SimpleCond] = DecodeNZCVCondition(Op->OP & 0xF);
auto OP = Op->OP & 0xF;
auto [Complex, SimpleCond] = DecodeNZCVCondition(OP);
if (Complex) {
auto TakeBranch = _Constant(1);
auto DoNotTakeBranch = _Constant(0);
auto SrcCond = SelectCC(Op->OP & 0xF, OpSize::i64Bit, TakeBranch, DoNotTakeBranch);
CondJump_ = CondJump(SrcCond);
LOGMAN_THROW_AA_FMT(OP == 0xA || OP == 0xB, "only PF left");
CondJump_ = CondJumpBit(LoadPFRaw(false), 0, OP == 0xB);
} else {
CondJump_ = CondJumpNZCV(SimpleCond);
}