JIT: Accelerate uint->floating casts on pre-AVX-512 x86#124114
JIT: Accelerate uint->floating casts on pre-AVX-512 x86#124114tannergooding merged 4 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR extends the JIT’s cast handling to avoid helper calls for uint → floating-point conversions on pre-AVX-512 x86, while also centralizing the “cast requires helper” decision logic to simplify fgMorphExpandCast.
Changes:
- Add
Compiler::fgCastRequiresHelperand use it from importer/morph to consolidate helper-call decisions for casts. - Implement x86 lowering for
uint→float/doublecasts without helper calls when AVX-512 unsigned-convert is unavailable. - Adjust cast handling/refactoring in
fgMorphExpandCastand AVX-512 long→floating decomposition codepaths.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/morph.cpp | Refactors cast expansion to use fgCastRequiresHelper and simplifies helper selection logic. |
| src/coreclr/jit/lowerxarch.cpp | Adds x86 lowering sequence for uint→floating casts without helper calls (pre-AVX-512 path). |
| src/coreclr/jit/importer.cpp | Replaces ad-hoc helper decision logic with fgCastRequiresHelper. |
| src/coreclr/jit/flowgraph.cpp | Introduces fgCastRequiresHelper implementation. |
| src/coreclr/jit/decomposelongs.cpp | Minor refactor/clarification for AVX-512 long→floating cast decomposition. |
| src/coreclr/jit/compiler.h | Declares fgCastRequiresHelper. |
|
@dotnet/jit-contrib this is ready for review. Diffs show an odd throughput regression for Windows x64. Looks like it might just be lack of /LTCG? |
|
@anthonycanino, @kg @tannergooding PTAL. |
|
Looks okay to me, going to defer to @tannergooding for the final approval though |
|
Updated diffs. The mysterious Windows x64 throughput regression I saw last month has resolved itself. |
This is another one peeled from #116805 (only one more to go after this 😄)
It takes care of uint->floating casts without a helper call on pre-AVX-512 x86. Since baseline x86 is the only platform without native instructions for all 32-bit conversions, adding this allows some more simplification in
fgMorphExpandCastTypical diff: