Function safe_arch::add_saturating_i16_m256i
source ยท pub fn add_saturating_i16_m256i(a: m256i, b: m256i) -> m256i
Available with target feature
avx2
only.Expand description
Lanewise saturating a + b
with lanes as i16
.
let a = m256i::from([32700_i16; 16]);
let b = m256i::from([32000_i16; 16]);
let c: [i16; 16] = add_saturating_i16_m256i(a, b).into();
assert_eq!(c, [32767_i16; 16]);
- Intrinsic:
_mm256_adds_epi16
- Assembly:
vpaddsw ymm, ymm, ymm