Skip to content

Arm64: Add SM4 and SHA3 instructions#124504

Open
a74nh wants to merge 10 commits intodotnet:mainfrom
a74nh:neonext_github
Open

Arm64: Add SM4 and SHA3 instructions#124504
a74nh wants to merge 10 commits intodotnet:mainfrom
a74nh:neonext_github

Conversation

@a74nh
Copy link
Contributor

@a74nh a74nh commented Feb 17, 2026

First part of #94425 and #94426

When adding a new group, I've added the entire group for completeness.

Plus fix up existing code:

  • umull/smull etc does not have a 32bit version
  • stlurb etc uses scalar registers, not vector registers
  • Fix the missing bit for simd ldapur
  • smaddl etc does not have a 32bit version
  • sha1su1/sha256su0 were in the wrong groups, and had no tests
  • cdot test immediate values were wrong
  • fix some register display issues

First part of dotnet#94425 and dotnet#94426

When adding a new group, I've added the entire group
for completeness.

Plus fix up existing code:
* umull/smull etc does not have a 32bit version
* stlurb etc uses scalar registers, not vector registers
* Fix the missing bit for simd ldapur
* smaddl etc does not have a 32bit version
* sha1su1/sha256su0 were in the wrong groups, and had no tests
* cdot test immediate values were wrong
* fix some register display issues
Copilot AI review requested due to automatic review settings February 17, 2026 10:08
@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 Feb 17, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 17, 2026
@dotnet-policy-service
Copy link
Contributor

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

Copy link
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

Adds support in the CoreCLR ARM64 JIT emitter for additional crypto instructions (SM4 and SHA3/SHA512/SM3-related), along with several correctness fixes in existing instruction metadata/encoding and expanded emitter unit tests to validate the new/adjusted encodings.

Changes:

  • Add new ARM64 instruction definitions and emitter formats for SHA3/SHA512/SM3/SM4-related instructions.
  • Fix several existing instruction/emitter issues (e.g., incorrect operand sizing for *mull/*maddl families, scalar vs vector register usage for some loads/stores, and a missing vector LDAPUR encoding bit).
  • Extend ARM64 emitter unit tests (including corrections to SVE cdot immediate values) to cover newly added/relocated instruction handling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/coreclr/jit/instrsarm64.h Adds instruction table entries for new crypto ops; adjusts SHA instruction grouping/format usage.
src/coreclr/jit/emitfmtsarm64.h Introduces new emitter formats (DV_2V, DV_3H, DV_3I, DV_4B) to support new instruction encodings.
src/coreclr/jit/emitarm64.cpp Wires new formats into sanity checks, encoding output, disassembly display, and perf characteristics; fixes various existing emitter behaviors.
src/coreclr/jit/codegenarmarch.cpp Fixes ARM64 GT_MUL_LONG emission to use correct 64-bit result size for long-mul instructions.
src/coreclr/jit/codegenarm64.cpp Fixes ARM64 MulHi codegen to use correct operand/result sizing for smull/umull.
src/coreclr/jit/codegenarm64test.cpp Updates/extends emitter unit tests for corrected encodings and newly added instructions; fixes SVE cdot immediates.

@a74nh
Copy link
Contributor Author

a74nh commented Feb 17, 2026

@dotnet/arm64-contrib

@a74nh
Copy link
Contributor Author

a74nh commented Feb 18, 2026

There are some disasm test failures - I suspect it's just differences in the way the assembly is printed. I'll take a look.

Copilot AI review requested due to automatic review settings February 19, 2026 16:16
Copy link
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 6 out of 6 changed files in this pull request and generated 5 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 19, 2026 16:42
a74nh and others added 2 commits February 19, 2026 16:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
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 6 out of 6 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings February 19, 2026 16:53
Copy link
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 6 out of 6 changed files in this pull request and generated 2 comments.

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.

1 participant

Comments