Skip to content

Commit

Permalink
JitArm64_Integer: addzex - Optimize InHostCarry case for 0
Browse files Browse the repository at this point in the history
Before:
0x5280000d   mov    w13, #0x0                 ; =0
0x1a1f01ae   adc    w14, w13, wzr

After:
0x1a9f37ee   cset   w14, hs
  • Loading branch information
Sintendo committed Dec 28, 2024
1 parent c817b47 commit 9691177
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,7 @@ void JitArm64::addzex(UGeckoInstruction inst)

int a = inst.RA, d = inst.RD;

if (gpr.IsImm(a) &&
(HasConstantCarry() || (js.carryFlag == CarryFlag::InPPCState && gpr.GetImm(a) == 0)))
if (gpr.IsImm(a) && (gpr.GetImm(a) == 0 || HasConstantCarry()))
{
const u32 imm = gpr.GetImm(a);
const bool is_all_ones = imm == 0xFFFFFFFF;
Expand All @@ -1144,6 +1143,13 @@ void JitArm64::addzex(UGeckoInstruction inst)
ComputeCarry(false);
break;
}
case CarryFlag::InHostCarry:
{
gpr.BindToRegister(d, false);
CSET(gpr.R(d), CCFlags::CC_CS);
ComputeCarry(false);
break;
}
case CarryFlag::ConstantTrue:
{
gpr.SetImmediate(d, imm + 1);
Expand All @@ -1156,8 +1162,6 @@ void JitArm64::addzex(UGeckoInstruction inst)
ComputeCarry(false);
break;
}
default:
Common::Unreachable();
}
}
else
Expand Down

0 comments on commit 9691177

Please sign in to comment.