@@ -243,6 +243,14 @@ unsafe extern "unadjusted" {
243243 #[ link_name = "llvm.s390.vstrcbs" ] fn vstrcbs ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char , d : u32 ) -> PackedTuple < vector_bool_char , i32 > ;
244244 #[ link_name = "llvm.s390.vstrchs" ] fn vstrchs ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_short , d : u32 ) -> PackedTuple < vector_bool_short , i32 > ;
245245 #[ link_name = "llvm.s390.vstrcfs" ] fn vstrcfs ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_int , d : u32 ) -> PackedTuple < vector_bool_int , i32 > ;
246+
247+ #[ link_name = "llvm.s390.vstrczb" ] fn vstrczb ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char , d : u32 ) -> vector_bool_char ;
248+ #[ link_name = "llvm.s390.vstrczh" ] fn vstrczh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_short , d : u32 ) -> vector_bool_short ;
249+ #[ link_name = "llvm.s390.vstrczf" ] fn vstrczf ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_int , d : u32 ) -> vector_bool_int ;
250+
251+ #[ link_name = "llvm.s390.vstrczbs" ] fn vstrczbs ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char , d : u32 ) -> PackedTuple < vector_bool_char , i32 > ;
252+ #[ link_name = "llvm.s390.vstrczhs" ] fn vstrczhs ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_short , d : u32 ) -> PackedTuple < vector_bool_short , i32 > ;
253+ #[ link_name = "llvm.s390.vstrczfs" ] fn vstrczfs ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_int , d : u32 ) -> PackedTuple < vector_bool_int , i32 > ;
246254}
247255
248256impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -3268,11 +3276,19 @@ mod sealed {
32683276 type Result ;
32693277
32703278 unsafe fn vstrc < const IMM : u32 > ( self , b : Self , c : Self ) -> Self :: Result ;
3279+ unsafe fn vstrcz < const IMM : u32 > ( self , b : Self , c : Self ) -> Self :: Result ;
32713280 unsafe fn vstrcs < const IMM : u32 > ( self , b : Self , c : Self ) -> ( Self :: Result , i32 ) ;
3281+ unsafe fn vstrczs < const IMM : u32 > ( self , b : Self , c : Self ) -> ( Self :: Result , i32 ) ;
3282+ }
3283+
3284+ const fn validate_compare_range_imm ( imm : u32 ) {
3285+ if !matches ! ( imm, 0 | 4 | 8 | 12 ) {
3286+ panic ! ( "IMM needs to be one of 0, 4, 8, 12" ) ;
3287+ }
32723288 }
32733289
32743290 macro_rules! impl_compare_range {
3275- ( $( $ty: ident $vstrc: ident $vstrcs: ident) * ) => {
3291+ ( $( $ty: ident $vstrc: ident $vstrcs: ident $vstrcz : ident $vstrczs : ident ) * ) => {
32763292 $(
32773293 #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
32783294 impl VectorCompareRange for $ty {
@@ -3281,36 +3297,41 @@ mod sealed {
32813297 #[ inline]
32823298 #[ target_feature( enable = "vector" ) ]
32833299 unsafe fn vstrc<const IMM : u32 >( self , b: Self , c: Self ) -> Self :: Result {
3284- const {
3285- if !matches!( IMM , 0 | 4 | 8 | 12 ) {
3286- panic!( "IMM needs to be one of 0, 4, 8, 12" ) ;
3287- }
3288- } ;
3289-
3300+ const { validate_compare_range_imm } ;
32903301 $vstrc( self , b, c, IMM )
32913302 }
32923303
32933304 #[ inline]
32943305 #[ target_feature( enable = "vector" ) ]
3295- unsafe fn vstrcs<const IMM : u32 >( self , b: Self , c: Self ) -> ( Self :: Result , i32 ) {
3296- const {
3297- if !matches!( IMM , 0 | 4 | 8 | 12 ) {
3298- panic!( "IMM needs to be one of 0, 4, 8, 12" ) ;
3299- }
3300- } ;
3306+ unsafe fn vstrcz<const IMM : u32 >( self , b: Self , c: Self ) -> Self :: Result {
3307+ const { validate_compare_range_imm } ;
3308+ $vstrcz( self , b, c, IMM )
3309+ }
33013310
3311+ #[ inline]
3312+ #[ target_feature( enable = "vector" ) ]
3313+ unsafe fn vstrcs<const IMM : u32 >( self , b: Self , c: Self ) -> ( Self :: Result , i32 ) {
3314+ const { validate_compare_range_imm } ;
33023315 let PackedTuple { x, y } = $vstrcs( self , b, c, IMM ) ;
33033316 ( x, y)
33043317 }
3318+
3319+ #[ inline]
3320+ #[ target_feature( enable = "vector" ) ]
3321+ unsafe fn vstrczs<const IMM : u32 >( self , b: Self , c: Self ) -> ( Self :: Result , i32 ) {
3322+ const { validate_compare_range_imm } ;
3323+ let PackedTuple { x, y } = $vstrczs( self , b, c, IMM ) ;
3324+ ( x, y)
3325+ }
33053326 }
33063327 ) *
33073328 }
33083329 }
33093330
33103331 impl_compare_range ! {
3311- vector_unsigned_char vstrcb vstrcbs
3312- vector_unsigned_short vstrch vstrchs
3313- vector_unsigned_int vstrcf vstrcfs
3332+ vector_unsigned_char vstrcb vstrcbs vstrczb vstrczbs
3333+ vector_unsigned_short vstrch vstrchs vstrczh vstrczhs
3334+ vector_unsigned_int vstrcf vstrcfs vstrczf vstrczfs
33143335 }
33153336}
33163337
@@ -4756,8 +4777,13 @@ pub unsafe fn vec_cmpnrg_idx<T: sealed::VectorCompareRange>(a: T, b: T, c: T) ->
47564777#[ inline]
47574778#[ target_feature( enable = "vector" ) ]
47584779#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4759- pub unsafe fn vec_cmprg_cc < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T , d : * mut i32 ) -> T :: Result {
4760- let ( x, y) = a. vstrcs :: < { FindImm :: Eq as u32 } > ( b, c) ;
4780+ pub unsafe fn vec_cmprg_cc < T : sealed:: VectorCompareRange > (
4781+ a : T ,
4782+ b : T ,
4783+ c : T ,
4784+ d : * mut i32 ,
4785+ ) -> T :: Result {
4786+ let ( x, y) = a. vstrcs :: < { FindImm :: Eq as u32 } > ( b, c) ;
47614787 d. write ( y) ;
47624788 x
47634789}
@@ -4766,8 +4792,13 @@ pub unsafe fn vec_cmprg_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T, d: *
47664792#[ inline]
47674793#[ target_feature( enable = "vector" ) ]
47684794#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4769- pub unsafe fn vec_cmpnrg_cc < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T , d : * mut i32 ) -> T :: Result {
4770- let ( x, y) = a. vstrcs :: < { FindImm :: Ne as u32 } > ( b, c) ;
4795+ pub unsafe fn vec_cmpnrg_cc < T : sealed:: VectorCompareRange > (
4796+ a : T ,
4797+ b : T ,
4798+ c : T ,
4799+ d : * mut i32 ,
4800+ ) -> T :: Result {
4801+ let ( x, y) = a. vstrcs :: < { FindImm :: Ne as u32 } > ( b, c) ;
47714802 d. write ( y) ;
47724803 x
47734804}
@@ -4776,8 +4807,13 @@ pub unsafe fn vec_cmpnrg_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T, d:
47764807#[ inline]
47774808#[ target_feature( enable = "vector" ) ]
47784809#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4779- pub unsafe fn vec_cmprg_idx_cc < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T , d : * mut i32 ) -> T :: Result {
4780- let ( x, y) = a. vstrcs :: < { FindImm :: EqIdx as u32 } > ( b, c) ;
4810+ pub unsafe fn vec_cmprg_idx_cc < T : sealed:: VectorCompareRange > (
4811+ a : T ,
4812+ b : T ,
4813+ c : T ,
4814+ d : * mut i32 ,
4815+ ) -> T :: Result {
4816+ let ( x, y) = a. vstrcs :: < { FindImm :: EqIdx as u32 } > ( b, c) ;
47814817 d. write ( y) ;
47824818 x
47834819}
@@ -4786,12 +4822,32 @@ pub unsafe fn vec_cmprg_idx_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T,
47864822#[ inline]
47874823#[ target_feature( enable = "vector" ) ]
47884824#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4789- pub unsafe fn vec_cmpnrg_idx_cc < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T , d : * mut i32 ) -> T :: Result {
4790- let ( x, y) = a. vstrcs :: < { FindImm :: NeIdx as u32 } > ( b, c) ;
4825+ pub unsafe fn vec_cmpnrg_idx_cc < T : sealed:: VectorCompareRange > (
4826+ a : T ,
4827+ b : T ,
4828+ c : T ,
4829+ d : * mut i32 ,
4830+ ) -> T :: Result {
4831+ let ( x, y) = a. vstrcs :: < { FindImm :: NeIdx as u32 } > ( b, c) ;
47914832 d. write ( y) ;
47924833 x
47934834}
47944835
4836+ /// Vector Compare Ranges or Zero Index#[inline]
4837+ #[ target_feature( enable = "vector" ) ]
4838+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4839+ pub unsafe fn vec_cmprg_or_0_idx < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T ) -> T :: Result {
4840+ a. vstrcz :: < { FindImm :: EqIdx as u32 } > ( b, c)
4841+ }
4842+
4843+ /// Vector Compare Not in Ranges or Zero Index
4844+ #[ inline]
4845+ #[ target_feature( enable = "vector" ) ]
4846+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4847+ pub unsafe fn vec_cmpnrg_or_0_idx < T : sealed:: VectorCompareRange > ( a : T , b : T , c : T ) -> T :: Result {
4848+ a. vstrcz :: < { FindImm :: NeIdx as u32 } > ( b, c)
4849+ }
4850+
47954851#[ cfg( test) ]
47964852mod tests {
47974853 use super :: * ;
@@ -6135,4 +6191,24 @@ mod tests {
61356191 let d = unsafe { vec_cmpnrg_idx ( a, b, c) } ;
61366192 assert_eq ! ( d. as_array( ) , & [ 0 , 0 , 0 , 0 ] ) ;
61376193 }
6194+
6195+ #[ simd_test( enable = "vector" ) ]
6196+ fn test_vec_cmprg_or_0_idx ( ) {
6197+ let a = vector_unsigned_int ( [ 1 , 0 , 22 , 33 ] ) ;
6198+ let b = vector_unsigned_int ( [ 10 , 20 , 30 , 40 ] ) ;
6199+
6200+ let c = vector_unsigned_int ( [ GT , LT , GT , LT ] ) ;
6201+ let d = unsafe { vec_cmprg_or_0_idx ( a, b, c) } ;
6202+ assert_eq ! ( d. as_array( ) , & [ 0 , 4 , 0 , 0 ] ) ;
6203+ }
6204+
6205+ #[ simd_test( enable = "vector" ) ]
6206+ fn test_vec_cmpnrg_or_0_idx ( ) {
6207+ let a = vector_unsigned_int ( [ 11 , 33 , 0 , 22 ] ) ;
6208+ let b = vector_unsigned_int ( [ 10 , 20 , 30 , 40 ] ) ;
6209+
6210+ let c = vector_unsigned_int ( [ GT , LT , GT , LT ] ) ;
6211+ let d = unsafe { vec_cmpnrg_or_0_idx ( a, b, c) } ;
6212+ assert_eq ! ( d. as_array( ) , & [ 0 , 8 , 0 , 0 ] ) ;
6213+ }
61386214}
0 commit comments