Skip to content

JIT: Fix disasm of reg to reg SIMD narrowing/widening instructions#126371

Merged
JulieLeeMSFT merged 4 commits intodotnet:mainfrom
saucecontrol:movzxbw-disasm
Apr 17, 2026
Merged

JIT: Fix disasm of reg to reg SIMD narrowing/widening instructions#126371
JulieLeeMSFT merged 4 commits intodotnet:mainfrom
saucecontrol:movzxbw-disasm

Conversation

@saucecontrol
Copy link
Copy Markdown
Member

@saucecontrol saucecontrol commented Mar 31, 2026

Fixes #126363

This re-works the disasm for reg to reg instructions to cover some additional cases and make it a bit more consistent.

Many of the widening and narrowing instructions were showing the same size for source and target register.

Diff for the current vector byte multiply implementation:

        62F17C481002         vmovups  zmm0, zmmword ptr [rdx]
        62F17C4828C8         vmovaps  zmm1, zmm0
-       62F27D4820C9         vpmovsxbw zmm1, zmm1
+       62F27D4820C9         vpmovsxbw zmm1, ymm1
        62D17C481010         vmovups  zmm2, zmmword ptr [r8]
        62F17C4828DA         vmovaps  zmm3, zmm2
-       62F27D4820DB         vpmovsxbw zmm3, zmm3
+       62F27D4820DB         vpmovsxbw zmm3, ymm3
        62F16548D5C9         vpmullw  zmm1, zmm3, zmm1
-       62F27E4830C9         vpmovwb  zmm1, zmm1
+       62F27E4830C9         vpmovwb  ymm1, zmm1
        62F37D483BC001       vextracti32x8 ymm0, zmm0, 1
-       62F27D4820C0         vpmovsxbw zmm0, zmm0
+       62F27D4820C0         vpmovsxbw zmm0, ymm0
        62F37D483BD201       vextracti32x8 ymm2, zmm2, 1
-       62F27D4820D2         vpmovsxbw zmm2, zmm2
+       62F27D4820D2         vpmovsxbw zmm2, ymm2
        62F16D48D5C0         vpmullw  zmm0, zmm2, zmm0
-       62F27E4830C0         vpmovwb  zmm0, zmm0
+       62F27E4830C0         vpmovwb  ymm0, zmm0
        62F375483AC001       vinserti32x8 zmm0, zmm1, ymm0, 1
        62F17C481101         vmovups  zmmword ptr [rcx], zmm0
        488BC1               mov      rax, rcx
        C5F877               vzeroupper 
        C3                   ret      

This also catches a few cases where embedded rounding was not included in the disasm. ex:

-    vcvtss2si eax, xmm0
+    vcvtss2si eax, xmm0 {rd-sae}

Confirmed with local jit-diff that there are no text changes aside from the above intended ones.

Copilot AI review requested due to automatic review settings March 31, 2026 19:21
@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 Mar 31, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Mar 31, 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

This PR updates the xarch JIT instruction disassembly formatting to correctly display operand register widths for SIMD widening/narrowing instructions (e.g., showing ymm sources for zmm widening, and ymm targets for zmm narrowing), addressing incorrect/invalid-looking disasm output reported in #126363.

Changes:

  • Adjust disasm operand-size selection for reg-to-reg SIMD widening and narrowing/conversion instructions by deriving source/target emitAttr from the instruction size.
  • Refactor IF_RRW_* reg/reg display logic to compute tgtAttr/srcAttr and print via a single shared path (preserving special-case handling for bt and APX NDD shift forms).
  • Add vcvtps2ph handling in the reg/reg/imm display path to account for differing source/target widths.

Comment thread src/coreclr/jit/emitxarch.cpp Outdated
Comment thread src/coreclr/jit/emitxarch.cpp Outdated
@saucecontrol
Copy link
Copy Markdown
Member Author

cc @dotnet/jit-contrib

No code diffs, just disasm text fixes.

Comment thread src/coreclr/jit/emitxarch.cpp Outdated
Copilot AI review requested due to automatic review settings April 4, 2026 22:17
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

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

@JulieLeeMSFT
Copy link
Copy Markdown
Member

/ba-g all known issues.

@JulieLeeMSFT JulieLeeMSFT merged commit 12a8c25 into dotnet:main Apr 17, 2026
134 of 138 checks passed
@saucecontrol saucecontrol deleted the movzxbw-disasm branch April 17, 2026 17:03
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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect JIT disasm for ConvertToVector512*

4 participants