@@ -768,10 +768,26 @@ pub unsafe fn _mm_round_ss(a: f32x4, b: f32x4, rounding: i32) -> f32x4 {
768
768
constify_imm4 ! ( rounding, call)
769
769
}
770
770
771
- /// Find minimal u16 element in vector.
772
- /// Place it in the first element of resulting vector and it's index
773
- /// in second element (formally bits [16..18] inclusive).
774
- /// All other elements are set to zero.
771
+ /// Finds the minimum u16 in the u16x8 vector, returning it in the first
772
+ /// position of the result vector along with its index in the second position;
773
+ /// all other elements are set to zero.
774
+ ///
775
+ /// \headerfile <x86intrin.h>
776
+ ///
777
+ /// This intrinsic corresponds to the <c> VPHMINPOSUW / PHMINPOSUW </c>
778
+ /// instruction.
779
+ ///
780
+ /// Arguments:
781
+ ///
782
+ /// * `a` - A 128-bit vector of type `u16x8`.
783
+ ///
784
+ /// Returns:
785
+ ///
786
+ /// A 128-bit value where:
787
+ ///
788
+ /// * bits `[15:0]` - contain the minimum value found in parameter `a`,
789
+ /// * bits `[18:16]` - contain the index of the minimum value
790
+ /// * remaining bits are set to `0`.
775
791
#[ inline( always) ]
776
792
#[ target_feature = "+sse4.1" ]
777
793
#[ cfg_attr( test, assert_instr( phminposuw) ) ]
@@ -801,7 +817,6 @@ pub unsafe fn _mm_mullo_epi32(a: i32x4, b: i32x4) -> i32x4 {
801
817
a * b
802
818
}
803
819
804
-
805
820
#[ allow( improper_ctypes) ]
806
821
extern "C" {
807
822
#[ link_name = "llvm.x86.sse41.pblendvb" ]
@@ -1216,7 +1231,7 @@ mod tests {
1216
1231
let e = i64x2:: splat ( -10 ) ;
1217
1232
assert_eq ! ( r, e) ;
1218
1233
}
1219
-
1234
+
1220
1235
#[ simd_test = "sse4.1" ]
1221
1236
unsafe fn _mm_cvtepi32_epi64 ( ) {
1222
1237
let a = i32x4:: splat ( 10 ) ;
@@ -1558,6 +1573,12 @@ mod tests {
1558
1573
// Attention, most significant bit in r[2] is treated as a sign bit!
1559
1574
// 1234567 * 666666 = -1589877210
1560
1575
let e = i32x4:: new ( -300 , 512 , -1589877210 , -1409865409 ) ;
1576
+
1577
+ #[ simd_test = "sse4.1" ]
1578
+ unsafe fn _mm_minpos_epu16 ( ) {
1579
+ let a = u16x8:: new ( 8 , 7 , 6 , 5 , 4 , 1 , 2 , 3 ) ;
1580
+ let r = sse41:: _mm_minpos_epu16 ( a) ;
1581
+ let e = u16x8:: splat ( 0 ) . replace ( 0 , 1 ) . replace ( 1 , 5 ) ;
1561
1582
assert_eq ! ( r, e) ;
1562
1583
}
1563
1584
}
0 commit comments