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

_mm256_alignr_epi8 is incorrect #328

Closed
Cocalus opened this issue Feb 25, 2018 · 2 comments
Closed

_mm256_alignr_epi8 is incorrect #328

Cocalus opened this issue Feb 25, 2018 · 2 comments

Comments

@Cocalus
Copy link

Cocalus commented Feb 25, 2018

The _mm256_alignr_epi8 implementation and test do not match the Intel specs. The instruction is annoyingly split into two separate 128 bit lanes. Or in other words the same as _mm_alignr_epi8 being applied independently to the upper and lower 128 bits lanes.

See
https://software.intel.com/en-us/blogs/2015/01/13/programming-using-avx2-permutations
For an explanation of how it's implemented and work arounds for the split lanes in some avx2 instructions. It's probably worth double checking the other instructions there.

To make it more confusing in AVX-512 The *_epi32 and *_epi64 variants of alignr do not split lanes, while the *_epi8 variants still do.

I maybe mistaken but I thought there were tests to make sure the correct instruction was generated, It seems unlikely to have accidentally of passed that test.

alexcrichton added a commit to alexcrichton/stdarch that referenced this issue Feb 25, 2018
This seems likely to have mostly just been a copy/paste error, so this
re-reviews the intrinsics and aligns it with the implementation in
clang.

Closes rust-lang#328
@alexcrichton
Copy link
Member

Thanks for the report and good catch! I think this should be fixed in #330

alexcrichton added a commit that referenced this issue Feb 25, 2018
This seems likely to have mostly just been a copy/paste error, so this
re-reviews the intrinsics and aligns it with the implementation in
clang.

Closes #328
@marxin
Copy link
Contributor

marxin commented Nov 18, 2024

Related issue: #1678.

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

No branches or pull requests

3 participants