Skip to content

Commit

Permalink
add _mm_mullo_pi16 intrinsic
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIronBorn authored and gnzlbg committed Jun 14, 2018
1 parent dda4072 commit 2777950
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions coresimd/x86/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 2777950

Please sign in to comment.