From f575c2c3be88fa9b7d9327c8a4e90ca84d2bcf30 Mon Sep 17 00:00:00 2001 From: calc84maniac Date: Mon, 2 Jan 2012 18:00:28 -0500 Subject: [PATCH] srwx and slwx optimizations --- .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index c2726fc7de..b0be8517c7 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -1652,28 +1652,33 @@ void Jit64::srwx(UGeckoInstruction inst) { u32 amount = (u32)gpr.R(b).offset; gpr.SetImmediate32(a, (amount & 0x20) ? 0 : ((u32)gpr.R(s).offset >> (amount & 0x1f))); + if (inst.Rc) + { + ComputeRC(gpr.R(a)); + } } else { gpr.FlushLockX(ECX); gpr.Lock(a, b, s); - gpr.BindToRegister(a, a == s || a == b || s == b, true); + gpr.BindToRegister(a, true, true); MOV(32, R(ECX), gpr.R(b)); - 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)); - SHR(32, R(EAX), R(ECX)); + if (a != s) + { + MOV(32, gpr.R(a), gpr.R(s)); + } + FixupBranch branch = J_CC(CC_Z); + XOR(32, gpr.R(a), gpr.R(a)); SetJumpTarget(branch); - MOV(32, gpr.R(a), R(EAX)); + SHR(32, gpr.R(a), R(ECX)); + if (inst.Rc) + { + GenerateRC(); + } gpr.UnlockAll(); gpr.UnlockAllX(); } - - if (inst.Rc) - { - ComputeRC(gpr.R(a)); - } } void Jit64::slwx(UGeckoInstruction inst) @@ -1688,28 +1693,33 @@ void Jit64::slwx(UGeckoInstruction inst) { u32 amount = (u32)gpr.R(b).offset; gpr.SetImmediate32(a, (amount & 0x20) ? 0 : (u32)gpr.R(s).offset << amount); + if (inst.Rc) + { + ComputeRC(gpr.R(a)); + } } else { gpr.FlushLockX(ECX); gpr.Lock(a, b, s); - gpr.BindToRegister(a, a == s || a == b || s == b, true); + gpr.BindToRegister(a, true, true); MOV(32, R(ECX), gpr.R(b)); - 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)); + if (a != s) + { + MOV(32, gpr.R(a), gpr.R(s)); + } + FixupBranch branch = J_CC(CC_Z); + XOR(32, gpr.R(a), gpr.R(a)); SetJumpTarget(branch); - MOV(32, gpr.R(a), R(EAX)); + SHL(32, gpr.R(a), R(ECX)); + if (inst.Rc) + { + GenerateRC(); + } gpr.UnlockAll(); gpr.UnlockAllX(); } - - if (inst.Rc) - { - ComputeRC(gpr.R(a)); - } } void Jit64::srawx(UGeckoInstruction inst)