Function safe_arch::mul_i16_scale_round_m256i
source ยท pub fn mul_i16_scale_round_m256i(a: m256i, b: m256i) -> m256i
Available with target feature
avx2
only.Expand description
Multiply i16
lanes into i32
intermediates, keep the high 18 bits, round
by adding 1, right shift by 1.
let a = m256i::from([
0_i16, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500,
]);
let b = m256i::from([
800_i16, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200,
2300,
]);
let c: [i16; 16] = mul_i16_scale_round_m256i(a, b).into();
assert_eq!(c, [0_i16, 3, 6, 10, 15, 20, 26, 32, 39, 47, 55, 64, 73, 83, 94, 105]);
- Intrinsic:
_mm256_mulhrs_epi16
- Assembly:
vpmulhrsw ymm, ymm, ymm