diff options
| author | Bram Speeckaert <bram.speeckaert@gmail.com> | 2022-11-01 21:28:41 +0100 |
|---|---|---|
| committer | Bram Speeckaert <bram.speeckaert@gmail.com> | 2022-11-02 21:53:19 +0100 |
| commit | 1c87f040a3b0771f9b5d231eb5dee620d15b7ed6 (patch) | |
| tree | 7dbf0f6554c54c315436f7013b4b7e8db66e69ae /Source | |
| parent | 20dd5cadab461843a5f5f9def26638bb5bc2c3a4 (diff) | |
JitArm64: mulli - Only allocate reg when necessary
If the destination register doesn't equal the input register, using it
to temporarily hold the immediate value is fair game as it'll be
overwritten with the result of the multiplication anyway. This can
slightly reduce register pressure.
Before:
0x52800659 mov w25, #0x32
0x1b197f5b mul w27, w26, w25
After:
0x5280065b mov w27, #0x32
0x1b1b7f5b mul w27, w26, w27
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index 7d0e797340..6cd902d0c9 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -944,11 +944,16 @@ void JitArm64::mulli(UGeckoInstruction inst) } else { - gpr.BindToRegister(d, d == a); - ARM64Reg WA = gpr.GetReg(); + const bool allocate_reg = d == a; + gpr.BindToRegister(d, allocate_reg); + + // Reuse d to hold the immediate if possible, allocate a register otherwise. + ARM64Reg WA = allocate_reg ? gpr.GetReg() : gpr.R(d); + MOVI2R(WA, (u32)(s32)inst.SIMM_16); MUL(gpr.R(d), gpr.R(a), WA); - gpr.Unlock(WA); + if (allocate_reg) + gpr.Unlock(WA); } } |
