Uh oh!
There was an error while loading. Please reload this page.
ARM64 - Optimizing a % b operations - #65535
Conversation
ghost
commented
Feb 18, 2022
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsAddressing this issue: #34937 Description There are various ways to optimize Example: Acceptance Criteria
|
EgorBo
commented
Feb 18, 2022
Shouldn't we just remove early expansion of UMOD/MOD for arm64 from morph and use the shared (with x86) impl in lower instead? |
TIHan
commented
Feb 18, 2022
@EgorBo are you referring to |
EgorBo
commented
Feb 18, 2022
yeah, and just move One potential problem with this approach that it might produce regressions where |
TIHan
commented
Feb 18, 2022
It makes sense that we should do it there so the earlier phases don't screw it up. |
TIHan
commented
Feb 18, 2022
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. |
tannergooding
commented
Feb 18, 2022
@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 |
Uh oh!
There was an error while loading. Please reload this page.
kunalspathak
commented
Feb 18, 2022
I agree. |
EgorBo
commented
Feb 18, 2022
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 |
EgorBo
commented
Feb 18, 2022
I'm fine with doing |
TIHan
commented
Mar 9, 2022
@kunalspathak @echesakovMSFT This is ready. Will try to restart CI. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kunalspathak
left a comment
There was a problem hiding this comment.
LGTM with nice diffs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* 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 % bcan be transformed intoa & (b - 1)if they are unsigned integers andbis a constant with the power of 2.Acceptance Criteria
Add Tests(asmdiffs cover this)