-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[JIT] Always transform AND(X, CNS(-1))
to X
#82276
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsWe can always skip
|
Can this optimization be done in lowering instead so that all targets benefit equally? Are there any benefits to the existing x64 peephole for doing the optimization in codegen? |
What's leading to the |
Good points, since we don't have to worry about the upper 32 bits, we could do the transform earlier. I have an idea where. |
Even on 64-bit we can do the optimization for |
I don't think we can - I remember trying to do (x & -1) optimization in an earlier phase before; ran into issues of the upper 32bits, which is why I did it as a peephole. However, we could definitely do a |
I'd be interested to see the example, that certainly sounds odd or like there is a bug somewhere else. |
So, we definitely should do the transformation in lowering for x86 because we catch cases of |
@dotnet/jit-contrib This is ready PTAL @BruceForstall |
Diffs -- significant asm diffs on x86, a few on x64 |
AND(X, CNS(-1))
to X
/azp run runtime-coreclr superpmi-diffs |
/azp run runtime-coreclr superpmi-replay |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
@dotnet/jit-contrib @jakobbotsch this is ready again. current superpmi replay failure is unrelated |
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!
Dope |
Description
We should always try to lower
AND(X, CNS(-1))
toX
if possible. We do this transformation in lowering to pick up this pattern as a result of decomposing longs on 32bit archs.