mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-12 09:09:12 +01:00
Jit64: divwx - Eliminate MOV for division by 2
When destination and input registers match, a redundant MOV instruction can be eliminated. Before: 8B C7 mov eax,edi 8B F8 mov edi,eax C1 EF 1F shr edi,1Fh 03 F8 add edi,eax D1 FF sar edi,1 After: 8B C7 mov eax,edi C1 EF 1F shr edi,1Fh 03 F8 add edi,eax D1 FF sar edi,1
This commit is contained in:
parent
4d37dad20d
commit
246adf0d6d
@ -1464,12 +1464,21 @@ void Jit64::divwx(UGeckoInstruction inst)
|
|||||||
else if (divisor == 2 || divisor == -2)
|
else if (divisor == 2 || divisor == -2)
|
||||||
{
|
{
|
||||||
X64Reg tmp = RSCRATCH;
|
X64Reg tmp = RSCRATCH;
|
||||||
if (Ra.IsSimpleReg() && Ra.GetSimpleReg() != Rd)
|
if (!Ra.IsSimpleReg())
|
||||||
tmp = Ra.GetSimpleReg();
|
{
|
||||||
else
|
|
||||||
MOV(32, R(tmp), Ra);
|
MOV(32, R(tmp), Ra);
|
||||||
|
|
||||||
MOV(32, Rd, R(tmp));
|
MOV(32, Rd, R(tmp));
|
||||||
|
}
|
||||||
|
else if (d == a)
|
||||||
|
{
|
||||||
|
MOV(32, R(tmp), Ra);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MOV(32, Rd, Ra);
|
||||||
|
tmp = Ra.GetSimpleReg();
|
||||||
|
}
|
||||||
|
|
||||||
SHR(32, Rd, Imm8(31));
|
SHR(32, Rd, Imm8(31));
|
||||||
ADD(32, Rd, R(tmp));
|
ADD(32, Rd, R(tmp));
|
||||||
SAR(32, Rd, Imm8(1));
|
SAR(32, Rd, Imm8(1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user