-
Notifications
You must be signed in to change notification settings - Fork 289
add vneg neon instructions #1087
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
Conversation
r? @Amanieu (rust-highfive has picked a reviewer for you, use r? to override) |
let b: i64x1 = i64x1::new(0); | ||
simd_sub(transmute(b), a) |
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.
Nice, I was actually looking into this one as well earlier and "gave up on it", because there didn't seem to be a way other than 0 - the_vec. Good to see I didn't miss anything xD
Though that still begs the question if there should just be a simd_neg instead, cause that's how you are supposed to get to this instruction via LLVM.
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.
It seems that core_arch does not have an instruction such as simd_neg, I don’t know how to add it, since I don’t know the compiler very well. :(
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.
You will need to add to the function at https://github.com/rust-lang/rust/blob/f24ce9b0140d9be5a336954e878d0c1522966bb8/compiler/rustc_codegen_llvm/src/intrinsic.rs#L730 It is probably similar to https://github.com/rust-lang/rust/blob/f24ce9b0140d9be5a336954e878d0c1522966bb8/compiler/rustc_codegen_llvm/src/intrinsic.rs#L1631-L1661 except a single argument instead of two arguments.
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.
Thanks for guiding. I will try later. I think the implementation of sub(0, a) is sufficient for now. Since the implementation in Clang is the same
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.
They are different if you look at the code for floating-point numbers. 0.0 - x
and -x
have different behavior for floats with regards to negative zeros, NaNs, etc.
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.
Thanks for pointing. It looks like we do need to add simd_neg.
It looks like we do need to add simd_neg. I suggest to close this PR, and then raise an issue to track its implementation. |
I'll close the PR for now.
|
@Amanieu I submitted the PR #rust-lang/rust/83271 for adding simd_neg to the compiler. Could I ask for your reviewing? |
Add simd_neg platform intrinsic Stdarch needs to add simd_neg to support the implementation of vneg neon instructions. Look [here](rust-lang/stdarch#1087)
Fixed-point and Floating-point negate instructions