@@ -4736,6 +4736,22 @@ pub unsafe fn vec_cmpnrg<T: sealed::VectorCompareRange>(a: T, b: T, c: T) -> T::
47364736 a. vstrc :: < { FindImm :: Ne as u32 } > ( b, c)
47374737}
47384738
4739+ /// Vector Compare Ranges Index
4740+ #[ inline]
4741+ #[ target_feature( enable = "vector" ) ]
4742+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4743+ pub unsafe fn vec_cmprg_idx < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T ) -> T :: Result {
4744+ a. vstrc :: < { FindImm :: EqIdx as u32 } > ( b, c)
4745+ }
4746+
4747+ /// Vector Compare Not in Ranges Index
4748+ #[ inline]
4749+ #[ target_feature( enable = "vector" ) ]
4750+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4751+ pub unsafe fn vec_cmpnrg_idx < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T ) -> T :: Result {
4752+ a. vstrc :: < { FindImm :: NeIdx as u32 } > ( b, c)
4753+ }
4754+
47394755#[ cfg( test) ]
47404756mod tests {
47414757 use super :: * ;
@@ -6059,4 +6075,24 @@ mod tests {
60596075 let d = unsafe { vec_cmpnrg ( a, b, c) } ;
60606076 assert_eq ! ( d. as_array( ) , & [ 0 , !0 , !0 , 0 ] ) ;
60616077 }
6078+
6079+ #[ simd_test( enable = "vector" ) ]
6080+ fn test_vec_cmprg_idx ( ) {
6081+ let a = vector_unsigned_int ( [ 1 , 11 , 22 , 33 ] ) ;
6082+ let b = vector_unsigned_int ( [ 10 , 20 , 30 , 40 ] ) ;
6083+
6084+ let c = vector_unsigned_int ( [ GT , LT , GT , LT ] ) ;
6085+ let d = unsafe { vec_cmprg_idx ( a, b, c) } ;
6086+ assert_eq ! ( d. as_array( ) , & [ 0 , 4 , 0 , 0 ] ) ;
6087+ }
6088+
6089+ #[ simd_test( enable = "vector" ) ]
6090+ fn test_vec_cmpnrg_idx ( ) {
6091+ let a = vector_unsigned_int ( [ 1 , 11 , 22 , 33 ] ) ;
6092+ let b = vector_unsigned_int ( [ 10 , 20 , 30 , 40 ] ) ;
6093+
6094+ let c = vector_unsigned_int ( [ GT , LT , GT , LT ] ) ;
6095+ let d = unsafe { vec_cmpnrg_idx ( a, b, c) } ;
6096+ assert_eq ! ( d. as_array( ) , & [ 0 , 0 , 0 , 0 ] ) ;
6097+ }
60626098}
0 commit comments