Skip to content

Ensure IsVectorPerElementMask does a correct check and use it in more places#126865

Draft
tannergooding wants to merge 3 commits intodotnet:mainfrom
tannergooding:fix-isvecperelemmsk
Draft

Ensure IsVectorPerElementMask does a correct check and use it in more places#126865
tannergooding wants to merge 3 commits intodotnet:mainfrom
tannergooding:fix-isvecperelemmsk

Conversation

@tannergooding
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 14, 2026 05:11
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 14, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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::GetConstantSimd to centralize SIMD constant extraction and uses it in existing SIMD constant checks.
  • Expands/aligns IsVectorPerElementMask logic in both GenTree and ValueNumStore (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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants