Skip to content

Commit

Permalink
Update pipeTime when syncing EFU operations.
Browse files Browse the repository at this point in the history
Fixes issues with Shinobi where WAITP is used and FDIV pipeline needs to be updated as a side-effect.
  • Loading branch information
jpd002 committed May 11, 2023
1 parent 468de01 commit 9bcbe1f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Source/ee/VUShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,28 @@ void VUShared::FlushPipeline(const REGISTER_PIPEINFO& pipeInfo, CMipsJitter* cod
codeGen->PullRel(pipeInfo.value);
}

void VUShared::SyncPipeline(const REGISTER_PIPEINFO& pipeInfo, CMipsJitter* codeGen, uint32 relativePipeTime)
{
codeGen->PushRel(pipeInfo.counter);

codeGen->PushRel(offsetof(CMIPS, m_State.pipeTime));
codeGen->PushCst(relativePipeTime);
codeGen->Add();

//If time for value to arrive (pipeInfo.counter) is greater than our current pipeTime,
//increase pipeTime so that it matches.
codeGen->BeginIf(Jitter::CONDITION_GE);
{
codeGen->PushRel(pipeInfo.counter);
codeGen->PushCst(relativePipeTime);
codeGen->Sub();
codeGen->PullRel(offsetof(CMIPS, m_State.pipeTime));
}
codeGen->EndIf();

FlushPipeline(pipeInfo, codeGen);
}

void VUShared::CheckPipeline(const REGISTER_PIPEINFO& pipeInfo, CMipsJitter* codeGen, uint32 relativePipeTime)
{
codeGen->PushRel(pipeInfo.counter);
Expand Down
1 change: 1 addition & 0 deletions Source/ee/VUShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ namespace VUShared
void WAITQ(CMipsJitter*);

void FlushPipeline(const REGISTER_PIPEINFO&, CMipsJitter*);
void SyncPipeline(const REGISTER_PIPEINFO&, CMipsJitter*, uint32);
void CheckPipeline(const REGISTER_PIPEINFO&, CMipsJitter*, uint32);
void QueueInPipeline(const REGISTER_PIPEINFO&, CMipsJitter*, uint32, uint32);
void CheckFlagPipeline(const FLAG_PIPEINFO&, CMipsJitter*, uint32);
Expand Down
2 changes: 1 addition & 1 deletion Source/ee/VuBasicBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void CVuBasicBlock::CompileRange(CMipsJitter* jitter)
}
if(loOps.syncP)
{
VUShared::FlushPipeline(VUShared::g_pipeInfoP, jitter);
VUShared::SyncPipeline(VUShared::g_pipeInfoP, jitter, relativePipeTime);
}

auto fmacStallDelay = fmacPipelineInfo.stallDelays[instructionIndex];
Expand Down

0 comments on commit 9bcbe1f

Please sign in to comment.