From a4b0484eddd63f94bb7ccd5cc43c195bcd55c3d1 Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Wed, 17 Jul 2024 17:14:30 +0200 Subject: [PATCH] Backport Alyssa's changes --- .../Interface/Core/OpcodeDispatcher/X87.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/X87.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/X87.cpp index 3fb72b848b..c2b56f2369 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/X87.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/X87.cpp @@ -682,19 +682,18 @@ void OpDispatchBuilder::X87ModifySTP(OpcodeArgs, bool Inc) { // during the function runtime. Ref OpDispatchBuilder::ReconstructFSW_Helper(Ref T) { // We must construct the FSW from our various bits - Ref FSW = _Constant(0); - auto* Top = T ? T : GetX87Top(); - FSW = _Bfi(OpSize::i64Bit, 3, 11, FSW, Top); - - auto* C0 = GetRFLAG(FEXCore::X86State::X87FLAG_C0_LOC); - auto* C1 = GetRFLAG(FEXCore::X86State::X87FLAG_C1_LOC); - auto* C2 = GetRFLAG(FEXCore::X86State::X87FLAG_C2_LOC); - auto* C3 = GetRFLAG(FEXCore::X86State::X87FLAG_C3_LOC); + auto C0 = GetRFLAG(FEXCore::X86State::X87FLAG_C0_LOC); + auto C1 = GetRFLAG(FEXCore::X86State::X87FLAG_C1_LOC); + auto C2 = GetRFLAG(FEXCore::X86State::X87FLAG_C2_LOC); + auto C3 = GetRFLAG(FEXCore::X86State::X87FLAG_C3_LOC); - FSW = _Orlshl(OpSize::i64Bit, FSW, C0, 8); + Ref FSW = _Lshl(OpSize::i64Bit, C0, _Constant(8)); FSW = _Orlshl(OpSize::i64Bit, FSW, C1, 9); FSW = _Orlshl(OpSize::i64Bit, FSW, C2, 10); FSW = _Orlshl(OpSize::i64Bit, FSW, C3, 14); + + auto Top = GetX87Top(); + FSW = _Bfi(OpSize::i64Bit, 3, 11, FSW, Top); return FSW; }