AArch64: Use simpler sign expressions in Neon intrinsics code - #918
Merged
kirithika7 merged 2 commits intoJul 21, 2026
Merged
Conversation
Using an expression `(a < b) - (a > 0)` avoids the need for a widening subtraction and subsequent narrowing while producing an identical result. Benchmarking with LLVM 22 on a Neoverse V2 machine, this improves performance on the calSign/saoCuOrg* functions by 6-7%.
This has no performance difference since LLVM 22 already performs the `(-a) | b ==> a - b` optimisation itself, just update the intrinsics to reflect the simpler assembly sequence and to match the previous `sign_diff_neon` change. Change-Id: I5187bbb02f703ec57117a0534701ce5e1ef6ff99
georges-arm
force-pushed
the
georges-arm/arm-sign-neon
branch
from
July 17, 2026 15:58
c915fa2 to
48056e6
Compare
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.
In
sign_diff_neon, using the expression(a < b) - (a > 0)avoids the need for a widening subtraction and subsequent narrowing while producing an identical result. Benchmarking with LLVM 22 on a Neoverse V2 machine, this improves performance on thecalSign/saoCuOrg*functions by 6-7%.In
signOf_neonthis has no performance difference since LLVM 22 already performs the(-a) | b ==> a - boptimisation itself, so just update the intrinsics to reflect the simpler assembly sequence and to match the previoussign_diff_neonchange.