From 402d81b9a39aa78142d9e4c36c42f72b0863f5e2 Mon Sep 17 00:00:00 2001 From: jethrogb Date: Sat, 30 Jan 2021 21:06:21 +0100 Subject: [PATCH] Clarify _mm256_shuffle_epi8 documentation (#990) The old documentation seemed to suggest that the low 4 bits of bytes in `b` would index into the 32-element array `a`. That's not quite right and you'd need 5 bits to index 32 elements. --- library/stdarch/crates/core_arch/src/x86/avx2.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/x86/avx2.rs b/library/stdarch/crates/core_arch/src/x86/avx2.rs index 5fe898922f9c..358ce15081b6 100644 --- a/library/stdarch/crates/core_arch/src/x86/avx2.rs +++ b/library/stdarch/crates/core_arch/src/x86/avx2.rs @@ -2587,14 +2587,13 @@ pub unsafe fn _mm256_sad_epu8(a: __m256i, b: __m256i) -> __m256i { /// Shuffles bytes from `a` according to the content of `b`. /// -/// The last 4 bits of each byte of `b` are used as addresses into the 32 bytes -/// of `a`. +/// For each of the 128-bit low and high halves of the vectors, the last +/// 4 bits of each byte of `b` are used as addresses into the respective +/// low or high 16 bytes of `a`. That is, the halves are shuffled separately. /// /// In addition, if the highest significant bit of a byte of `b` is set, the /// respective destination byte is set to 0. /// -/// The low and high halves of the vectors are shuffled separately. -/// /// Picturing `a` and `b` as `[u8; 32]`, `_mm256_shuffle_epi8` is logically /// equivalent to: ///