@@ -211,6 +211,8 @@ unsafe extern "unadjusted" {
211
211
212
212
#[ link_name = "llvm.s390.vftcisb" ] fn vftcisb ( a : vector_float , b : u32 ) -> PackedTuple < vector_bool_int , i32 > ;
213
213
#[ link_name = "llvm.s390.vftcidb" ] fn vftcidb ( a : vector_double , b : u32 ) -> PackedTuple < vector_bool_long_long , i32 > ;
214
+
215
+ #[ link_name = "llvm.s390.vtm" ] fn vtm ( a : i8x16 , b : i8x16 ) -> i32 ;
214
216
}
215
217
216
218
impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -2818,6 +2820,44 @@ mod sealed {
2818
2820
x
2819
2821
}
2820
2822
}
2823
+
2824
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2825
+ pub trait VectorTestMask {
2826
+ type Mask ;
2827
+ unsafe fn vec_test_mask ( self , other : Self :: Mask ) -> i32 ;
2828
+ }
2829
+
2830
+ macro_rules! impl_vec_test_mask {
2831
+ ( $( $instr: ident $ty: ident) * ) => {
2832
+ $(
2833
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2834
+ impl VectorTestMask for $ty {
2835
+ type Mask = t_u!( $ty) ;
2836
+
2837
+ #[ inline]
2838
+ #[ target_feature( enable = "vector" ) ]
2839
+ unsafe fn vec_test_mask( self , other: Self :: Mask ) -> i32 {
2840
+ vtm( transmute( self ) , transmute( other) )
2841
+ }
2842
+ }
2843
+ ) *
2844
+ }
2845
+ }
2846
+
2847
+ impl_vec_test_mask ! {
2848
+ vector_signed_char
2849
+ vector_signed_short
2850
+ vector_signed_int
2851
+ vector_signed_long_long
2852
+
2853
+ vector_unsigned_char
2854
+ vector_unsigned_short
2855
+ vector_unsigned_int
2856
+ vector_unsigned_long_long
2857
+
2858
+ vector_float
2859
+ vector_double
2860
+ }
2821
2861
}
2822
2862
2823
2863
/// Load Count to Block Boundary
@@ -4051,6 +4091,16 @@ pub unsafe fn vec_fp_test_data_class<T: sealed::VectorFpTestDataClass, const CLA
4051
4091
a. vec_fp_test_data_class :: < CLASS > ( c)
4052
4092
}
4053
4093
4094
+ /// Vector Test under Mask
4095
+ #[ inline]
4096
+ #[ target_feature( enable = "vector" ) ]
4097
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4098
+ pub unsafe fn vec_test_mask < T : sealed:: VectorTestMask > ( a : T , b : T :: Mask ) -> i32 {
4099
+ // I can't find much information about this, but this might just be a check for whether the
4100
+ // bitwise and of a and b is non-zero?
4101
+ a. vec_test_mask ( b)
4102
+ }
4103
+
4054
4104
#[ cfg( test) ]
4055
4105
mod tests {
4056
4106
use super :: * ;
@@ -5071,4 +5121,25 @@ mod tests {
5071
5121
assert_eq ! ( d. as_array( ) , & [ !0 , !0 ] ) ;
5072
5122
}
5073
5123
}
5124
+
5125
+ #[ simd_test( enable = "vector" ) ]
5126
+ fn test_vec_test_mask ( ) {
5127
+ unsafe {
5128
+ let v = vector_unsigned_long_long ( [ 0xFF00FF00FF00FF00 ; 2 ] ) ;
5129
+ let m = vector_unsigned_long_long ( [ 0x0000FF000000FF00 ; 2 ] ) ;
5130
+ assert_eq ! ( vec_test_mask( v, m) , 3 ) ;
5131
+
5132
+ let v = vector_unsigned_long_long ( [ u64:: MAX ; 2 ] ) ;
5133
+ let m = vector_unsigned_long_long ( [ 0 ; 2 ] ) ;
5134
+ assert_eq ! ( vec_test_mask( v, m) , 0 ) ;
5135
+
5136
+ let v = vector_unsigned_long_long ( [ 0 ; 2 ] ) ;
5137
+ let m = vector_unsigned_long_long ( [ u64:: MAX ; 2 ] ) ;
5138
+ assert_eq ! ( vec_test_mask( v, m) , 0 ) ;
5139
+
5140
+ let v = vector_unsigned_long_long ( [ 0xAAAAAAAAAAAAAAAA ; 2 ] ) ;
5141
+ let m = vector_unsigned_long_long ( [ 0xAAAAAAAAAAAAAAAA ; 2 ] ) ;
5142
+ assert_eq ! ( vec_test_mask( v, m) , 3 ) ;
5143
+ }
5144
+ }
5074
5145
}
0 commit comments