Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Conversation

SparrowLii
Copy link
Member

Fixed-point and Floating-point negate instructions

@rust-highfive
Copy link

r? @Amanieu

(rust-highfive has picked a reviewer for you, use r? to override)

@SparrowLii SparrowLii changed the title add vneg instructions add vneg neon instructions Mar 16, 2021
Comment on lines +1609 to +1610
let b: i64x1 = i64x1::new(0);
simd_sub(transmute(b), a)
Copy link
Contributor

@CryZe CryZe Mar 16, 2021

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.

Copy link
Member Author

@SparrowLii SparrowLii Mar 16, 2021

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. :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

@SparrowLii SparrowLii Mar 17, 2021

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.

@SparrowLii
Copy link
Member Author

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.

@Amanieu
Copy link
Member

Amanieu commented Mar 17, 2021

I'll close the PR for now.

simd_neg should be fairly simple to implement in the compiler, so I don't think a tracking issue is necessary.

@SparrowLii
Copy link
Member Author

SparrowLii commented Mar 19, 2021

@Amanieu I submitted the PR #rust-lang/rust/83271 for adding simd_neg to the compiler. Could I ask for your reviewing?

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 20, 2021
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)
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.

5 participants