JitArm64: MultiplyImmediate - Handle 2^n
Turn multiplications by a power of two into bitshifts. Before: 0x52800817 mov w23, #0x40 0x1b167ef6 mul w22, w23, w22 After: 0x531a66d6 lsl w22, w22, #6
This commit is contained in:
parent
f25611f388
commit
3aaf1a2b8b
|
@ -7,6 +7,7 @@
|
|||
#include "Common/Assert.h"
|
||||
#include "Common/BitUtils.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MathUtil.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
|
@ -894,6 +895,15 @@ bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc)
|
|||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
else if (MathUtil::IsPow2(imm))
|
||||
{
|
||||
const int shift = IntLog2(imm);
|
||||
|
||||
gpr.BindToRegister(d, d == a);
|
||||
LSL(gpr.R(d), gpr.R(a), shift);
|
||||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Immediate did not match any known special cases.
|
||||
|
|
Loading…
Reference in New Issue