Skip to content

Fix intrinsic testing add and subtract overflow helpers#122977

Merged
tannergooding merged 9 commits intodotnet:mainfrom
a74nh:saturate_github
Jan 14, 2026
Merged

Fix intrinsic testing add and subtract overflow helpers#122977
tannergooding merged 9 commits intodotnet:mainfrom
a74nh:saturate_github

Conversation

@a74nh
Copy link
Copy Markdown
Contributor

@a74nh a74nh commented Jan 7, 2026

Fixes #122728

Copilot AI review requested due to automatic review settings January 7, 2026 16:20
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jan 7, 2026
@a74nh
Copy link
Copy Markdown
Contributor Author

a74nh commented Jan 7, 2026

@dotnet/arm64-contrib

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
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 refactors overflow detection and saturating arithmetic helper methods in the ARM hardware intrinsics test helpers. It replaces multiple type-specific implementations with generic methods using IBinaryInteger<T> and BigInteger for accurate overflow detection.

Key changes:

  • Consolidates duplicate overflow detection logic into generic methods
  • Fixes overflow detection bugs by using BigInteger for precise range checking
  • Reduces code duplication across sbyte, short, int, and long types

Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
Comment thread src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs Outdated
@a74nh
Copy link
Copy Markdown
Contributor Author

a74nh commented Jan 13, 2026

Re-wrote the mixed signed unsigned helpers. Called down to the other helpers where we can to simplify logic. Had to use TUnsigned.AllBitsSet because checking against TSigned.MaxValue errors with static abstract interface members issues. Added asserts to check the types are the same size.

@a74nh
Copy link
Copy Markdown
Contributor Author

a74nh commented Jan 13, 2026

Got some failures to fix up....

@tannergooding tannergooding merged commit ee0778f into dotnet:main Jan 14, 2026
87 checks passed
@a74nh a74nh deleted the saturate_github branch January 14, 2026 17:18
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Runtime.Intrinsics 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.

Test failure: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_AddSaturate_short()

3 participants