Repository navigation
JIT: preserve arm64 widening overloads through lowering - #137455
Conversation
Select L/W forms using the original operand element type, not the post-lowering SIMD size. Add regression coverage. Fixes dotnet#137322 Co-authored-by: Copilot <[email protected]> Copilot-Session: fb633bef-7293-40ce-a6b0-0c3c8193d6fa
|
Azure Pipelines: Successfully started running 6 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
@dhartglassMSFT ptal |
There was a problem hiding this comment.
🟡 Changes recommended
The uint/ulong and int/long test cases use a wide-lane value of 1000, allowing the incorrect L instruction to pass; nonzero upper 32 bits are needed to detect the original opcode-selection bug.
1 open issue
What changed in this PR
This PR fixes Arm64 widening add/subtract instruction selection by preserving the original operand element type through JIT lowering.
Changes:
- Record overload metadata during import and use it to select L/W instruction forms.
- Set matching metadata for the widening add generated by
ExtractMostSignificantBits. - Add regression tests for both operations across six element-type pairs.
| File | Description |
|---|---|
src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/Program.AdvSimd.cs |
Adds regression coverage for size-changing operand conversions. |
src/coreclr/jit/rationalize.cpp |
Annotates the internally generated widening add. |
src/coreclr/jit/hwintrinsiccodegenarm64.cpp |
Selects instructions using preserved element types. |
src/coreclr/jit/hwintrinsic.cpp |
Preserves first-operand type metadata for lower widening intrinsics. |
Review effort: Balanced
JulieLeeMSFT
left a comment
There was a problem hiding this comment.
LGTM. It preserves the original operand lane type to ensure correct Arm64 L/W opcode selection regardless of SIMD-size changes.
Updated test to exercise upper 32 bits in ulong/long cases. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
@JulieLeeMSFT tweaked the test case a bit, can you re-approve? |
|
/ba-g osx build host stopped responding mid build |

Preserve the first operand's original element type for Arm64 lower widening add/subtract intrinsics. Use it to select L/W forms instead of the post-lowering SIMD size, which can change when
GetLower()orToVector128Unsafe()is removed.Update the internally generated widening add used by
ExtractMostSignificantBitsand add regression coverage for both operations across all six element-type pairs.Validation
ExtractMostSignificantBitschecks pass. JIT formatting passes.Other platforms were not run.
Resolves #137322
Note
This PR description was generated with GitHub Copilot.