mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Optimize addi/addiu to just LEA when possible.
This commit is contained in:
parent
2db368c29a
commit
9e479b4391
1 changed files with 7 additions and 4 deletions
|
@ -78,11 +78,14 @@ namespace MIPSComp
|
|||
|
||||
gpr.Lock(rt, rs);
|
||||
gpr.BindToRegister(rt, rt == rs, true);
|
||||
if (rt != rs)
|
||||
if (rt == rs || gpr.R(rs).IsSimpleReg())
|
||||
LEA(32, gpr.RX(rt), MDisp(gpr.RX(rs), simm));
|
||||
else
|
||||
{
|
||||
MOV(32, gpr.R(rt), gpr.R(rs));
|
||||
if (simm != 0)
|
||||
ADD(32, gpr.R(rt), Imm32((u32)(s32)simm));
|
||||
// TODO: Can also do LEA if both operands happen to be in registers.
|
||||
if (simm != 0)
|
||||
ADD(32, gpr.R(rt), Imm32((u32)(s32)simm));
|
||||
}
|
||||
gpr.UnlockAll();
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue