Add SHA3 and SVE SHA3 APIs#126941
Open
a74nh wants to merge 18 commits into
Open
Conversation
Fixes dotnet#98692 Fixes dotnet#94425
Contributor
Author
|
@dhartglassMSFT @dotnet/arm64-contrib |
Contributor
Author
|
This is erroring with: |
This was referenced May 11, 2026
Open
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds new ARM64 hardware intrinsics for Sha3 and SveSha3 (including JIT recognition/codegen paths) and wires up corresponding generated JIT tests.
Changes:
- Introduces
System.Runtime.Intrinsics.Arm.Sha3andSystem.Runtime.Intrinsics.Arm.SveSha3APIs (ref + implementation + linker substitutions). - Extends CoreCLR JIT intrinsic tables and codegen to support Sha3/SveSha3 instructions (including immediates and containment).
- Adds generated test groups/projects and helper methods for validating Sha3/SveSha3 behaviors.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/JIT/HardwareIntrinsics/Arm/SveSha3/SveSha3_ro.csproj | Adds optimized test project for SveSha3 ISA coverage. |
| src/tests/JIT/HardwareIntrinsics/Arm/SveSha3/SveSha3_r.csproj | Adds non-optimized test project for SveSha3 ISA coverage. |
| src/tests/JIT/HardwareIntrinsics/Arm/SveSha3/Program.SveSha3.cs | Adds test entrypoint scaffold for SveSha3 tests. |
| src/tests/JIT/HardwareIntrinsics/Arm/Shared/Program.cs | Logs new Sha3/SveSha3 ISA support flags. |
| src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs | Adds helper ops used by Sha3/SveSha3 test validation. |
| src/tests/JIT/HardwareIntrinsics/Arm/Sha3/Sha3_ro.csproj | Adds optimized test project for Sha3 ISA coverage. |
| src/tests/JIT/HardwareIntrinsics/Arm/Sha3/Sha3_r.csproj | Adds non-optimized test project for Sha3 ISA coverage. |
| src/tests/JIT/HardwareIntrinsics/Arm/Sha3/Program.Sha3.cs | Adds test entrypoint scaffold for Sha3 tests. |
| src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs | Hooks new Sha3/SveSha3 test groups into generator flow. |
| src/tests/Common/GenerateHWIntrinsicTests/Arm/SveTests.cs | Adds SveSha3Inputs test group definitions. |
| src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs | Adds Sha3Inputs test group definitions. |
| src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs | Adds public surface area definitions for Sha3/SveSha3. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/SveSha3.cs | Adds CoreLib implementation stub for SveSha3 intrinsics. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/SveSha3.PlatformNotSupported.cs | Adds non-supported fallback stubs for SveSha3 APIs. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha3.cs | Adds CoreLib implementation stub for Sha3 intrinsics. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha3.PlatformNotSupported.cs | Adds non-supported fallback stubs for Sha3 APIs. |
| src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems | Includes new Sha3/SveSha3 files in CoreLib build. |
| src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.NoArmIntrinsics.xml | Stubs IsSupported for new ISAs when Arm intrinsics are disabled. |
| src/coreclr/jit/lsraarm64.cpp | Updates LSRA immediate handling for new/adjusted intrinsics. |
| src/coreclr/jit/lowerarmarch.cpp | Adds containment handling for Sha3 immediate operand. |
| src/coreclr/jit/hwintrinsiclistarm64sve.h | Defines SveSha3 intrinsic list entry for RAX1. |
| src/coreclr/jit/hwintrinsiclistarm64.h | Defines Sha3 intrinsic list entries (BCAX/EOR3/RAX1/XAR). |
| src/coreclr/jit/hwintrinsiccodegenarm64.cpp | Extends codegen to support 3-arg immediates and Sha3 opt selection. |
| src/coreclr/jit/hwintrinsicarm64.cpp | Adds immediate bounds for Sha3 XAR. |
| src/coreclr/jit/hwintrinsic.cpp | Enables ISA ranges for Sha3 and SveSha3. |
Comments suppressed due to low confidence (4)
src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1
- The generated validation expression uses
&~inside a C# source string (e.g.secondOp[i] &~ thirdOp[i]), which is not valid C# syntax and will cause generated tests to fail compilation. Update theseValidateIterResultstrings to use& ~thirdOp[i](with a space) and keep the intended parentheses.
src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1 - The
*_longSha3 test cases generateInt16inputs (GetInt16()), but the operands/base type areInt64. This will significantly reduce coverage and can hide sign/bit-pattern issues. UseTestLibrary.Generator.GetInt64()forNextValueOp1/2/3in the*_longcases.
src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1 - The
*_longSha3 test cases generateInt16inputs (GetInt16()), but the operands/base type areInt64. This will significantly reduce coverage and can hide sign/bit-pattern issues. UseTestLibrary.Generator.GetInt64()forNextValueOp1/2/3in the*_longcases.
src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1 Templates.VecBinOpTestis a binary-op template but this entry suppliesNextValueOp3. If the template doesn't expect anOp3key, this can cause confusion or template failures; if it ignores extra keys, it still makes this test definition misleading. RemoveNextValueOp3from this dictionary (or switch to a ternary-op template if three inputs are actually needed).
3 tasks
This reverts commit 92e3c1f.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #98692
Fixes #94425