Function safe_arch::sub_horizontal_saturating_i16_m256i
source ยท pub fn sub_horizontal_saturating_i16_m256i(a: m256i, b: m256i) -> m256i
Available with target feature
avx2
only.Expand description
Horizontal saturating a - b
with lanes as i16
.
- The results are interleaved 128-bits at a time: a.low, b.low, a.high, b.high
let a = m256i::from([i16::MAX; 16]);
let b = m256i::from([i16::MIN; 16]);
let c: [i16; 16] = add_horizontal_saturating_i16_m256i(a, b).into();
assert_eq!(
c,
[
i16::MAX, i16::MAX, i16::MAX, i16::MAX,
i16::MIN, i16::MIN, i16::MIN, i16::MIN,
i16::MAX, i16::MAX, i16::MAX, i16::MAX,
i16::MIN, i16::MIN, i16::MIN, i16::MIN,
]
);
- Intrinsic:
_mm256_hsubs_epi16
- Assembly:
vphsubsw ymm, ymm, ymm