Merge pull request #11136 from AdmiralCurtiss/gqr-array

Jit64: Convert constantGqr to std::array.
This commit is contained in:
Admiral H. Curtiss 2022-10-10 02:13:30 +02:00 committed by GitHub
commit 333ede5416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View file

@ -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;
}
}

View file

@ -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<EQuantizeType>(gqrValue & 0x7), (gqrValue & 0x3F00) >> 8);
}
else

View file

@ -83,7 +83,8 @@ protected:
Gen::FixupBranch exceptionHandler;
bool assumeNoPairedQuantize;
std::map<u8, u32> constantGqr;
BitSet8 constantGqrValid;
std::array<u32, 8> constantGqr;
bool firstFPInstructionFound;
bool isLastInstruction;
int skipInstructions;