-
Notifications
You must be signed in to change notification settings - Fork 296
aarch64
: use intrinsics::simd
for horizontal add and abs
#1872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
aarch64
: use intrinsics::simd
for horizontal add and abs
unsafe extern "unadjusted" { | ||
#[cfg_attr( | ||
any(target_arch = "aarch64", target_arch = "arm64ec"), | ||
link_name = "llvm.aarch64.neon.abs.v1i64" | ||
)] | ||
fn _vabs_s64(a: int64x1_t) -> int64x1_t; | ||
unsafe { | ||
let neg: int64x1_t = simd_neg(a); | ||
let mask: int64x1_t = simd_ge(a, neg); | ||
simd_select(mask, a, neg) | ||
} | ||
unsafe { _vabs_s64(a) } | ||
} | ||
#[doc = "Absolute Value (wrapping)."] | ||
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsd_s64)"] | ||
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s64)"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the diff here is wonky because the order of the definitions changed.
# FIXME(llvm): this should be `i64::wrapping_abs` but it optimizes differently. | ||
# See https://github.com/llvm/llvm-project/issues/148388. | ||
- LLVMLink: | ||
name: "vabsd_s64" | ||
links: | ||
- link: "llvm.aarch64.neon.abs.i64" | ||
arch: aarch64,arm64ec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just kept this as-is for now, but from what I can tell i64::wrapping_abs
would be equivalent.
No description provided.