From c1dbc28aa28e243069024e4fb41366868cb04d01 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 27 Sep 2023 09:50:40 -0400 Subject: [PATCH] OpcodeDispatcher: Implement SaveNZCV Signed-off-by: Alyssa Rosenzweig --- FEXCore/Source/Interface/Core/OpcodeDispatcher.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h index 506b233fc..c92522a97 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h @@ -917,6 +917,14 @@ public: protected: void SaveNZCV() override { + // Invariant: When executing instructions that clobber NZCV, the flags must + // be resident in a GPR, which is equivalent to CachedNZCV != nullptr. Get + // the NZCV which fills the cache if necessary. + if (CachedNZCV == nullptr) + GetNZCV(); + + // Assume we'll need a reload. + NZCVDirty = true; } private: