summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorFiora <fioraaeterna@gmail.com>2014-09-10 22:17:38 -0700
committerFiora <fioraaeterna@gmail.com>2014-09-10 22:17:38 -0700
commit5726e0cdfba643fcb703b07132fc291a07fc4da5 (patch)
tree27578346eb4df6f5951fb69ffb2dcdd8dae9bcbf /Source/Core
parent67f7e7e28b0de7b1f4060900b6158cf9733d9a90 (diff)
JIT: use XCHG in MOVTwo
Roughly the same speed or slightly faster depending on CPU; mostly just cleaner since we don't have to pass in a temp.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/x64ABI.cpp10
-rw-r--r--Source/Core/Common/x64Emitter.h2
-rw-r--r--Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp2
3 files changed, 6 insertions, 8 deletions
diff --git a/Source/Core/Common/x64ABI.cpp b/Source/Core/Common/x64ABI.cpp
index 9e13f7bc90..d8ed88010f 100644
--- a/Source/Core/Common/x64ABI.cpp
+++ b/Source/Core/Common/x64ABI.cpp
@@ -321,7 +321,7 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1)
// Pass two registers as parameters.
void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2)
{
- MOVTwo(64, ABI_PARAM1, reg1, ABI_PARAM2, reg2, ABI_PARAM3);
+ MOVTwo(64, ABI_PARAM1, reg1, ABI_PARAM2, reg2);
u64 distance = u64(func) - (u64(code) + 5);
if (distance >= 0x0000000080000000ULL &&
distance < 0xFFFFFFFF80000000ULL)
@@ -336,15 +336,13 @@ void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2)
}
}
-void XEmitter::MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, Gen::X64Reg dst2, Gen::X64Reg src2, X64Reg temp)
+void XEmitter::MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, Gen::X64Reg dst2, Gen::X64Reg src2)
{
if (dst1 == src2 && dst2 == src1)
{
- // need a temporary
- MOV(bits, R(temp), R(src1));
- src1 = temp;
+ XCHG(bits, R(src1), R(src2));
}
- if (src2 != dst1)
+ else if (src2 != dst1)
{
if (dst1 != src1)
MOV(bits, R(dst1), R(src1));
diff --git a/Source/Core/Common/x64Emitter.h b/Source/Core/Common/x64Emitter.h
index 28244bbccc..228626c407 100644
--- a/Source/Core/Common/x64Emitter.h
+++ b/Source/Core/Common/x64Emitter.h
@@ -756,7 +756,7 @@ public:
void ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2);
// Helper method for the above, or can be used separately.
- void MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, Gen::X64Reg dst2, Gen::X64Reg src2, Gen::X64Reg temp);
+ void MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, Gen::X64Reg dst2, Gen::X64Reg src2);
// Saves/restores the registers and adjusts the stack to be aligned as
// required by the ABI, where the previous alignment was as specified.
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
index 7b2d248036..9a7fdc7989 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
@@ -115,7 +115,7 @@ const u8 *TrampolineCache::GetWriteTrampoline(const InstructionInfo &info, u32 r
ABI_PushRegistersAndAdjustStack(registersInUse, 8);
- MOVTwo(64, ABI_PARAM1, dataReg, ABI_PARAM2, addrReg, ABI_PARAM3);
+ MOVTwo(64, ABI_PARAM1, dataReg, ABI_PARAM2, addrReg);
if (info.displacement)
{