@@ -243,6 +243,14 @@ unsafe extern "unadjusted" {
243
243
#[ 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 > ;
244
244
#[ 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 > ;
245
245
#[ 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 > ;
246
254
}
247
255
248
256
impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -3268,11 +3276,19 @@ mod sealed {
3268
3276
type Result ;
3269
3277
3270
3278
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 ;
3271
3280
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
+ }
3272
3288
}
3273
3289
3274
3290
macro_rules! impl_compare_range {
3275
- ( $( $ty: ident $vstrc: ident $vstrcs: ident) * ) => {
3291
+ ( $( $ty: ident $vstrc: ident $vstrcs: ident $vstrcz : ident $vstrczs : ident ) * ) => {
3276
3292
$(
3277
3293
#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3278
3294
impl VectorCompareRange for $ty {
@@ -3281,36 +3297,41 @@ mod sealed {
3281
3297
#[ inline]
3282
3298
#[ target_feature( enable = "vector" ) ]
3283
3299
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 } ;
3290
3301
$vstrc( self , b, c, IMM )
3291
3302
}
3292
3303
3293
3304
#[ inline]
3294
3305
#[ 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
+ }
3301
3310
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 } ;
3302
3315
let PackedTuple { x, y } = $vstrcs( self , b, c, IMM ) ;
3303
3316
( x, y)
3304
3317
}
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
+ }
3305
3326
}
3306
3327
) *
3307
3328
}
3308
3329
}
3309
3330
3310
3331
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
3314
3335
}
3315
3336
}
3316
3337
@@ -4756,8 +4777,13 @@ pub unsafe fn vec_cmpnrg_idx<T: sealed::VectorCompareRange>(a: T, b: T, c: T) ->
4756
4777
#[ inline]
4757
4778
#[ target_feature( enable = "vector" ) ]
4758
4779
#[ 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) ;
4761
4787
d. write ( y) ;
4762
4788
x
4763
4789
}
@@ -4766,8 +4792,13 @@ pub unsafe fn vec_cmprg_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T, d: *
4766
4792
#[ inline]
4767
4793
#[ target_feature( enable = "vector" ) ]
4768
4794
#[ 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) ;
4771
4802
d. write ( y) ;
4772
4803
x
4773
4804
}
@@ -4776,8 +4807,13 @@ pub unsafe fn vec_cmpnrg_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T, d:
4776
4807
#[ inline]
4777
4808
#[ target_feature( enable = "vector" ) ]
4778
4809
#[ 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) ;
4781
4817
d. write ( y) ;
4782
4818
x
4783
4819
}
@@ -4786,12 +4822,32 @@ pub unsafe fn vec_cmprg_idx_cc<T: sealed::VectorCompareRange>(a: T, b: T, c: T,
4786
4822
#[ inline]
4787
4823
#[ target_feature( enable = "vector" ) ]
4788
4824
#[ 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) ;
4791
4832
d. write ( y) ;
4792
4833
x
4793
4834
}
4794
4835
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
+
4795
4851
#[ cfg( test) ]
4796
4852
mod tests {
4797
4853
use super :: * ;
@@ -6135,4 +6191,24 @@ mod tests {
6135
6191
let d = unsafe { vec_cmpnrg_idx ( a, b, c) } ;
6136
6192
assert_eq ! ( d. as_array( ) , & [ 0 , 0 , 0 , 0 ] ) ;
6137
6193
}
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
+ }
6138
6214
}
0 commit comments