From 3a03e1c93c0404121bb5fefec2bf414428d08d30 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 9 Nov 2023 09:15:51 -0400 Subject: [PATCH] OpcodeDispatcher: rework InsertNZCV in prep for rmif. Signed-off-by: Alyssa Rosenzweig --- FEXCore/Source/Interface/Core/OpcodeDispatcher.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h index dafcb2caf..39c09e46b 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h @@ -1307,18 +1307,19 @@ private: NZCVDirty = false; } - OrderedNode *InsertNZCV(OrderedNode *NZCV, unsigned BitOffset, OrderedNode *Value) { - unsigned Bit = IndexNZCV(BitOffset); - + void InsertNZCV(unsigned BitOffset, OrderedNode *Value) { uint32_t SetBits = PossiblySetNZCVBits; + OrderedNode *NZCV = SetBits ? GetNZCV() : nullptr; + + unsigned Bit = IndexNZCV(BitOffset); PossiblySetNZCVBits |= (1u << Bit); if (SetBits == 0) - return _Lshl(OpSize::i64Bit, Value, _Constant(Bit)); + SetNZCV(_Lshl(OpSize::i64Bit, Value, _Constant(Bit))); else if ((SetBits & (1u << Bit)) == 0) - return _Orlshl(OpSize::i32Bit, NZCV, Value, Bit); + SetNZCV(_Orlshl(OpSize::i32Bit, NZCV, Value, Bit)); else - return _Bfi(OpSize::i32Bit, 1, Bit, NZCV, Value); + SetNZCV(_Bfi(OpSize::i32Bit, 1, Bit, NZCV, Value)); } void CarryInvert() { @@ -1345,7 +1346,7 @@ private: flagsOp = SelectionFlag::Nothing; if (IsNZCV(BitOffset)) - SetNZCV(InsertNZCV(PossiblySetNZCVBits ? GetNZCV() : nullptr, BitOffset, Value)); + InsertNZCV(BitOffset, Value); else _StoreFlag(Value, BitOffset); }