PPCAnalyst: Don't discard before gather pipe interrupt check

This bug has been lurking in the code ever since I added the discard
functionality. It doesn't seem to be triggered all that often,
and on top of that the emitted code only runs conditionally, so I'm not
sure if people have been affected by this bug in practice or not.
This commit is contained in:
JosJuice 2023-08-25 16:15:54 +02:00
parent 32f4f3ae7c
commit 5902b5b113
1 changed files with 18 additions and 0 deletions

View File

@ -757,6 +757,16 @@ bool PPCAnalyzer::IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instruct
return false;
}
static bool CanCauseGatherPipeInterruptCheck(const CodeOp& op)
{
// eieio
if (op.inst.OPCD == 31 && op.inst.SUBOP10 == 854)
return true;
return op.opinfo->type == OpType::Store || op.opinfo->type == OpType::StoreFP ||
op.opinfo->type == OpType::StorePS;
}
u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer,
std::size_t block_size) const
{
@ -952,6 +962,14 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer,
{
CodeOp& op = code[i];
if (CanCauseGatherPipeInterruptCheck(op))
{
// If we're doing a gather pipe interrupt check after this instruction, we need to
// be able to flush all registers, so we can't have any discarded registers.
gprDiscardable = BitSet32{};
fprDiscardable = BitSet32{};
}
const BitSet8 opWantsCR = op.wantsCR;
const bool opWantsFPRF = op.wantsFPRF;
const bool opWantsCA = op.wantsCA;