-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
ARM64 - Optimizing a % b operations #65535
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsAddressing this issue: #34937 Description There are various ways to optimize Example: Acceptance Criteria
|
Shouldn't we just remove early expansion of UMOD/MOD for arm64 from morph and use the shared (with x86) impl in lower instead? |
@EgorBo are you referring to |
yeah, and just move One potential problem with this approach that it might produce regressions where |
It makes sense that we should do it there so the earlier phases don't screw it up. |
I did some work to see if I could move the existing mod optimizations to lowering, but it might be a bit much for what the PR is trying to accomplish. |
@EgorBo, I would've thought it was better to do it early in morph so other things can more easily take advantage of the optimization (we don't optimize around |
I agree. |
cc @kunalspathak @tannergooding I personally think it's not, for any non-leaf X in
instead of just:
E.g. it makes it non-hoistable for ARM64, e.g. see this: |
@EgorBo, I was referring specifically to the It should be a clear improvement to recognize and replace |
I'm fine with doing |
@kunalspathak @echesakovMSFT This is ready. Will try to restart CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nice diffs.
* Initial work for ARM64 mod optimization * Updated comment * Updated comment * Updated comment * Fixing build * Remove uneeded var * Use '%' morph logic for both x64/arm64 * Adding back in divisor check for x64 * Formatting * Update comments * Update comments * Fixing * Updated comment * Updated comment * Tweaking x64 transformation logic for the mod opt * Tweaking x64 transformation logic for the mod opt * Using IntCon * Fixed build * Minor tweak * Fixing x64 diffs * Removing flag set * Feedback * Fixing build * Feedback * Fixing tests * Fixing tests * Fixing tests * Formatting * Fixing tests * Feedback * Fixing build
Addressing part of this issue: #34937
Description
There are various ways to optimize
%
for integers on ARM64.a % b
can be transformed intoa & (b - 1)
if they are unsigned integers andb
is a constant with the power of 2.Acceptance Criteria
Add Tests(asmdiffs cover this)