JitArm64: MultiplyImmediate - Handle 1

Multiplication by one is also trivial. Depending on the registers
involved, either a single MOV or no instructions will be generated.

Before:
0x52800038   mov    w24, #0x1
0x1b1a7f1b   mul    w27, w24, w26

After:
0x2a1a03fb   mov    w27, w26

Before:
0x52800039   mov    w25, #0x1
0x1b1a7f3a   mul    w26, w25, w26

After:
Nothing!
This commit is contained in:
Bram Speeckaert 2022-11-01 19:58:27 +01:00
parent 51cb918aa5
commit f25611f388
1 changed files with 10 additions and 0 deletions

View File

@ -884,6 +884,16 @@ bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc)
if (rc)
ComputeRC0(gpr.GetImm(d));
}
else if (imm == 1)
{
if (d != a)
{
gpr.BindToRegister(d, false);
MOV(gpr.R(d), gpr.R(a));
}
if (rc)
ComputeRC0(gpr.R(d));
}
else
{
// Immediate did not match any known special cases.