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

JitArm64: Optimize divwx #10057

Merged
merged 6 commits into from Sep 20, 2021
Merged

Conversation

JosJuice
Copy link
Member

JitArm64 port of PR #9566.

When the dividend is known at compile time, we can eliminate some
of the branching and precompute the result for the overflow case.
Zero divided by any number is still zero. For whatever reason,
this case shows up frequently too.
Optimize division by a constant into multiplication. This method is
also used by GCC and LLVM.

We also add optimized paths for divisors 0, 1, and -1, because they
don't work using this method. They don't occur very often, but are
necessary for correctness.
Power-of-two divisors can be done more elegantly, so handle them
separately.
...and let's optimize a divisor of 2 ever so slightly for
good measure. Most GameCube games seem to hit this on launch.
Copy link
Member

@leoetlino leoetlino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, 2 of 2 files at r4, 1 of 1 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @JosJuice)

@leoetlino leoetlino merged commit 6129290 into dolphin-emu:master Sep 20, 2021
11 checks passed
@JosJuice JosJuice deleted the jitarm64-divwx branch September 20, 2021 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants