Skip to content

Fix the encoding of vcvtps2ph#127111

Merged
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:half-simd
Apr 19, 2026
Merged

Fix the encoding of vcvtps2ph#127111
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:half-simd

Conversation

@tannergooding
Copy link
Copy Markdown
Member

Follow up to #127094

The instruction was added a while ago but only started being utilized in the above PR. However, the instruction needs to be MR rather than RM encoded or it can cause invalid results in some scenarios.

@tannergooding tannergooding requested review from EgorBo, Copilot and kg April 18, 2026 21:19
@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 Apr 18, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

Fixes the CoreCLR xarch JIT’s encoding metadata for vcvtps2ph so it uses the correct MR form (destination in ModRM r/m), preventing incorrect results when the instruction is exercised (notably after #127094 enabled new usage).

Changes:

  • Update vcvtps2ph instruction table entry to use the MR opcode slot instead of RM.
  • Extend the emitter’s MRD/RRD/imm8 handling to recognize INS_vcvtps2ph.
  • Ensure ConvertToVector{128,256}Half store paths are categorized with other ins reg/mem, xmm, imm8 intrinsics in store-indirect codegen.

Reviewed changes

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

File Description
src/coreclr/jit/instrsxarch.h Moves vcvtps2ph encoding from RM to MR in the instruction metadata table.
src/coreclr/jit/emitxarch.cpp Allows vcvtps2ph in the MRD/RRD/CNS emission path used for “dest r/m, src reg, imm8” forms.
src/coreclr/jit/codegenxarch.cpp Adds AVX2 half-conversion intrinsics to the store-indirect handling bucket that expects ins reg/mem, xmm, imm8.

@tannergooding tannergooding merged commit b6be786 into dotnet:main Apr 19, 2026
141 of 145 checks passed
@tannergooding tannergooding deleted the half-simd branch April 19, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

3 participants