From b9d4534a351157c3f814645a2033a013409b9487 Mon Sep 17 00:00:00 2001 From: skidau Date: Thu, 23 Dec 2010 22:42:10 +0000 Subject: [PATCH] LLE JIT: Fixed the shift direction of the lsrnrx, asrnrx, lsrnr and asrnr instructions. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6653 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/DSPCore/Src/Jit/DSPJitArithmetic.cpp | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/Core/DSPCore/Src/Jit/DSPJitArithmetic.cpp b/Source/Core/DSPCore/Src/Jit/DSPJitArithmetic.cpp index 57431a16b9..1b081da30a 100644 --- a/Source/Core/DSPCore/Src/Jit/DSPJitArithmetic.cpp +++ b/Source/Core/DSPCore/Src/Jit/DSPJitArithmetic.cpp @@ -132,8 +132,7 @@ void DSPEmitter::andf(const UDSPInstruction opc) // g_dsp.r[DSP_REG_SR] |= SR_LOGIC_ZERO; // else // g_dsp.r[DSP_REG_SR] &= ~SR_LOGIC_ZERO; - AND(16, R(RAX), Imm16(imm)); - CMP(16, R(RAX), Imm16(0)); + TEST(16, R(RAX), Imm16(imm)); FixupBranch notLogicZero = J_CC(CC_NE); OR(16, MDisp(R11, DSP_REG_SR * 2), Imm16(SR_LOGIC_ZERO)); FixupBranch exit = J(); @@ -1500,7 +1499,7 @@ void DSPEmitter::lsrn(const UDSPInstruction opc) get_long_acc(0, RDX); // acc &= 0x000000FFFFFFFFFFULL; SHL(64, R(RDX), Imm8(24)); - SAR(64, R(RDX), Imm8(24)); + SHR(64, R(RDX), Imm8(24)); // if ((accm & 0x3f) == 0) // shift = 0; @@ -1647,10 +1646,10 @@ void DSPEmitter::lsrnrx(const UDSPInstruction opc) FixupBranch shiftLeft = J_CC(CC_Z); NEG(16, R(RCX)); ADD(16, R(RCX), Imm16(0x40)); - SHL(64, R(RDX), R(RCX)); + SAR(64, R(RDX), R(RCX)); FixupBranch exit = J(); SetJumpTarget(shiftLeft); - SAR(64, R(RDX), R(RCX)); + SHL(64, R(RDX), R(RCX)); SetJumpTarget(noShift); SetJumpTarget(exit); @@ -1708,10 +1707,10 @@ void DSPEmitter::asrnrx(const UDSPInstruction opc) FixupBranch shiftLeft = J_CC(CC_Z); NEG(16, R(RCX)); ADD(16, R(RCX), Imm16(0x40)); - SHL(64, R(RDX), R(RCX)); + SAR(64, R(RDX), R(RCX)); FixupBranch exit = J(); SetJumpTarget(shiftLeft); - SAR(64, R(RDX), R(RCX)); + SHL(64, R(RDX), R(RCX)); SetJumpTarget(noShift); SetJumpTarget(exit); @@ -1770,14 +1769,13 @@ void DSPEmitter::lsrnr(const UDSPInstruction opc) FixupBranch shiftLeft = J_CC(CC_Z); NEG(16, R(RCX)); ADD(16, R(RCX), Imm16(0x40)); - SHL(64, R(RDX), R(RCX)); + SAR(64, R(RDX), R(RCX)); FixupBranch exit = J(); SetJumpTarget(shiftLeft); - SAR(64, R(RDX), R(RCX)); + SHL(64, R(RDX), R(RCX)); SetJumpTarget(noShift); SetJumpTarget(exit); - // dsp_set_long_acc(dreg, (s64)acc); set_long_acc(dreg, RDX); SetJumpTarget(zero); @@ -1830,10 +1828,10 @@ void DSPEmitter::asrnr(const UDSPInstruction opc) FixupBranch shiftLeft = J_CC(CC_Z); NEG(16, R(RCX)); ADD(16, R(RCX), Imm16(0x40)); - SHL(64, R(RDX), R(RCX)); + SAR(64, R(RDX), R(RCX)); FixupBranch exit = J(); SetJumpTarget(shiftLeft); - SAR(64, R(RDX), R(RCX)); + SHL(64, R(RDX), R(RCX)); SetJumpTarget(noShift); SetJumpTarget(exit);