Skip to content

Add SHA3 and SVE SHA3 APIs#126941

Open
a74nh wants to merge 18 commits into
dotnet:mainfrom
a74nh:sha3_github
Open

Add SHA3 and SVE SHA3 APIs#126941
a74nh wants to merge 18 commits into
dotnet:mainfrom
a74nh:sha3_github

Conversation

@a74nh

@a74nh a74nh commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #98692
Fixes #94425

Copilot AI review requested due to automatic review settings April 15, 2026 09:09
@dotnet-policy-service dotnet-policy-service Bot added linkable-framework Issues associated with delivering a linker friendly framework community-contribution Indicates that the PR has been added by a community member labels Apr 15, 2026
@a74nh

a74nh commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

@dhartglassMSFT @dotnet/arm64-contrib

Comment thread src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha3.cs Outdated
@a74nh

a74nh commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

hardware-intrinsics-arm64

This is erroring with:

##[error]Pipeline does not have permissions to use the referenced pool(s) NetCore-Public. For authorization details, refer to https://aka.ms/yamlauthz.

Comment thread src/coreclr/jit/hwintrinsiclistarm64.h Outdated
Comment thread src/coreclr/jit/hwintrinsiclistarm64sve.h
@a74nh a74nh requested review from Copilot and removed request for Copilot June 17, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Sha3 and System.Runtime.Intrinsics.Arm.SveSha3 APIs (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 these ValidateIterResult strings to use & ~thirdOp[i] (with a space) and keep the intended parentheses.
    src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1
  • The *_long Sha3 test cases generate Int16 inputs (GetInt16()), but the operands/base type are Int64. This will significantly reduce coverage and can hide sign/bit-pattern issues. Use TestLibrary.Generator.GetInt64() for NextValueOp1/2/3 in the *_long cases.
    src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1
  • The *_long Sha3 test cases generate Int16 inputs (GetInt16()), but the operands/base type are Int64. This will significantly reduce coverage and can hide sign/bit-pattern issues. Use TestLibrary.Generator.GetInt64() for NextValueOp1/2/3 in the *_long cases.
    src/tests/Common/GenerateHWIntrinsicTests/Arm/AdvSimdTests.cs:1
  • Templates.VecBinOpTest is a binary-op template but this entry supplies NextValueOp3. If the template doesn't expect an Op3 key, this can cause confusion or template failures; if it ignores extra keys, it still makes this test definition misleading. Remove NextValueOp3 from this dictionary (or switch to a ternary-op template if three inputs are actually needed).

Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Sha3/Program.Sha3.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/SveSha3/Program.SveSha3.cs Outdated
Copilot AI review requested due to automatic review settings June 17, 2026 13:49
@a74nh a74nh requested a review from MichalStrehovsky as a code owner June 18, 2026 07:28
@a74nh a74nh removed the request for review from MichalStrehovsky June 18, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Runtime.Intrinsics community-contribution Indicates that the PR has been added by a community member linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Arm64: FEAT_SHA3 [API Proposal]: Arm64: FEAT_SVE_SHA3

3 participants