-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Allow more folding of SIMD compares #117099
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
4c1b4ca to
a44eed5
Compare
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.
Pull Request Overview
This PR extends the constant folding optimizations for SIMD compare operations on XARCH targets. Key changes include:
- Adding new handling for AVX/AVX512 compare intrinsics in rationalize.cpp
- Enhancing the transformation logic in morph.cpp and lowering in lowerxarch.cpp for more SIMD compare cases
- Removing the now-unused float comparison swap helper in hwintrinsicxarch.cpp and its declaration in hwintrinsic.h, and adding additional folding logic in gentree.cpp
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/rationalize.cpp | Adds a new switch case for AVX/AVX512 compare constants folding on XARCH |
| src/coreclr/jit/morph.cpp | Introduces transformations for folding compare intrinsics with constant mode adjustments |
| src/coreclr/jit/lowerxarch.cpp | Updates mask intrinsic handling and constant folding logic for compare operations |
| src/coreclr/jit/hwintrinsicxarch.cpp | Removes the obsolete lookupFloatComparisonModeForSwappedArgs function |
| src/coreclr/jit/hwintrinsic.h | Removes the declaration of the obsolete lookupFloatComparisonModeForSwappedArgs |
| src/coreclr/jit/gentree.cpp | Extends folding logic to support additional SIMD compare intrinsics |
Comments suppressed due to low confidence (2)
src/coreclr/jit/morph.cpp:9927
- In this branch, the constant value should be updated to 'newMode' instead of 'mode' to reflect the intended transformation when the mode is modified.
FloatComparisonMode mode =
src/coreclr/jit/lowerxarch.cpp:3077
- This update should assign 'newMode' to cmpOp3 rather than the original 'mode' to ensure the transformation correctly folds the intrinsic.
cmpOp3->AsIntConCommon()->SetIntegralValue(static_cast<uint8_t>(mode));
|
CC. @dotnet/jit-contrib, small improvement to the xarch codegen and constant folding around compares. Normalizes more of the compare constants to require less nodes and does so early, allowing more constant folding and small output in some scenarios. |
This ensures that more SIMD compares can undergo constant folding and light up as optimizations alongside the broader handling.