Skip to content
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

Do not emit undefined lshr/ashr for Neon shifts #1238

Merged
merged 1 commit into from
Oct 22, 2021

Conversation

JamieCunliffe
Copy link
Contributor

In LLVM the lshr and ashr instruction is undefined when the amount is
equal to the element size, but Neon shifts support such shifts.

With signed values, when shifting by the element size is requested
subtract one as right shifting a signed value by its size is
equivalent to a shift of size - 1.

When shifting an unsigned value by the element size, return a vector
of all 0's as that's what the shift would result in.

@rust-highfive
Copy link

r? @Amanieu

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

In LLVM the lshr and ashr instruction is undefined when the amount is
equal to the element size, but Neon shifts support such shifts.

With signed values, when shifting by the element size is requested
subtract one as right shifting a signed value by its size is
equivalent to a shift of size - 1.

When shifting an unsigned value by the element size, return a vector
of all 0's as that's what the shift would result in.
@Amanieu
Copy link
Member

Amanieu commented Oct 22, 2021

Should the constraint on the immediate be changed to exclude 64? Is 64 a valid argument for these immediates?

@JamieCunliffe
Copy link
Contributor Author

@Amanieu Amanieu merged commit 299b5e2 into rust-lang:master Oct 22, 2021
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.

3 participants