@@ -221,6 +221,14 @@ unsafe extern "unadjusted" {
221
221
#[ link_name = "llvm.s390.vstrszb" ] fn vstrszb ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char ) -> PackedTuple < vector_unsigned_char , i32 > ;
222
222
#[ link_name = "llvm.s390.vstrszh" ] fn vstrszh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_char ) -> PackedTuple < vector_unsigned_char , i32 > ;
223
223
#[ link_name = "llvm.s390.vstrszf" ] fn vstrszf ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_char ) -> PackedTuple < vector_unsigned_char , i32 > ;
224
+
225
+ #[ link_name = "llvm.s390.vistrb" ] fn vistrb ( a : vector_unsigned_char ) -> vector_unsigned_char ;
226
+ #[ link_name = "llvm.s390.vistrh" ] fn vistrh ( a : vector_unsigned_short ) -> vector_unsigned_short ;
227
+ #[ link_name = "llvm.s390.vistrf" ] fn vistrf ( a : vector_unsigned_int ) -> vector_unsigned_int ;
228
+
229
+ #[ link_name = "llvm.s390.vistrbs" ] fn vistrbs ( a : vector_unsigned_char ) -> PackedTuple < vector_unsigned_char , i32 > ;
230
+ #[ link_name = "llvm.s390.vistrhs" ] fn vistrhs ( a : vector_unsigned_short ) -> PackedTuple < vector_unsigned_short , i32 > ;
231
+ #[ link_name = "llvm.s390.vistrfs" ] fn vistrfs ( a : vector_unsigned_int ) -> PackedTuple < vector_unsigned_int , i32 > ;
224
232
}
225
233
226
234
impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -3098,6 +3106,68 @@ mod sealed {
3098
3106
3099
3107
impl_vec_trait ! { [ VectorUnsigned vec_unsigned] vclgsb ( vector_float) -> vector_unsigned_int }
3100
3108
impl_vec_trait ! { [ VectorUnsigned vec_unsigned] vclgdb ( vector_double) -> vector_unsigned_long_long }
3109
+
3110
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3111
+ pub trait VectorCopyUntilZero {
3112
+ unsafe fn vec_cp_until_zero ( self ) -> Self ;
3113
+ }
3114
+
3115
+ test_impl ! { vec_vistrb ( a: vector_unsigned_char) -> vector_unsigned_char [ vistrb, vistrb] }
3116
+ test_impl ! { vec_vistrh ( a: vector_unsigned_short) -> vector_unsigned_short [ vistrh, vistrh] }
3117
+ test_impl ! { vec_vistrf ( a: vector_unsigned_int) -> vector_unsigned_int [ vistrf, vistrf] }
3118
+
3119
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrb ( vector_signed_char) }
3120
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrb ( vector_bool_char) }
3121
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrb ( vector_unsigned_char) }
3122
+
3123
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrh ( vector_signed_short) }
3124
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrh ( vector_bool_short) }
3125
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrh ( vector_unsigned_short) }
3126
+
3127
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrf ( vector_signed_int) }
3128
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrf ( vector_bool_int) }
3129
+ impl_vec_trait ! { [ VectorCopyUntilZero vec_cp_until_zero] + vec_vistrf ( vector_unsigned_int) }
3130
+
3131
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3132
+ pub trait VectorCopyUntilZeroCC {
3133
+ unsafe fn vec_cp_until_zero_cc ( self , cc : * mut i32 ) -> Self ;
3134
+ }
3135
+
3136
+ test_impl ! { vec_vistrbs ( a: vector_unsigned_char) -> PackedTuple <vector_unsigned_char, i32 > [ vistrbs, vistrbs] }
3137
+ test_impl ! { vec_vistrhs ( a: vector_unsigned_short) -> PackedTuple <vector_unsigned_short, i32 > [ vistrhs, vistrhs] }
3138
+ test_impl ! { vec_vistrfs ( a: vector_unsigned_int) -> PackedTuple <vector_unsigned_int, i32 > [ vistrfs, vistrfs] }
3139
+
3140
+ macro_rules! impl_vec_copy_until_zero_cc {
3141
+ ( $( $intr: ident $ty: ident) * ) => {
3142
+ $(
3143
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3144
+ impl VectorCopyUntilZeroCC for $ty {
3145
+ #[ inline]
3146
+ #[ target_feature( enable = "vector" ) ]
3147
+ unsafe fn vec_cp_until_zero_cc( self , cc: * mut i32 ) -> Self {
3148
+ let PackedTuple { x, y } = $intr( transmute( self ) ) ;
3149
+ cc. write( y) ;
3150
+ transmute( x)
3151
+ }
3152
+ }
3153
+
3154
+ ) *
3155
+ }
3156
+ }
3157
+
3158
+ impl_vec_copy_until_zero_cc ! {
3159
+ vec_vistrbs vector_signed_char
3160
+ vec_vistrbs vector_bool_char
3161
+ vec_vistrbs vector_unsigned_char
3162
+
3163
+ vec_vistrhs vector_signed_short
3164
+ vec_vistrhs vector_bool_short
3165
+ vec_vistrhs vector_unsigned_short
3166
+
3167
+ vec_vistrfs vector_signed_int
3168
+ vec_vistrfs vector_bool_int
3169
+ vec_vistrfs vector_unsigned_int
3170
+ }
3101
3171
}
3102
3172
3103
3173
/// Load Count to Block Boundary
@@ -4433,6 +4503,22 @@ pub unsafe fn vec_unsigned<T: sealed::VectorUnsigned>(a: T) -> T::Result {
4433
4503
a. vec_unsigned ( )
4434
4504
}
4435
4505
4506
+ /// Vector Copy Until Zero
4507
+ #[ inline]
4508
+ #[ target_feature( enable = "vector" ) ]
4509
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4510
+ pub unsafe fn vec_cp_until_zero < T : sealed:: VectorCopyUntilZero > ( a : T ) -> T {
4511
+ a. vec_cp_until_zero ( )
4512
+ }
4513
+
4514
+ /// Vector Copy Until Zero
4515
+ #[ inline]
4516
+ #[ target_feature( enable = "vector" ) ]
4517
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4518
+ pub unsafe fn vec_cp_until_zero_cc < T : sealed:: VectorCopyUntilZeroCC > ( a : T , cc : * mut i32 ) -> T {
4519
+ a. vec_cp_until_zero_cc ( cc)
4520
+ }
4521
+
4436
4522
#[ cfg( test) ]
4437
4523
mod tests {
4438
4524
use super :: * ;
@@ -5615,4 +5701,33 @@ mod tests {
5615
5701
assert_eq ! ( vec_unsigned( v) . as_array( ) , & [ 2 , 3 ] ) ;
5616
5702
}
5617
5703
}
5704
+
5705
+ #[ simd_test( enable = "vector" ) ]
5706
+ fn test_vec_cp_until_zero ( ) {
5707
+ unsafe {
5708
+ let v = vector_signed_int ( [ 1 , 2 , 3 , 4 ] ) ;
5709
+ let d = vec_cp_until_zero ( v) ;
5710
+ assert_eq ! ( d. as_array( ) , & [ 1 , 2 , 3 , 4 ] ) ;
5711
+
5712
+ let v = vector_signed_int ( [ 1 , 2 , 0 , 4 ] ) ;
5713
+ let d = vec_cp_until_zero ( v) ;
5714
+ assert_eq ! ( d. as_array( ) , & [ 1 , 2 , 0 , 0 ] ) ;
5715
+ }
5716
+ }
5717
+
5718
+ #[ simd_test( enable = "vector" ) ]
5719
+ fn test_vec_cp_until_zero_cc ( ) {
5720
+ let mut cc = 0 ;
5721
+ unsafe {
5722
+ let v = vector_signed_int ( [ 1 , 2 , 3 , 4 ] ) ;
5723
+ let d = vec_cp_until_zero_cc ( v, & mut cc) ;
5724
+ assert_eq ! ( d. as_array( ) , & [ 1 , 2 , 3 , 4 ] ) ;
5725
+ assert_eq ! ( cc, 3 ) ;
5726
+
5727
+ let v = vector_signed_int ( [ 1 , 2 , 0 , 4 ] ) ;
5728
+ let d = vec_cp_until_zero_cc ( v, & mut cc) ;
5729
+ assert_eq ! ( d. as_array( ) , & [ 1 , 2 , 0 , 0 ] ) ;
5730
+ assert_eq ! ( cc, 0 ) ;
5731
+ }
5732
+ }
5618
5733
}
0 commit comments