From b35c34186c5a1ae04af7a5d8a4b1f213cc61ee0e Mon Sep 17 00:00:00 2001 From: Sintendo Date: Sat, 21 Feb 2015 01:25:57 +0100 Subject: [PATCH] More minor DSP JIT optimizations --- Source/Core/Core/DSP/DSPEmitter.cpp | 4 ++-- Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp | 14 +++++++------- Source/Core/Core/DSP/Jit/DSPJitBranch.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/DSP/DSPEmitter.cpp b/Source/Core/Core/DSP/DSPEmitter.cpp index fec47aea93..3398bc6823 100644 --- a/Source/Core/Core/DSP/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/DSPEmitter.cpp @@ -246,11 +246,11 @@ void DSPEmitter::Compile(u16 start_addr) if (DSPAnalyzer::code_flags[compilePC-1] & DSPAnalyzer::CODE_LOOP_END) { MOVZX(32, 16, EAX, M(&(g_dsp.r.st[2]))); - CMP(32, R(EAX), Imm32(0)); + TEST(32, R(EAX), R(EAX)); FixupBranch rLoopAddressExit = J_CC(CC_LE, true); MOVZX(32, 16, EAX, M(&g_dsp.r.st[3])); - CMP(32, R(EAX), Imm32(0)); + TEST(32, R(EAX), R(EAX)); FixupBranch rLoopCounterExit = J_CC(CC_LE, true); if (!opcode->branch) diff --git a/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp b/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp index a56d75a5b1..ecab111ad0 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp @@ -1075,7 +1075,7 @@ void DSPEmitter::abs(const UDSPInstruction opc) // s64 acc = dsp_get_long_acc(dreg); get_long_acc(dreg); // if (acc < 0) acc = 0 - acc; - CMP(64, R(RAX), Imm8(0)); + TEST(64, R(RAX), R(RAX)); FixupBranch GreaterThanOrEqual = J_CC(CC_GE); NEG(64, R(RAX)); set_long_acc(dreg); @@ -1367,7 +1367,7 @@ void DSPEmitter::lsrn(const UDSPInstruction opc) // acc <<= -shift; // } - CMP(64, R(RDX), Imm8(0));//is this actually worth the branch cost? + TEST(64, R(RDX), R(RDX));//is this actually worth the branch cost? FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f));//is this actually worth the branch cost? FixupBranch noShift = J_CC(CC_Z); @@ -1426,7 +1426,7 @@ void DSPEmitter::asrn(const UDSPInstruction opc) // acc <<= -shift; // } - CMP(64, R(RDX), Imm8(0)); + TEST(64, R(RDX), R(RDX)); FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f)); FixupBranch noShift = J_CC(CC_Z); @@ -1489,7 +1489,7 @@ void DSPEmitter::lsrnrx(const UDSPInstruction opc) // acc >>= -shift; // } - CMP(64, R(RDX), Imm8(0)); + TEST(64, R(RDX), R(RDX)); FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f)); FixupBranch noShift = J_CC(CC_Z); @@ -1546,7 +1546,7 @@ void DSPEmitter::asrnrx(const UDSPInstruction opc) // acc >>= -shift; // } - CMP(64, R(RDX), Imm8(0)); + TEST(64, R(RDX), R(RDX)); FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f)); FixupBranch noShift = J_CC(CC_Z); @@ -1604,7 +1604,7 @@ void DSPEmitter::lsrnr(const UDSPInstruction opc) // else if (shift < 0) // acc >>= -shift; - CMP(64, R(RDX), Imm8(0)); + TEST(64, R(RDX), R(RDX)); FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f)); FixupBranch noShift = J_CC(CC_Z); @@ -1659,7 +1659,7 @@ void DSPEmitter::asrnr(const UDSPInstruction opc) // else if (shift < 0) // acc >>= -shift; - CMP(64, R(RDX), Imm8(0)); + TEST(64, R(RDX), R(RDX)); FixupBranch zero = J_CC(CC_E); TEST(16, R(RAX), Imm16(0x3f)); FixupBranch noShift = J_CC(CC_Z); diff --git a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp index abf9e7015b..862590c57f 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp @@ -282,7 +282,7 @@ void DSPEmitter::HandleLoop() MOVZX(32, 16, EAX, M(&g_dsp.r.st[2])); MOVZX(32, 16, ECX, M(&g_dsp.r.st[3])); - CMP(32, R(RCX), Imm32(0)); + TEST(32, R(RCX), R(RCX)); FixupBranch rLoopCntG = J_CC(CC_LE, true); CMP(16, R(RAX), Imm16(compilePC - 1)); FixupBranch rLoopAddrG = J_CC(CC_NE, true); @@ -323,7 +323,7 @@ void DSPEmitter::loop(const UDSPInstruction opc) dsp_op_read_reg_dont_saturate(reg, RDX, ZERO); u16 loop_pc = compilePC + 1; - CMP(16, R(EDX), Imm16(0)); + TEST(16, R(EDX), R(EDX)); DSPJitRegCache c(gpr); FixupBranch cnt = J_CC(CC_Z, true); dsp_reg_store_stack(3); @@ -393,7 +393,7 @@ void DSPEmitter::bloop(const UDSPInstruction opc) dsp_op_read_reg_dont_saturate(reg, RDX, ZERO); u16 loop_pc = dsp_imem_read(compilePC + 1); - CMP(16, R(EDX), Imm16(0)); + TEST(16, R(EDX), R(EDX)); DSPJitRegCache c(gpr); FixupBranch cnt = J_CC(CC_Z, true); dsp_reg_store_stack(3);