From 12b37ba3233202fc216c26c761b09193fcb5506c Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sat, 9 Aug 2008 18:32:10 +0000 Subject: [PATCH] 3 more activated instructions in the jit = maybe 1% more speed ;P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@163 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Interpreter/Interpreter_Integer.cpp | 2 +- Source/Core/Core/Src/PowerPC/Jit64/Jit.h | 2 + .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 60 +++++++++++++++---- .../PowerPC/Jit64/Jit_LoadStoreFloating.cpp | 4 +- Source/Core/Core/Src/PowerPC/PPCTables.cpp | 8 +-- 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp index c3eebfabe6..75b76015dc 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -391,7 +391,7 @@ void CInterpreter::srawix(UGeckoInstruction _inst) void CInterpreter::srwx(UGeckoInstruction _inst) { u32 amount = m_GPR[_inst.RB]; - m_GPR[_inst.RA] = (amount&0x20) ? 0 : m_GPR[_inst.RS] >> amount; + m_GPR[_inst.RA] = (amount & 0x20) ? 0 : (m_GPR[_inst.RS] >> amount); if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RA]); } diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h index ed5f7bc49a..15c791ac67 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h @@ -147,6 +147,8 @@ namespace Jit64 void rlwinmx(UGeckoInstruction inst); void rlwimix(UGeckoInstruction inst); void rlwnmx(UGeckoInstruction inst); + void negx(UGeckoInstruction inst); + void slwx(UGeckoInstruction inst); void srwx(UGeckoInstruction inst); void dcbz(UGeckoInstruction inst); void lfsx(UGeckoInstruction inst); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index 787b4fe7c1..ab3ad5640d 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -67,7 +67,7 @@ namespace Jit64 } else { - _assert_msg_(DYNA_REC,0,"WTF"); + _assert_msg_(DYNA_REC, 0, "WTF"); } if (Rc) { @@ -93,10 +93,10 @@ namespace Jit64 case 25: regimmop(a, s, true, inst.UIMM << 16, Or, OR, false); break;//oris case 28: regimmop(a, s, true, inst.UIMM, And, AND, true); break; case 29: regimmop(a, s, true, inst.UIMM << 16, And, AND, true); break; + case 26: regimmop(a, s, true, inst.UIMM, Xor, XOR, false); break; //xori + case 27: regimmop(a, s, true, inst.UIMM << 16, Xor, XOR, false); break; //xoris case 12: //addic case 13: //addic_rc - case 26: //xori - case 27: //xoris default: Default(inst); break; @@ -633,7 +633,6 @@ namespace Jit64 } u32 mask = Helper_Mask(inst.MB, inst.ME); - gpr.FlushR(ECX); gpr.LockX(ECX); gpr.Lock(a, b, s); @@ -652,21 +651,34 @@ namespace Jit64 } } + void negx(UGeckoInstruction inst) + { + INSTRUCTION_START; + int a = inst.RA; + int d = inst.RD; + gpr.Lock(a, d); + gpr.LoadToX64(d, a == d, true); + if (a != d) + MOV(32, gpr.R(d), gpr.R(a)); + NEG(32, gpr.R(d)); + gpr.UnlockAll(); + if (inst.Rc) + { + MOV(32, R(EAX), gpr.R(a)); + CALL((u8*)Asm::computeRc); + } + } + void srwx(UGeckoInstruction inst) { INSTRUCTION_START; - // BUGGY? - Default(inst); return; int a = inst.RA; int b = inst.RB; int s = inst.RS; gpr.FlushR(ECX); gpr.LockX(ECX); gpr.Lock(a, b, s); - if (a == s) - gpr.LoadToX64(a, true, true); - else - gpr.LoadToX64(a, false, true); + gpr.LoadToX64(a, a == s || a == b || s == b, true); MOV(32, R(ECX), gpr.R(b)); AND(32, R(ECX), Imm8(63)); XOR(32, R(EAX), R(EAX)); @@ -685,6 +697,34 @@ namespace Jit64 } } + void slwx(UGeckoInstruction inst) + { + INSTRUCTION_START; + int a = inst.RA; + int b = inst.RB; + int s = inst.RS; + gpr.FlushR(ECX); + gpr.LockX(ECX); + gpr.Lock(a, b, s); + gpr.LoadToX64(a, a == s || a == b || s == b, true); + MOV(32, R(ECX), gpr.R(b)); + AND(32, R(ECX), Imm8(63)); + XOR(32, R(EAX), R(EAX)); + TEST(32, R(ECX), Imm32(32)); + FixupBranch branch = J_CC(CC_NZ); + MOV(32, R(EAX), gpr.R(s)); + SHL(32, R(EAX), R(ECX)); + SetJumpTarget(branch); + MOV(32, gpr.R(a), R(EAX)); + gpr.UnlockAll(); + gpr.UnlockAllX(); + if (inst.Rc) + { + MOV(32, R(EAX), gpr.R(a)); + CALL((u8*)Asm::computeRc); + } + } + // another crazy instruction :( void srawix(UGeckoInstruction inst) { diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index 56a776831f..f49f395b2b 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -93,6 +93,7 @@ void lfs(UGeckoInstruction inst) gpr.UnlockAll(); fpr.UnlockAll(); } + void lfd(UGeckoInstruction inst) { INSTRUCTION_START; @@ -112,8 +113,7 @@ void lfd(UGeckoInstruction inst) MOV(64, M(&temp64), R(EAX)); fpr.Lock(d); fpr.LoadToX64(d, false); - MOVSD(fpr.RX(d), M(&temp64)); - MOVDDUP(fpr.RX(d), fpr.R(d)); + MOVDDUP(fpr.RX(d), M(&temp64)); gpr.UnlockAll(); fpr.UnlockAll(); } diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index 4eb5ee9910..a16fc46bf0 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -155,8 +155,8 @@ GekkoOPTemplate primarytable[] = {24, CInterpreter::ori, Jit64::reg_imm, {"ori", OPTYPE_INTEGER, 0}}, {25, CInterpreter::oris, Jit64::reg_imm, {"oris", OPTYPE_INTEGER, 0}}, - {26, CInterpreter::xori, Jit64::Default, {"xori", OPTYPE_INTEGER, 0}}, - {27, CInterpreter::xoris, Jit64::Default, {"xoris", OPTYPE_INTEGER, 0}}, + {26, CInterpreter::xori, Jit64::reg_imm, {"xori", OPTYPE_INTEGER, 0}}, + {27, CInterpreter::xoris, Jit64::reg_imm, {"xoris", OPTYPE_INTEGER, 0}}, {28, CInterpreter::andi_rc, Jit64::reg_imm, {"andi_rc", OPTYPE_INTEGER, FL_SET_CR0}}, {29, CInterpreter::andis_rc, Jit64::reg_imm, {"andis_rc", OPTYPE_INTEGER, FL_SET_CR0}}, @@ -291,7 +291,7 @@ GekkoOPTemplate table31[] = {536, CInterpreter::srwx, Jit64::srwx, {"srwx", OPTYPE_INTEGER, FL_RC_BIT}}, {792, CInterpreter::srawx, Jit64::Default, {"srawx", OPTYPE_INTEGER, FL_RC_BIT}}, {824, CInterpreter::srawix, Jit64::srawix, {"srawix", OPTYPE_INTEGER, FL_RC_BIT}}, - {24, CInterpreter::slwx, Jit64::Default, {"slwx", OPTYPE_INTEGER, FL_RC_BIT}}, + {24, CInterpreter::slwx, Jit64::slwx, {"slwx", OPTYPE_INTEGER, FL_RC_BIT}}, {54, CInterpreter::dcbst, Jit64::Default, {"dcbst", OPTYPE_DCACHE, 0, 4}}, {86, CInterpreter::dcbf, Jit64::Default, {"dcbf", OPTYPE_DCACHE, 0, 4}}, @@ -396,7 +396,7 @@ GekkoOPTemplate table31_2[] = {75, CInterpreter::mulhwx, Jit64::Default, {"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT, 4}}, {11, CInterpreter::mulhwux, Jit64::mulhwux, {"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT, 4}}, {235, CInterpreter::mullwx, Jit64::mullwx, {"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT, 4}}, - {104, CInterpreter::negx, Jit64::Default, {"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT}}, + {104, CInterpreter::negx, Jit64::negx, {"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT}}, {40, CInterpreter::subfx, Jit64::subfx, {"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_RC_BIT}}, {8, CInterpreter::subfcx, Jit64::Default, {"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_SET_CA | FL_RC_BIT}}, {136, CInterpreter::subfex, Jit64::Default, {"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_IN_B | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},