-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add small morph peep #45463
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
Add small morph peep #45463
Conversation
|
A few notes:
|
|
(out of curiosity) would it be possible to eliminate the extra method bool M(int x)
{
const int y = 2147483647; // 231 - 1
return (x & y) == 0;
}
codegen comparison - clang
+ RyuJIT
- test edi, 2147483647
+ test edx, 2147483647
sete al
+ movzx eax, al
ret |
|
SPMI diffs are pretty small across libraries and tests. A few regressions in tests where we can't CSE a duplicated MOD after morphing one of them. |
|
@am11 That would be a different issue. I don't think we can eliminate the zero extend in this case because we need to whole register to be set on return, not just the low byte. clang might assume that for |
|
@AndyAyersMS What do you think about this change? Smallish benefit, appears not to hit on arm (maybe due to phase ordering?). Is it the "right place" for such a "peep"? |
|
Seems like the right place. Can you show an example diff? |
|
For: the win-x64 diff is: |
|
It's placed inside |
|
@EgorBo I don't think so, because in the |
Not sure I follow, here is what we generate now: https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIAYACY8gOgCUBXAOwwEt8YLAMIR8AB14AbGFADKMgG68wMXAG4aNYgGYmpBkIYBvGgzMNT5gNoBZGBgAWEACYBJcZIAUdxy/djJAHkxPgguXBYAOQhXLkleLgSAcwBKAF1LM2AICEkGABVVDE8EjAYEFMzjKvMmAHZyhgBSBgAOBgBeDoY6DWpagF8aAaA vs what llvm does: https://godbolt.org/z/c43fKv (we'll need an additional |
|
// Auto-generated message 69e114c which was merged 12/7 removed the intermediate src/coreclr/src/ folder. This PR needs to be updated as it touches files in that directory which causes conflicts. To update your commits you can use this bash script: https://gist.github.com/ViktorHofer/6d24f62abdcddb518b4966ead5ef3783. Feel free to use the comment section of the gist to improve the script for others. |
|
@BruceForstall you have merge conflicts to resolve here. |
|
Also agree with @EgorBo -- can you look into the case where this is not under JTRUE? |
|
ping myself |
|
ping myself again |
|
ping myself |
|
Ok, I moved the change to post-order EQ/NE processing (instead of JTRUE processing), and the diffs are almost strictly better (there are a couple cases where we inject a reg/reg move for no good reason...) Example diffs (spmi windows x64 benchmarks): Detail diffs |
|
@AndyAyersMS @EgorBo Take another look? |
Convert `x % 2^c == 0` to `x & (2^c-1) == 0` to generate better code.
|
CI failure is #52031 |
Convert
x % 2 == 0tox & 1 == 0to generate better code.