JIT: Fix small->uint->float casts with AVX-512 #112892
Open
+40
−52
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.
Fixes #112871
In lowering, we had logic that inserted an intermediate cast to int when casting small types to/from floating. The float->small case was already handled by morph and will not appear in lowering. The other direction doesn't require a cast as long as the small type is handled correctly in the containment check and codegen.
The extra cast that was being inserted broke small->uint->floating conversions, for which uint->floating is now handled directly by AVX-512 instructions.
Diffs show a few hits where the uint->floating conversion instruction is restored, but all cases are on loads of unsigned small types where it wouldn't matter.
I've added a regression test for the Fuzzlyn example, which does fail without the fix.
There are a few improvements as well. I removed a restriction on containment of memory operands for ulong->floating casts when we can use the AVX-512 conversion instructions:
And we're now skipping the insertion of unnecessary int casts, which eliminates some movs: