From 800595980e0bea5a8da5bfe4124369f89c2bf8af Mon Sep 17 00:00:00 2001 From: "j4ck.fr0st" Date: Sun, 11 Apr 2010 12:27:27 +0000 Subject: [PATCH] Fixed a small bug in J_CC when emitting jumps that exceed 0x80 in range (only used by DSP NR yet). Add back a CMP nakee missed in his last commit git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5328 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/x64Emitter.cpp | 2 +- Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp | 2 ++ Source/UnitTests/AudioJitTests.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 575247d840..996d51ae74 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -368,7 +368,7 @@ FixupBranch XEmitter::J_CC(CCFlags conditionCode, bool force5bytes) { FixupBranch branch; branch.type = force5bytes ? 1 : 0; - branch.ptr = code + (force5bytes ? 5 : 2); + branch.ptr = code + (force5bytes ? 6 : 2); if (!force5bytes) { //8 bits will do diff --git a/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp b/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp index af3bf6e5ed..8c7edd5704 100644 --- a/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp +++ b/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp @@ -125,6 +125,8 @@ void DSPEmitter::increase_addr_reg(int reg) XOR(32, R(ESI), R(ESI)); // i = 0 // if (value > 0) + CMP(16, R(EDX), Imm16(0)); + //end is further away than 0x7f, needs a 6-byte jz FixupBranch end = J_CC(CC_Z, true); FixupBranch negValue = J_CC(CC_L); diff --git a/Source/UnitTests/AudioJitTests.cpp b/Source/UnitTests/AudioJitTests.cpp index db17e24926..60597c9512 100644 --- a/Source/UnitTests/AudioJitTests.cpp +++ b/Source/UnitTests/AudioJitTests.cpp @@ -47,19 +47,21 @@ void nx_ir() void nx_nr() { SDSP test_dsp; - DSPJitTester tester(0x40, 0x0c); + DSPJitTester tester(0x40, 0x0c, true); - for (u16 input_reg = 0; input_reg < 50; input_reg++) + for (u16 input_reg = 0; input_reg < 10; input_reg++) for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++) + for (u16 input_ix0 = 0; input_ix0 < 10; input_ix0++) { memset(&test_dsp, 0, sizeof(SDSP)); + test_dsp.r[DSP_REG_IX0] = input_ix0; test_dsp.r[DSP_REG_WR0] = input_wr0; test_dsp.r[0] = input_reg; if (!tester.Test(test_dsp)) { - printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n", + printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x, ix0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n", tester.GetInstructionName(), - input_reg, input_wr0, + input_reg, input_wr0, input_ix0, tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]); } }