@@ -3333,6 +3333,62 @@ mod sealed {
33333333 vector_unsigned_short vstrch vstrchs vstrczh vstrczhs
33343334 vector_unsigned_int vstrcf vstrcfs vstrczf vstrczfs
33353335 }
3336+
3337+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3338+ pub trait VectorComparePredicate : Sized {
3339+ type Result ;
3340+
3341+ #[ inline]
3342+ #[ target_feature( enable = "vector" ) ]
3343+ unsafe fn vec_cmpgt ( self , other : Self ) -> Self :: Result {
3344+ simd_gt ( self , other)
3345+ }
3346+
3347+ #[ inline]
3348+ #[ target_feature( enable = "vector" ) ]
3349+ unsafe fn vec_cmpge ( self , other : Self ) -> Self :: Result {
3350+ simd_ge ( self , other)
3351+ }
3352+
3353+ #[ inline]
3354+ #[ target_feature( enable = "vector" ) ]
3355+ unsafe fn vec_cmplt ( self , other : Self ) -> Self :: Result {
3356+ simd_lt ( self , other)
3357+ }
3358+
3359+ #[ inline]
3360+ #[ target_feature( enable = "vector" ) ]
3361+ unsafe fn vec_cmple ( self , other : Self ) -> Self :: Result {
3362+ simd_le ( self , other)
3363+ }
3364+ }
3365+
3366+ macro_rules! impl_compare_predicate {
3367+ ( $( $ty: ident) * ) => {
3368+ $(
3369+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3370+ impl VectorComparePredicate for $ty {
3371+ type Result = t_b!( $ty) ;
3372+ }
3373+ ) *
3374+ }
3375+ }
3376+
3377+ impl_compare_predicate ! {
3378+ vector_signed_char
3379+ vector_unsigned_char
3380+
3381+ vector_signed_short
3382+ vector_unsigned_short
3383+
3384+ vector_signed_int
3385+ vector_unsigned_int
3386+ vector_float
3387+
3388+ vector_signed_long_long
3389+ vector_unsigned_long_long
3390+ vector_double
3391+ }
33363392}
33373393
33383394/// Load Count to Block Boundary
@@ -4878,6 +4934,38 @@ pub unsafe fn vec_cmpnrg_or_0_idx_cc<T: sealed::VectorCompareRange>(
48784934 x
48794935}
48804936
4937+ /// Vector Compare Greater Than
4938+ #[ inline]
4939+ #[ target_feature( enable = "vector" ) ]
4940+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4941+ pub unsafe fn vec_cmpgt < T : sealed:: VectorComparePredicate > ( a : T , b : T ) -> T :: Result {
4942+ a. vec_cmpgt ( b)
4943+ }
4944+
4945+ /// Vector Compare Greater Than or Equal
4946+ #[ inline]
4947+ #[ target_feature( enable = "vector" ) ]
4948+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4949+ pub unsafe fn vec_cmpge < T : sealed:: VectorComparePredicate > ( a : T , b : T ) -> T :: Result {
4950+ a. vec_cmpge ( b)
4951+ }
4952+
4953+ /// Vector Compare Less
4954+ #[ inline]
4955+ #[ target_feature( enable = "vector" ) ]
4956+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4957+ pub unsafe fn vec_cmplt < T : sealed:: VectorComparePredicate > ( a : T , b : T ) -> T :: Result {
4958+ a. vec_cmplt ( b)
4959+ }
4960+
4961+ /// Vector Compare Less Than or Equal
4962+ #[ inline]
4963+ #[ target_feature( enable = "vector" ) ]
4964+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4965+ pub unsafe fn vec_cmple < T : sealed:: VectorComparePredicate > ( a : T , b : T ) -> T :: Result {
4966+ a. vec_cmple ( b)
4967+ }
4968+
48814969#[ cfg( test) ]
48824970mod tests {
48834971 use super :: * ;
@@ -6241,4 +6329,28 @@ mod tests {
62416329 let d = unsafe { vec_cmpnrg_or_0_idx ( a, b, c) } ;
62426330 assert_eq ! ( d. as_array( ) , & [ 0 , 8 , 0 , 0 ] ) ;
62436331 }
6332+
6333+ test_vec_2 ! { test_vec_cmpgt, vec_cmpgt, f32x4, f32x4 -> i32x4,
6334+ [ 1.0 , f32 :: NAN , f32 :: NAN , 3.14 ] ,
6335+ [ 2.0 , f32 :: NAN , 5.0 , 2.0 ] ,
6336+ [ 0 , 0 , 0 , !0 ]
6337+ }
6338+
6339+ test_vec_2 ! { test_vec_cmpge, vec_cmpge, f32x4, f32x4 -> i32x4,
6340+ [ 1.0 , f32 :: NAN , f32 :: NAN , 3.14 ] ,
6341+ [ 1.0 , f32 :: NAN , 5.0 , 2.0 ] ,
6342+ [ !0 , 0 , 0 , !0 ]
6343+ }
6344+
6345+ test_vec_2 ! { test_vec_cmplt, vec_cmplt, f32x4, f32x4 -> i32x4,
6346+ [ 1.0 , f32 :: NAN , f32 :: NAN , 2.0 ] ,
6347+ [ 2.0 , f32 :: NAN , 5.0 , 2.0 ] ,
6348+ [ !0 , 0 , 0 , 0 ]
6349+ }
6350+
6351+ test_vec_2 ! { test_vec_cmple, vec_cmple, f32x4, f32x4 -> i32x4,
6352+ [ 1.0 , f32 :: NAN , f32 :: NAN , 2.0 ] ,
6353+ [ 1.0 , f32 :: NAN , 5.0 , 3.14 ] ,
6354+ [ !0 , 0 , 0 , !0 ]
6355+ }
62446356}
0 commit comments