From 8745455a5b6a653107fc9b5db5584c36917d1744 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 6 Sep 2024 10:56:30 -0400 Subject: [PATCH] IR: track whether parity is read so we can gate optimizations efficiently Signed-off-by: Alyssa Rosenzweig --- FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp | 3 +++ FEXCore/Source/Interface/IR/IR.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp index 7bc9e4328..3d7992385 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Flags.cpp @@ -179,6 +179,9 @@ void OpDispatchBuilder::CalculateOF(uint8_t SrcSize, Ref Res, Ref Src1, Ref Src2 } Ref OpDispatchBuilder::LoadPFRaw(bool Mask, bool Invert) { + // Most blocks do not read parity, so PF optimization is gated on this flag. + CurrentHeader->ReadsParity = true; + // Evaluate parity on the deferred raw value. return _Parity(GetRFLAG(FEXCore::X86State::RFLAG_PF_RAW_LOC), Mask, Invert); } diff --git a/FEXCore/Source/Interface/IR/IR.json b/FEXCore/Source/Interface/IR/IR.json index 6f36e40ee..f9711fa5a 100644 --- a/FEXCore/Source/Interface/IR/IR.json +++ b/FEXCore/Source/Interface/IR/IR.json @@ -168,7 +168,7 @@ "SwitchGen": false, "JITDispatchOverride": "NoOp" }, - "IRHeader SSA:$Blocks, u64:$OriginalRIP, u32:$BlockCount, u32:$NumHostInstructions, i1:$HasX87{false}": { + "IRHeader SSA:$Blocks, u64:$OriginalRIP, u32:$BlockCount, u32:$NumHostInstructions, i1:$HasX87{false}, i1:$ReadsParity{false}": { "SwitchGen": false, "JITDispatchOverride": "NoOp" },