From 4feb059f5192537be7b346aa11e8a38c67808571 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 10 Sep 2023 20:11:19 -0700 Subject: [PATCH] OpcodeDispatcher: Optimize the case of all flags invalidated When flags are invalidated but we're going to insert a new flag we end up in a situation where we loaded the prior value from memory, claimed unknown cache status (they were all invalid!), and then did an insert. --- FEXCore/Source/Interface/Core/OpcodeDispatcher.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h index 0e26d0931..9cfe7a116 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h @@ -1195,7 +1195,7 @@ private: flagsOp = SelectionFlag::Nothing; if (IsNZCV(BitOffset)) - SetNZCV(InsertNZCV(GetNZCV(), BitOffset, Value)); + SetNZCV(InsertNZCV(PossiblySetNZCVBits ? GetNZCV() : nullptr, BitOffset, Value)); else _StoreFlag(Value, BitOffset); } @@ -1362,6 +1362,9 @@ private: */ void InvalidateDeferredFlags() { CurrentDeferredFlags.Type = FlagsGenerationType::TYPE_NONE; + + // No NZCV bits will be set, they are all invalid. + PossiblySetNZCVBits = 0; } /**