Jit64: divwx - Micro-optimize certain divisors
When the multiplier is positive (which is the most common case), we can generate slightly better code. - Division by 30307 Before: 49 63 C5 movsxd rax,r13d 48 69 C0 65 6B 32 45 imul rax,rax,45326B65h 4C 8B C0 mov r8,rax 48 C1 E8 3F shr rax,3Fh 49 C1 F8 2D sar r8,2Dh 44 03 C0 add r8d,eax After: 49 63 C5 movsxd rax,r13d 4C 69 C0 65 6B 32 45 imul r8,rax,45326B65h C1 E8 1F shr eax,1Fh 49 C1 F8 2D sar r8,2Dh 44 03 C0 add r8d,eax
This commit is contained in:
parent
95698c5ae1
commit
530475dce8
|
@ -1484,6 +1484,12 @@ void Jit64::divwx(UGeckoInstruction inst)
|
|||
SHR(32, Rd, Imm8(31));
|
||||
SAR(32, R(RSCRATCH), Imm8(m.shift));
|
||||
}
|
||||
else if (m.multiplier > 0)
|
||||
{
|
||||
IMUL(64, Rd, R(RSCRATCH), Imm32(m.multiplier));
|
||||
SHR(32, R(RSCRATCH), Imm8(31));
|
||||
SAR(64, R(Rd), Imm8(32 + m.shift));
|
||||
}
|
||||
else
|
||||
{
|
||||
IMUL(64, RSCRATCH, R(RSCRATCH), Imm32(m.multiplier));
|
||||
|
|
Loading…
Reference in New Issue