Skip to content

Conversation

tannergooding
Copy link
Member

@tannergooding tannergooding commented Jun 27, 2025

This allows for shorter and less complex trees to persist throughout the lifetime of the JIT, leading to less overall work and more optimizations being possible when such masks are used.

@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 Jun 27, 2025
Copy link
Contributor

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

@tannergooding tannergooding force-pushed the early-msk-fld branch 2 times, most recently from 19e697d to 307f762 Compare June 27, 2025 22:59
@tannergooding tannergooding marked this pull request as ready for review June 28, 2025 05:18
@Copilot Copilot AI review requested due to automatic review settings June 28, 2025 05:18
Copy link
Contributor

@Copilot 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 moves certain mask simplification operations to occur earlier during the JIT morph phase, thereby reducing tree complexity and enabling further optimizations.

  • Removed the dedicated FEATURE_MASKED_HW_INTRINSICS block from fgOptimizeHWIntrinsic.
  • Updated mask checking functions in various locations to use IsMaskZero/IsMaskAllBitsSet instead of legacy IsFalseMask and IsCnsVec checks.
  • Adjusted assertions and folding logic in both gentree.cpp and lowerarmarch.cpp to align with the new mask constant API.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/jit/morph.cpp Removed masked intrinsic optimization block and updated SIMD/mask type checks.
src/coreclr/jit/lowerarmarch.cpp Updated legacy false mask checks to the new IsMaskZero API for consistency.
src/coreclr/jit/gentree.h Replaced IsFalseMask with new IsMaskZero and IsMaskAllBitsSet methods.
src/coreclr/jit/gentree.cpp Updated folding logic and assertions to use new mask methods.
src/coreclr/jit/compiler.h Removed declarations for masked intrinsic helper functions no longer in use.
Comments suppressed due to low confidence (4)

src/coreclr/jit/gentree.h:1808

  • The legacy IsFalseMask method has been removed in favor of the more clearly named IsMaskZero. Ensure that the documentation and any related comments in client code are updated to reflect this naming change.
    inline bool IsTrueMask(var_types simdBaseType) const;

@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib for review. This has some minimal improvements right now and will have greater impact once the changes to implicitly use the mask producing compares for V128/V256 goes in. -- I separated this out since its an independent improvement and helps isolate the V128/V256 changes to help assert they're doing the right things standalone

@tannergooding
Copy link
Member Author

(Resolved merge conflicts, no additional changes)

@tannergooding tannergooding merged commit 8dfd2b7 into dotnet:main Jul 1, 2025
110 of 112 checks passed
@tannergooding tannergooding deleted the early-msk-fld branch July 1, 2025 18:58
a74nh added a commit to a74nh/runtime that referenced this pull request Jul 4, 2025
Fixes dotnet#101970

Predicate variants were implemented in dotnet#114438 and then turned off in dotnet#115566. The code was then removed in dotnet#117101 when the AMD64 version was moved to from morph to folding.

This is a simple rework of that code.
Replaces dotnet#116854
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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