@@ -3389,6 +3389,54 @@ mod sealed {
3389
3389
vector_unsigned_long_long
3390
3390
vector_double
3391
3391
}
3392
+
3393
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3394
+ pub trait VectorEquality : Sized {
3395
+ type Result ;
3396
+
3397
+ #[ inline]
3398
+ #[ target_feature( enable = "vector" ) ]
3399
+ unsafe fn vec_cmpeq ( self , other : Self ) -> Self :: Result {
3400
+ simd_eq ( self , other)
3401
+ }
3402
+
3403
+ #[ inline]
3404
+ #[ target_feature( enable = "vector" ) ]
3405
+ unsafe fn vec_cmpne ( self , other : Self ) -> Self :: Result {
3406
+ simd_ne ( self , other)
3407
+ }
3408
+ }
3409
+
3410
+ macro_rules! impl_compare_equality {
3411
+ ( $( $ty: ident) * ) => {
3412
+ $(
3413
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3414
+ impl VectorEquality for $ty {
3415
+ type Result = t_b!( $ty) ;
3416
+ }
3417
+ ) *
3418
+ }
3419
+ }
3420
+
3421
+ impl_compare_equality ! {
3422
+ vector_bool_char
3423
+ vector_signed_char
3424
+ vector_unsigned_char
3425
+
3426
+ vector_bool_short
3427
+ vector_signed_short
3428
+ vector_unsigned_short
3429
+
3430
+ vector_bool_int
3431
+ vector_signed_int
3432
+ vector_unsigned_int
3433
+ vector_float
3434
+
3435
+ vector_bool_long_long
3436
+ vector_signed_long_long
3437
+ vector_unsigned_long_long
3438
+ vector_double
3439
+ }
3392
3440
}
3393
3441
3394
3442
/// Load Count to Block Boundary
@@ -4934,6 +4982,22 @@ pub unsafe fn vec_cmpnrg_or_0_idx_cc<T: sealed::VectorCompareRange>(
4934
4982
x
4935
4983
}
4936
4984
4985
+ /// Vector Compare Equal
4986
+ #[ inline]
4987
+ #[ target_feature( enable = "vector" ) ]
4988
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4989
+ pub unsafe fn vec_cmpeq < T : sealed:: VectorEquality > ( a : T , b : T ) -> T :: Result {
4990
+ a. vec_cmpeq ( b)
4991
+ }
4992
+
4993
+ /// Vector Compare Not Equal
4994
+ #[ inline]
4995
+ #[ target_feature( enable = "vector" ) ]
4996
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4997
+ pub unsafe fn vec_cmpne < T : sealed:: VectorEquality > ( a : T , b : T ) -> T :: Result {
4998
+ a. vec_cmpne ( b)
4999
+ }
5000
+
4937
5001
/// Vector Compare Greater Than
4938
5002
#[ inline]
4939
5003
#[ target_feature( enable = "vector" ) ]
@@ -6353,4 +6417,16 @@ mod tests {
6353
6417
[ 1.0 , f32 :: NAN , 5.0 , 3.14 ] ,
6354
6418
[ !0 , 0 , 0 , !0 ]
6355
6419
}
6420
+
6421
+ test_vec_2 ! { test_vec_cmpeq, vec_cmpeq, f32x4, f32x4 -> i32x4,
6422
+ [ 1.0 , f32 :: NAN , f32 :: NAN , 2.0 ] ,
6423
+ [ 1.0 , f32 :: NAN , 5.0 , 3.14 ] ,
6424
+ [ !0 , 0 , 0 , 0 ]
6425
+ }
6426
+
6427
+ test_vec_2 ! { test_vec_cmpne, vec_cmpne, f32x4, f32x4 -> i32x4,
6428
+ [ 1.0 , f32 :: NAN , f32 :: NAN , 2.0 ] ,
6429
+ [ 1.0 , f32 :: NAN , 5.0 , 3.14 ] ,
6430
+ [ 0 , !0 , !0 , !0 ]
6431
+ }
6356
6432
}
0 commit comments