Function safe_arch::mul_32_m128i

source ·
pub fn mul_32_m128i(a: m128i, b: m128i) -> m128i
Available with target feature sse4.1 only.
Expand description

Lanewise a * b with 32-bit lanes.

This keeps the low 32-bits from each 64-bit output, so it actually works for both i32 and u32.

let ai = m128i::from([1, 2000000, -300, 45689]);
let bi = m128i::from([5, 6000000, 700, -89109]);
let ci: [i32; 4] = mul_32_m128i(ai, bi).into();
assert_eq!(ci, [5, -138625024, -210000, 223666195]);

let au = m128i::from([u32::MAX, 26, 5678, 1234567890]);
let bu = m128i::from([u32::MAX, 74, 9101112, 765]);
let cu: [u32; 4] = mul_32_m128i(au, bu).into();
assert_eq!(cu, [1, 1924, 136506384, 3846598026]);