Function core::arch::x86_64::_mm256_unpackhi_epi8

1.27.0 · source ·
pub unsafe fn _mm256_unpackhi_epi8(a: __m256i, b: __m256i) -> __m256i
Available on (x86 or x86-64) and target feature avx2 and x86-64 only.
Expand description

从每个高位的一半拆包并交织 8 位整数 ab 中的 128 位 lane。

#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;

let a = _mm256_setr_epi8(
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
    20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
);
let b = _mm256_setr_epi8(
    0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15,
    -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
    -30, -31,
);

let c = _mm256_unpackhi_epi8(a, b);

let expected = _mm256_setr_epi8(
    8, -8, 9, -9, 10, -10, 11, -11, 12, -12, 13, -13, 14, -14, 15, -15,
    24, -24, 25, -25, 26, -26, 27, -27, 28, -28, 29, -29, 30, -30, 31,
    -31,
);
assert_eq!(_mm256_movemask_epi8(_mm256_cmpeq_epi8(c, expected)), !0);
Run

Intel’s documentation