Function safe_arch::sign_apply_i16_m256i
source ยท pub fn sign_apply_i16_m256i(a: m256i, b: m256i) -> m256i
Available with target feature
avx2
only.Expand description
Lanewise a * signum(b)
with lanes as i16
- If
b
is positive, the output isa
. - If
b
is zero, the output is 0. - If
b
is negative, the output is-a
.
let a = m256i::from([5_i16, 6, 2, 5, 4, 3, 1, 0, -12, 13, 56, 21, 8, 7, 6, 5]);
let b = m256i::from([12000_i16, 13000, -2, -8, 0, 1, 2, 3, -8, -7, 6, 5, 0, 0, 0, 978]);
let c: [i16; 16] = sign_apply_i16_m256i(a, b).into();
assert_eq!(c, [5, 6, -2, -5, 0, 3, 1, 0, 12, -13, 56, 21, 0, 0, 0, 5]);
- Intrinsic:
_mm256_sign_epi16
- Assembly:
vpsignw ymm, ymm, ymm