mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-01 01:34:53 +00:00
JitArm64: MultiplyImmediate - Handle -(2^n)
ARM64's flexible shifting of input registers also allows us to calculate a negative power of two in one instruction; shift the input of a NEG instruction. Before: 0x128001f7 mov w23, #-0x10 0x1b1a7efa mul w26, w23, w26 0x93407f58 sxtw x24, w26 After: 0x4b1a13fa neg w26, w26, lsl #4 0x93407f58 sxtw x24, w26
This commit is contained in:
parent
1c87f040a3
commit
7073a135c6
1 changed files with 10 additions and 0 deletions
|
@ -917,6 +917,16 @@ bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc)
|
||||||
if (rc)
|
if (rc)
|
||||||
ComputeRC0(gpr.R(d));
|
ComputeRC0(gpr.R(d));
|
||||||
}
|
}
|
||||||
|
else if (MathUtil::IsPow2(~imm + 1))
|
||||||
|
{
|
||||||
|
// Multiplication by a negative power of two (-(2^n)).
|
||||||
|
const int shift = IntLog2(~imm + 1);
|
||||||
|
|
||||||
|
gpr.BindToRegister(d, d == a);
|
||||||
|
NEG(gpr.R(d), gpr.R(a), ArithOption(gpr.R(a), ShiftType::LSL, shift));
|
||||||
|
if (rc)
|
||||||
|
ComputeRC0(gpr.R(d));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Immediate did not match any known special cases.
|
// Immediate did not match any known special cases.
|
||||||
|
|
Loading…
Add table
Reference in a new issue