Skip to content

AArch64: Use simpler sign expressions in Neon intrinsics code - #918

Merged
kirithika7 merged 2 commits into
Multicorewareinc:masterfrom
georges-arm:georges-arm/arm-sign-neon
Jul 21, 2026
Merged

AArch64: Use simpler sign expressions in Neon intrinsics code#918
kirithika7 merged 2 commits into
Multicorewareinc:masterfrom
georges-arm:georges-arm/arm-sign-neon

Conversation

@georges-arm

@georges-arm georges-arm commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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 the calSign/saoCuOrg* functions by 6-7%.

In signOf_neon this has no performance difference since LLVM 22 already performs the (-a) | b ==> a - b optimisation itself, so just update the intrinsics to reflect the simpler assembly sequence and to match the previous sign_diff_neon change.

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
georges-arm force-pushed the georges-arm/arm-sign-neon branch from c915fa2 to 48056e6 Compare July 17, 2026 15:58
@kirithika7
kirithika7 merged commit 47ffd3b into Multicorewareinc:master Jul 21, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants