diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp index 1c8b9f0bd..db34baa3f 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp @@ -519,19 +519,12 @@ OrderedNode *OpDispatchBuilder::CalculateFlags_SBB(uint8_t SrcSize, OrderedNode Res = _Sub(OpSize, Src1, _Add(OpSize, Src2, CF)); Res = _Bfe(OpSize, SrcSize * 8, 0, Res); - // SF/ZF + auto SelectOpLT = _Select(FEXCore::IR::COND_UGT, Res, Src1, One, Zero); + auto SelectOpLE = _Select(FEXCore::IR::COND_UGE, Res, Src1, One, Zero); + auto SelectCF = _Select(FEXCore::IR::COND_EQ, CF, One, SelectOpLE, SelectOpLT); + SetNZ_ZeroCV(SrcSize, Res); - - // CF - // Unsigned - { - auto SelectOpLT = _Select(FEXCore::IR::COND_UGT, Res, Src1, One, Zero); - auto SelectOpLE = _Select(FEXCore::IR::COND_UGE, Res, Src1, One, Zero); - auto SelectCF = _Select(FEXCore::IR::COND_EQ, CF, One, SelectOpLE, SelectOpLT); - SetRFLAG(SelectCF); - } - - // Signed + SetRFLAG(SelectCF); CalculateOF(SrcSize, Res, Src1, Src2, true); }