diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 39a5378993..96f5905c68 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -948,7 +948,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) js.downcountAmount = 0; js.skipInstructions = 0; js.carryFlag = CarryFlag::InPPCState; - js.constantGqr.clear(); + js.constantGqrValid = BitSet8(); // Assume that GQR values don't change often at runtime. Many paired-heavy games use largely float // loads and stores, @@ -979,6 +979,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) CMP_or_TEST(32, PPCSTATE(spr[SPR_GQR0 + gqr]), Imm32(value)); J_CC(CC_NZ, target); } + js.constantGqrValid = gqr_static; } } diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp index aa5ec3544f..f2e608ca03 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -35,10 +35,6 @@ void Jit64::psq_stXX(UGeckoInstruction inst) int w = indexed ? inst.Wx : inst.W; FALLBACK_IF(!a); - auto it = js.constantGqr.find(i); - bool gqrIsConstant = it != js.constantGqr.end(); - u32 gqrValue = gqrIsConstant ? it->second & 0xffff : 0; - RCX64Reg scratch_guard = gpr.Scratch(RSCRATCH_EXTRA); RCOpArg Ra = update ? gpr.Bind(a, RCMode::ReadWrite) : gpr.Use(a, RCMode::Read); RCOpArg Rb = indexed ? gpr.Use(b, RCMode::Read) : RCOpArg::Imm32((u32)offset); @@ -56,8 +52,10 @@ void Jit64::psq_stXX(UGeckoInstruction inst) else CVTPD2PS(XMM0, Rs); // pair + const bool gqrIsConstant = js.constantGqrValid[i]; if (gqrIsConstant) { + const u32 gqrValue = js.constantGqr[i] & 0xffff; int type = gqrValue & 0x7; // Paired stores (other than w/type zero) don't yield any real change in @@ -126,10 +124,6 @@ void Jit64::psq_lXX(UGeckoInstruction inst) int w = indexed ? inst.Wx : inst.W; FALLBACK_IF(!a); - auto it = js.constantGqr.find(i); - bool gqrIsConstant = it != js.constantGqr.end(); - u32 gqrValue = gqrIsConstant ? it->second >> 16 : 0; - RCX64Reg scratch_guard = gpr.Scratch(RSCRATCH_EXTRA); RCX64Reg Ra = gpr.Bind(a, update ? RCMode::ReadWrite : RCMode::Read); RCOpArg Rb = indexed ? gpr.Use(b, RCMode::Read) : RCOpArg::Imm32((u32)offset); @@ -142,8 +136,10 @@ void Jit64::psq_lXX(UGeckoInstruction inst) if (update && !jo.memcheck) MOV(32, Ra, R(RSCRATCH_EXTRA)); + const bool gqrIsConstant = js.constantGqrValid[i]; if (gqrIsConstant) { + const u32 gqrValue = js.constantGqr[i] >> 16; GenQuantizedLoad(w == 1, static_cast(gqrValue & 0x7), (gqrValue & 0x3F00) >> 8); } else diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/PowerPC/JitCommon/JitBase.h index 4abbb4dad7..99c4d67485 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBase.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.h @@ -83,7 +83,8 @@ protected: Gen::FixupBranch exceptionHandler; bool assumeNoPairedQuantize; - std::map constantGqr; + BitSet8 constantGqrValid; + std::array constantGqr; bool firstFPInstructionFound; bool isLastInstruction; int skipInstructions;