File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,22 @@ pub unsafe fn _m_empty() {
456
456
emms ( )
457
457
}
458
458
459
+ /// Copy 32-bit integer `a` to the lower elements of the return value, and zero
460
+ /// the upper element of the return value.
461
+ #[ inline]
462
+ #[ target_feature( enable = "mmx" ) ]
463
+ pub unsafe fn _mm_cvtsi32_si64 ( a : i32 ) -> __m64 {
464
+ mem:: transmute ( i32x2:: new ( a, 0 ) )
465
+ }
466
+
467
+ /// Return the lower 32-bit integer in `a`.
468
+ #[ inline]
469
+ #[ target_feature( enable = "mmx" ) ]
470
+ pub unsafe fn _mm_cvtsi64_si32 ( a : __m64 ) -> i32 {
471
+ let r: i32x2 = mem:: transmute ( a) ;
472
+ r. 0
473
+ }
474
+
459
475
#[ allow( improper_ctypes) ]
460
476
extern "C" {
461
477
#[ link_name = "llvm.x86.mmx.padd.b" ]
@@ -761,4 +777,18 @@ mod tests {
761
777
unsafe fn test_m_empty ( ) {
762
778
_m_empty ( ) ;
763
779
}
780
+
781
+ #[ simd_test( enable = "mmx" ) ]
782
+ unsafe fn test_mm_cvtsi32_si64 ( ) {
783
+ let a = _mm_cvtsi32_si64 ( 42 ) ;
784
+ let b = _mm_setr_pi32 ( 42 , 0 ) ;
785
+ assert_eq_m64 ( a, b) ;
786
+ }
787
+
788
+ #[ simd_test( enable = "mmx" ) ]
789
+ unsafe fn test_mm_cvtsi64_si32 ( ) {
790
+ let a = _mm_setr_pi32 ( 42 , 666 ) ;
791
+ let b = _mm_cvtsi64_si32 ( a) ;
792
+ assert_eq ! ( b, 42 ) ;
793
+ }
764
794
}
You can’t perform that action at this time.
0 commit comments