Function add_horizontal_saturating_i16_m256i
pub fn add_horizontal_saturating_i16_m256i(a: m256i, b: m256i) -> m256i
Available on crate feature
dep_safe_arch
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_hadds_epi16
- Assembly:
vphaddsw ymm, ymm, ymm