JitArm64: MultiplyImmediate - Handle -(2^n) + 1
Let's take advantage of ARM64's input register shifting one last time, shall we? Before: 0x1280005b mov w27, #-0x3 0x1b1b7f18 mul w24, w24, w27 After: 0x4b180b18 sub w24, w24, w24, lsl #2
This commit is contained in:
parent
7073a135c6
commit
274e34ddf1
|
@ -927,6 +927,16 @@ bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc)
|
|||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
else if (MathUtil::IsPow2(~imm + 2))
|
||||
{
|
||||
// Multiplication by a negative power of two plus one (-(2^n) + 1).
|
||||
const int shift = IntLog2(~imm + 2);
|
||||
|
||||
gpr.BindToRegister(d, d == a);
|
||||
SUB(gpr.R(d), gpr.R(a), gpr.R(a), ArithOption(gpr.R(a), ShiftType::LSL, shift));
|
||||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Immediate did not match any known special cases.
|
||||
|
|
Loading…
Reference in New Issue