Convert add to compare if only flags needed

This commit is contained in:
drmortalwombat 2025-02-18 11:35:06 +01:00
parent fe0bfccfaa
commit 39840b5fb1

View File

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