Skip to content

Convert _mm_alignr_epi8 to const generics #1061

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 1 commit into from
Mar 7, 2021
Merged

Convert _mm_alignr_epi8 to const generics #1061

merged 1 commit into from
Mar 7, 2021

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Mar 7, 2021

No description provided.

@rust-highfive
Copy link

r? @Amanieu

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

pub unsafe fn _mm_alignr_epi8(a: __m128i, b: __m128i, n: i32) -> __m128i {
let n = n as u32;
pub unsafe fn _mm_alignr_epi8<const IMM8: i32>(a: __m128i, b: __m128i) -> __m128i {
static_assert_imm8!(IMM8);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently with 8-bit immediate, instead 5-bit as specified, so it can be used by _mm_maskz_alignr_epi8 & _mm_mask_alignr_epi8, both of which are specified to accept 8-bit immediate.

Copy link
Member

Choose a reason for hiding this comment

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

_mm_maskz_alignr_epi8 and _mm_mask_alignr_epi8 should be changed to accept a 5-bit immediate instead.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, actually _mm_alignr_epi8 does have a well-defined behavior if the immediate is greater than 32, which is to return 0. So on second thought setting the constraint to 8-bit is fine.

@Amanieu Amanieu merged commit 55e6ca1 into rust-lang:master Mar 7, 2021
@tmiasko tmiasko deleted the _mm_alignr_epi8 branch March 7, 2021 23:38
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