From cf3c65fbd0d14527424449d00aab07596770972e Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 13 May 2016 23:13:35 +0200 Subject: [PATCH] JitArm64: Use B() instead of BR() to jumo to ASM. Avoid indirect jumps as good as possible. This is a noticeable speedup. --- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 21 ++++++------------- .../Core/PowerPC/JitArm64/JitArm64Cache.cpp | 3 +-- .../JitArm64/JitArm64_SystemRegisters.cpp | 3 +-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 7fdce138cc..9a628430a7 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -197,9 +197,8 @@ void JitArm64::WriteExit(u32 destination) b->linkData.push_back(linkData); // the code generated in JitArm64BlockCache::WriteDestroyBlock must fit in this block - MOVI2R(X30, (u64)dispatcher); MOVI2R(DISPATCHER_PC, destination); - BR(X30); + B(dispatcher); } void JitArm64::WriteExit(ARM64Reg Reg) @@ -214,8 +213,7 @@ void JitArm64::WriteExit(ARM64Reg Reg) if (Profiler::g_ProfileBlocks) EndTimeProfile(js.curBlock); - MOVI2R(X30, (u64)dispatcher); - BR(X30); + B(dispatcher); } void JitArm64::WriteExceptionExit(u32 destination, bool only_external) @@ -241,8 +239,7 @@ void JitArm64::WriteExceptionExit(u32 destination, bool only_external) if (Profiler::g_ProfileBlocks) EndTimeProfile(js.curBlock); - MOVI2R(X30, (u64)dispatcher); - BR(X30); + B(dispatcher); } void JitArm64::WriteExceptionExit(ARM64Reg dest, bool only_external) @@ -273,8 +270,7 @@ void JitArm64::WriteExceptionExit(ARM64Reg dest, bool only_external) if (Profiler::g_ProfileBlocks) EndTimeProfile(js.curBlock); - MOVI2R(X30, (u64)dispatcher); - BR(X30); + B(dispatcher); } void JitArm64::DumpCode(const u8* start, const u8* end) @@ -413,12 +409,8 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB // Downcount flag check, Only valid for linked blocks { FixupBranch bail = B(CC_PL); - ARM64Reg WA = gpr.GetReg(); - ARM64Reg XA = EncodeRegTo64(WA); MOVI2R(DISPATCHER_PC, js.blockStart); - MOVI2R(XA, (u64)doTiming); - BR(XA); - gpr.Unlock(WA); + B(doTiming); SetJumpTarget(bail); } @@ -453,8 +445,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB MOVI2R(W0, (u32)JitInterface::ExceptionType::EXCEPTIONS_PAIRED_QUANTIZE); MOVI2R(X1, (u64)&JitInterface::CompileExceptionCheck); BLR(X1); - MOVI2R(X1, (u64)dispatcher); - BR(X1); + B(dispatcher); SwitchToNearCode(); SetJumpTarget(no_fail); js.assumeNoPairedQuantize = true; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp index cc416fc97e..ef9c6bcf46 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp @@ -29,9 +29,8 @@ void JitArm64BlockCache::WriteDestroyBlock(const u8* location, u32 address) { // must fit within the code generated in JitArm64::WriteExit ARM64XEmitter emit((u8 *)location); - emit.MOVI2R(X30, (u64)jit->GetAsmRoutines()->dispatcher); emit.MOVI2R(DISPATCHER_PC, address); - emit.BR(X30); + emit.B(jit->GetAsmRoutines()->dispatcher); emit.FlushIcache(); } diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp index 729c8d2d52..3bcb89a10a 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp @@ -589,8 +589,7 @@ void JitArm64::mfcr(UGeckoInstruction inst) JITDISABLE(bJITSystemRegistersOff); gpr.Lock(W0, W1, W2, W30); - MOVI2R(X0, (u64)GetAsmRoutines()->mfcr); - BLR(X0); + BL(GetAsmRoutines()->mfcr); gpr.Unlock(W1, W2, W30); gpr.BindToRegister(inst.RD, false);