From 621b5b8e1a698b25d91d9c38bb203458958f686c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 14 Mar 2021 18:21:21 +0100 Subject: [PATCH] JitArm64: Optimize general case of srawx Same approach as Jit64. A lot simpler, don't you think? :) --- .../PowerPC/JitArm64/JitArm64_Integer.cpp | 50 +++---------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index db56cc1a6a..495d072db2 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -1456,13 +1456,12 @@ void JitArm64::srawx(UGeckoInstruction inst) } CSET(WA, CC_NEQ); - ComputeCarry(WA); gpr.Unlock(WA); } } - else if (!js.op->wantsCA) + else { gpr.BindToRegister(a, a == b || a == s); @@ -1472,48 +1471,15 @@ void JitArm64::srawx(UGeckoInstruction inst) ASRV(EncodeRegTo64(WA), EncodeRegTo64(WA), EncodeRegTo64(gpr.R(b))); LSR(EncodeRegTo64(gpr.R(a)), EncodeRegTo64(WA), 32); + if (js.op->wantsCA) + { + TST(gpr.R(a), WA); + CSET(WA, CC_NEQ); + ComputeCarry(WA); + } + gpr.Unlock(WA); } - else - { - gpr.BindToRegister(a, a == b || a == s); - ARM64Reg WA = gpr.GetReg(); - ARM64Reg WB = gpr.GetReg(); - ARM64Reg WC = gpr.GetReg(); - ARM64Reg RB = gpr.R(b); - ARM64Reg RS = gpr.R(s); - - ANDI2R(WA, RB, 32); - FixupBranch bit_is_not_zero = TBNZ(RB, 5); - - ANDSI2R(WC, RB, 31); - MOV(WB, RS); - FixupBranch is_zero = B(CC_EQ); - - ASRV(WB, RS, WC); - FixupBranch bit_is_zero = TBZ(RS, 31); - - MOVI2R(WA, 32); - SUB(WC, WA, WC); - LSLV(WC, RS, WC); - CMP(WC, 0); - CSET(WA, CC_NEQ); - FixupBranch end = B(); - - SetJumpTarget(bit_is_not_zero); - CMP(RS, 0); - CSET(WA, CC_LT); - CSINV(WB, ARM64Reg::WZR, ARM64Reg::WZR, CC_GE); - - SetJumpTarget(is_zero); - SetJumpTarget(bit_is_zero); - SetJumpTarget(end); - - MOV(gpr.R(a), WB); - ComputeCarry(WA); - - gpr.Unlock(WA, WB, WC); - } if (inst.Rc) ComputeRC0(gpr.R(a));