Skip to content

Add vgetq_lane_s32 #903

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

Merged
merged 2 commits into from
Sep 10, 2020
Merged

Add vgetq_lane_s32 #903

merged 2 commits into from
Sep 10, 2020

Conversation

jrmuizel
Copy link
Contributor

The implementation basically matches the existing vgetq_lane_u32

@rust-highfive
Copy link

r? @Amanieu

(rust_highfive has picked a reviewer for you, use r? to override)

The implementation basically matches the existing vgetq_lane_u32
@jrmuizel jrmuizel marked this pull request as ready for review September 10, 2020 15:02
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mov, imm5 = 2))]
pub unsafe fn vgetq_lane_s32(v: int32x4_t, imm5: i32) -> i32 {
if (imm5) < 0 || (imm5) > 3 {
unreachable_unchecked()
Copy link
Member

Choose a reason for hiding this comment

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

Use a panic here instead. This will be optimized out since imm5 is required to be a constant.

if (imm5) < 0 || (imm5) > 3 {
unreachable_unchecked()
}
let imm5 = (imm5 & 0b11) as u32;
Copy link
Member

Choose a reason for hiding this comment

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

The masking isn't needed since you've already used a range check.

@Amanieu Amanieu merged commit 25faf42 into rust-lang:master Sep 10, 2020
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