From c817b4779daf6b58a25bfb194a156e3215177574 Mon Sep 17 00:00:00 2001 From: Sintendo <3380580+Sintendo@users.noreply.github.com> Date: Sat, 28 Dec 2024 23:20:17 +0100 Subject: [PATCH] JitArm64_Integer: addzex - Optimize InPPCState case for 0 Before: 0x52800019 mov w25, #0x0 ; =0 0x394bd3b8 ldrb w24, [x29, #0x2f4] 0x2b180339 adds w25, w25, w24 After: 0x394bd3b9 ldrb w25, [x29, #0x2f4] --- Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index c3ebc252e4..0b21cc2d9d 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -1129,13 +1129,21 @@ void JitArm64::addzex(UGeckoInstruction inst) int a = inst.RA, d = inst.RD; - if (gpr.IsImm(a) && HasConstantCarry()) + if (gpr.IsImm(a) && + (HasConstantCarry() || (js.carryFlag == CarryFlag::InPPCState && gpr.GetImm(a) == 0))) { const u32 imm = gpr.GetImm(a); const bool is_all_ones = imm == 0xFFFFFFFF; switch (js.carryFlag) { + case CarryFlag::InPPCState: + { + gpr.BindToRegister(d, false); + LDRB(IndexType::Unsigned, gpr.R(d), PPC_REG, PPCSTATE_OFF(xer_ca)); + ComputeCarry(false); + break; + } case CarryFlag::ConstantTrue: { gpr.SetImmediate(d, imm + 1);