JIT: Accelerate floating->long casts on x86#125180
Open
saucecontrol wants to merge 2 commits intodotnet:mainfrom
Open
JIT: Accelerate floating->long casts on x86#125180saucecontrol wants to merge 2 commits intodotnet:mainfrom
saucecontrol wants to merge 2 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends x86 JIT codegen to hardware-accelerate non-overflow floating→long/ulong casts using AVX-512 and AVX10.2, completing the remaining cast-acceleration work pulled from #116805.
Changes:
- Teach cast helper selection to allow floating↔long casts to stay intrinsic-based on x86 when AVX-512 is available.
- Add/extend x86 long decomposition logic to generate AVX-512/AVX10.2 sequences for floating→long/ulong and long→floating casts.
- Introduce a new AVX-512 scalar compare-mask intrinsic and wire it up for immediate bounds + containment.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/lowerxarch.cpp | Refactors vector constant construction and adds containment support for the new AVX-512 scalar compare-mask intrinsic. |
| src/coreclr/jit/hwintrinsicxarch.cpp | Adds immediate upper-bound handling for the new AVX-512 scalar compare-mask intrinsic. |
| src/coreclr/jit/hwintrinsiclistxarch.h | Introduces AVX512.CompareScalarMask as a new intrinsic mapping to vcmpss/vcmpsd with IMM. |
| src/coreclr/jit/flowgraph.cpp | Updates helper-requirement logic so x86 floating↔long casts can avoid helper calls when AVX-512 is available. |
| src/coreclr/jit/decomposelongs.cpp | Implements the AVX-512/AVX10.2-based lowering/decomposition sequences for floating↔long/ulong on x86. |
Member
Author
|
@dotnet/jit-contrib this is ready for review |
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.
This adds floating->long/ulong cast codegen for AVX-512 and AVX10.2 on x86. With this, all non-overflow casts are now hardware accelerated. This is the last bit pulled from #116805.
Typical Diff (double->long AVX-512):
Full Diffs
Breakdown of the double->long asm: