Ensure IsVectorPerElementMask does a correct check and use it in more places#126865
Draft
tannergooding wants to merge 3 commits intodotnet:mainfrom
Draft
Ensure IsVectorPerElementMask does a correct check and use it in more places#126865tannergooding wants to merge 3 commits intodotnet:mainfrom
tannergooding wants to merge 3 commits intodotnet:mainfrom
Conversation
…tible with the expected element count
…lementMask(baseType, simdSize)
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the JIT’s notion of “per-element masks” for SIMD/MASK values and applies that stricter check in additional folding/morphing/value-numbering scenarios, aiming to enable safe optimizations while avoiding mismatched mask element-count issues.
Changes:
- Adds
ValueNumStore::GetConstantSimdto centralize SIMD constant extraction and uses it in existing SIMD constant checks. - Expands/aligns
IsVectorPerElementMasklogic in bothGenTreeandValueNumStore(including support for MASK constants and element-count validation). - Uses the updated per-element mask checks in more folding/morphing paths for comparisons against
Zero/AllBitsSet.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/valuenum.h | Adds GetConstantSimd declaration; updates HWIntrinsic VN helper signature; declares IsVectorPerElementMask in VN store. |
| src/coreclr/jit/valuenum.cpp | Implements GetConstantSimd; adds VN-based IsVectorPerElementMask; updates folding logic to use it; adjusts HWIntrinsic VN helper. |
| src/coreclr/jit/simd.h | Makes helper array predicates const-correct; adds an overload to check per-element mask-ness for simd_t given base type + element count. |
| src/coreclr/jit/morph.cpp | Uses IsVectorPerElementMask to guard compare morph optimizations involving per-element masks. |
| src/coreclr/jit/gentree.cpp | Strengthens GenTree::IsVectorPerElementMask to validate MASK constants and intrinsic compatibility; uses it in HWIntrinsic folding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.