diff --git a/coresimd/x86/sse.rs b/coresimd/x86/sse.rs index a51f3f1423..5fa3ed0c57 100644 --- a/coresimd/x86/sse.rs +++ b/coresimd/x86/sse.rs @@ -2040,6 +2040,8 @@ extern "C" { fn pminub(a: __m64, b: __m64) -> __m64; #[link_name = "llvm.x86.mmx.pmulhu.w"] fn pmulhuw(a: __m64, b: __m64) -> __m64; + #[link_name = "llvm.x86.mmx.pmull.w"] + fn pmullw(a: __m64, b: __m64) -> __m64; #[link_name = "llvm.x86.mmx.pavg.b"] fn pavgb(a: __m64, b: __m64) -> __m64; #[link_name = "llvm.x86.mmx.pavg.w"] @@ -2157,6 +2159,16 @@ pub unsafe fn _mm_mulhi_pu16(a: __m64, b: __m64) -> __m64 { pmulhuw(a, b) } +/// Multiplies packed 16-bit integer values and writes the +/// low-order 16 bits of each 32-bit product to the corresponding bits in +/// the destination. +#[inline] +#[target_feature(enable = "sse,mmx")] +#[cfg_attr(test, assert_instr(pmullw))] +pub unsafe fn _mm_mullo_pi16(a: __m64, b: __m64) -> __m64 { + pmullw(a, b) +} + /// Multiplies packed 16-bit unsigned integer values and writes the /// high-order 16 bits of each 32-bit product to the corresponding bits in /// the destination. @@ -4001,6 +4013,13 @@ mod tests { assert_eq_m64(r, _mm_set1_pi16(15)); } + #[simd_test(enable = "sse,mmx")] + unsafe fn test_mm_mullo_pi16() { + let (a, b) = (_mm_set1_pi16(1000), _mm_set1_pi16(1001)); + let r = _mm_mullo_pi16(a, b); + assert_eq_m64(r, _mm_set1_pi16(17960)); + } + #[simd_test(enable = "sse,mmx")] unsafe fn test_m_pmulhuw() { let (a, b) = (_mm_set1_pi16(1000), _mm_set1_pi16(1001));