Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jit64: divwx - One more micro-optimization #10199

Merged
merged 2 commits into from Nov 3, 2021

Conversation

Sintendo
Copy link
Member

@Sintendo Sintendo commented Nov 3, 2021

The division by 2 case can be improved ever so slightly by using eax when possible to isolate the sign bit. This saves a byte when the destination ends up as r8-15, because those require a REX prefix.

I also improved the comments a little in this area.


Before:

41 8B C5             mov         eax,r13d
41 C1 ED 1F          shr         r13d,1Fh
44 03 E8             add         r13d,eax
41 D1 FD             sar         r13d,1

After:

41 8B C5             mov         eax,r13d
C1 E8 1F             shr         eax,1Fh
44 03 E8             add         r13d,eax
41 D1 FD             sar         r13d,1

Prefer using eax to isolate the sign bit. This saves a byte when the
destination ends up as r8-15, because those require a REX prefix.

Before:
41 8B C5             mov         eax,r13d
41 C1 ED 1F          shr         r13d,1Fh
44 03 E8             add         r13d,eax
41 D1 FD             sar         r13d,1

After:
41 8B C5             mov         eax,r13d
C1 E8 1F             shr         eax,1Fh
44 03 E8             add         r13d,eax
41 D1 FD             sar         r13d,1
@lioncash lioncash merged commit 39ccdc1 into dolphin-emu:master Nov 3, 2021
10 checks passed
@Sintendo Sintendo deleted the jit64divwxnits branch November 3, 2021 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants