Skip to content

Commit

Permalink
don't add constant cycles if they're 0
Browse files Browse the repository at this point in the history
  • Loading branch information
RSDuck committed Jul 24, 2021
1 parent 6944fdb commit 9ee2017
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ARMJIT_A64/ARMJIT_Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ void Compiler::Comp_BranchSpecialBehaviour(bool taken)
{
RegCache.PrepareExit();

ADD(RCycles, RCycles, ConstantCycles);
if (ConstantCycles)
ADD(RCycles, RCycles, ConstantCycles);
QuickTailCall(X0, ARM_Ret);
}
}
Expand Down Expand Up @@ -832,7 +833,8 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]

RegCache.Flush();

ADD(RCycles, RCycles, ConstantCycles);
if (ConstantCycles)
ADD(RCycles, RCycles, ConstantCycles);
QuickTailCall(X0, ARM_Ret);

FlushIcache();
Expand Down
6 changes: 4 additions & 2 deletions src/ARMJIT_x64/ARMJIT_Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ void Compiler::Comp_SpecialBranchBehaviour(bool taken)
{
RegCache.PrepareExit();

ADD(32, MDisp(RCPU, offsetof(ARM, Cycles)), Imm32(ConstantCycles));
if (ConstantCycles)
ADD(32, MDisp(RCPU, offsetof(ARM, Cycles)), Imm32(ConstantCycles));
JMP((u8*)&ARM_Ret, true);
}
}
Expand Down Expand Up @@ -841,7 +842,8 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[]

RegCache.Flush();

ADD(32, MDisp(RCPU, offsetof(ARM, Cycles)), Imm32(ConstantCycles));
if (ConstantCycles)
ADD(32, MDisp(RCPU, offsetof(ARM, Cycles)), Imm32(ConstantCycles));
JMP((u8*)ARM_Ret, true);

#ifdef JIT_PROFILING_ENABLED
Expand Down

0 comments on commit 9ee2017

Please sign in to comment.