From 39840b5fb15ea7647cc6e482e6bde6a075851120 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:35:06 +0100 Subject: [PATCH] Convert add to compare if only flags needed --- oscar64/NativeCodeGenerator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 52cf556..0fbfffd 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -47197,6 +47197,17 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate3(int i, int pass) } } + if (mIns[i + 0].mType == ASMIT_TXA && mIns[i + 1].mType == ASMIT_CLC && + mIns[i + 2].mType == ASMIT_ADC && mIns[i + 2].mMode == ASMIM_IMMEDIATE && + !(mIns[i + 2].mLive & LIVE_CPU_REG_A)) + { + mIns[i + 0].mType = ASMIT_NOP; + mIns[i + 1].mType = ASMIT_NOP; + mIns[i + 2].mType = ASMIT_CPX; mIns[i + 2].mAddress = (256 - mIns[i + 2].mAddress) & 255; + + return true; + } + return false; }