Skip to content

Commit b38f30c

Browse files
committed
Add MMX _mm_empty and _m_empty intrinsics
1 parent edc60dc commit b38f30c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

coresimd/x86/mmx.rs

+32
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,26 @@ pub unsafe fn _mm_setr_pi8(
436436
mem::transmute(i8x8::new(e0, e1, e2, e3, e4, e5, e6, e7))
437437
}
438438

439+
/// Empty the MMX state, which marks the x87 FPU registers as available for use
440+
/// by x87 instructions. This instruction must be used at the end of all MMX
441+
/// technology procedures.
442+
#[inline]
443+
#[target_feature(enable = "mmx")]
444+
#[cfg_attr(test, assert_instr(emms))]
445+
pub unsafe fn _mm_empty() {
446+
emms()
447+
}
448+
449+
/// Empty the MMX state, which marks the x87 FPU registers as available for use
450+
/// by x87 instructions. This instruction must be used at the end of all MMX
451+
/// technology procedures.
452+
#[inline]
453+
#[target_feature(enable = "mmx")]
454+
#[cfg_attr(test, assert_instr(emms))]
455+
pub unsafe fn _m_empty() {
456+
emms()
457+
}
458+
439459
#[allow(improper_ctypes)]
440460
extern "C" {
441461
#[link_name = "llvm.x86.mmx.padd.b"]
@@ -488,6 +508,8 @@ extern "C" {
488508
fn punpckhdq(a: __m64, b: __m64) -> __m64;
489509
#[link_name = "llvm.x86.mmx.punpckldq"]
490510
fn punpckldq(a: __m64, b: __m64) -> __m64;
511+
#[link_name = "llvm.x86.mmx.emms"]
512+
fn emms();
491513
}
492514

493515
#[cfg(test)]
@@ -729,4 +751,14 @@ mod tests {
729751

730752
assert_eq_m64(r, _mm_unpacklo_pi32(a, b));
731753
}
754+
755+
#[simd_test(enable = "mmx")]
756+
unsafe fn test_mm_empty() {
757+
_mm_empty();
758+
}
759+
760+
#[simd_test(enable = "mmx")]
761+
unsafe fn test_m_empty() {
762+
_m_empty();
763+
}
732764
}

0 commit comments

Comments
 (0)