@@ -3003,6 +3003,72 @@ mod sealed {
3003
3003
vcelfb ( self )
3004
3004
}
3005
3005
}
3006
+
3007
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3008
+ pub trait VectorExtendSigned64 {
3009
+ unsafe fn vec_extend_s64 ( self ) -> vector_signed_long_long ;
3010
+ }
3011
+
3012
+ #[ inline]
3013
+ #[ target_feature( enable = "vector" ) ]
3014
+ // FIXME(llvm): https://github.com/llvm/llvm-project/issues/129899
3015
+ // #[cfg_attr(test, assert_instr(vsegb))]
3016
+ pub unsafe fn vsegb ( a : vector_signed_char ) -> vector_signed_long_long {
3017
+ simd_as ( simd_shuffle :: < _ , _ , i8x2 > (
3018
+ a,
3019
+ a,
3020
+ const { u32x2:: from_array ( [ 7 , 15 ] ) } ,
3021
+ ) )
3022
+ }
3023
+
3024
+ #[ inline]
3025
+ #[ target_feature( enable = "vector" ) ]
3026
+ // FIXME(llvm): https://github.com/llvm/llvm-project/issues/129899
3027
+ // #[cfg_attr(test, assert_instr(vsegh))]
3028
+ pub unsafe fn vsegh ( a : vector_signed_short ) -> vector_signed_long_long {
3029
+ simd_as ( simd_shuffle :: < _ , _ , i16x2 > (
3030
+ a,
3031
+ a,
3032
+ const { u32x2:: from_array ( [ 3 , 7 ] ) } ,
3033
+ ) )
3034
+ }
3035
+
3036
+ #[ inline]
3037
+ #[ target_feature( enable = "vector" ) ]
3038
+ // FIXME(llvm): https://github.com/llvm/llvm-project/issues/129899
3039
+ // #[cfg_attr(test, assert_instr(vsegf))]
3040
+ pub unsafe fn vsegf ( a : vector_signed_int ) -> vector_signed_long_long {
3041
+ simd_as ( simd_shuffle :: < _ , _ , i32x2 > (
3042
+ a,
3043
+ a,
3044
+ const { u32x2:: from_array ( [ 1 , 3 ] ) } ,
3045
+ ) )
3046
+ }
3047
+
3048
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3049
+ impl VectorExtendSigned64 for vector_signed_char {
3050
+ #[ inline]
3051
+ #[ target_feature( enable = "vector" ) ]
3052
+ unsafe fn vec_extend_s64 ( self ) -> vector_signed_long_long {
3053
+ vsegb ( self )
3054
+ }
3055
+ }
3056
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3057
+ impl VectorExtendSigned64 for vector_signed_short {
3058
+ #[ inline]
3059
+ #[ target_feature( enable = "vector" ) ]
3060
+ unsafe fn vec_extend_s64 ( self ) -> vector_signed_long_long {
3061
+ vsegh ( self )
3062
+ }
3063
+ }
3064
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
3065
+ impl VectorExtendSigned64 for vector_signed_int {
3066
+ #[ inline]
3067
+ #[ target_feature( enable = "vector" ) ]
3068
+ unsafe fn vec_extend_s64 ( self ) -> vector_signed_long_long {
3069
+ vsegf ( self )
3070
+ }
3071
+ }
3006
3072
}
3007
3073
3008
3074
/// Load Count to Block Boundary
@@ -4314,6 +4380,14 @@ pub unsafe fn vec_double(a: impl sealed::VectorDouble) -> vector_double {
4314
4380
a. vec_double ( )
4315
4381
}
4316
4382
4383
+ /// Vector Sign Extend to Doubleword
4384
+ #[ inline]
4385
+ #[ target_feature( enable = "vector" ) ]
4386
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4387
+ pub unsafe fn vec_extend_s64 ( a : impl sealed:: VectorExtendSigned64 ) -> vector_signed_long_long {
4388
+ a. vec_extend_s64 ( )
4389
+ }
4390
+
4317
4391
#[ cfg( test) ]
4318
4392
mod tests {
4319
4393
use super :: * ;
@@ -5459,4 +5533,18 @@ mod tests {
5459
5533
assert_eq ! ( d. as_array( ) [ 2 ] , f64 :: MAX as f32 ) ;
5460
5534
}
5461
5535
}
5536
+
5537
+ #[ simd_test( enable = "vector" ) ]
5538
+ fn test_vec_extend_s64 ( ) {
5539
+ unsafe {
5540
+ let v = vector_signed_char ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
5541
+ assert_eq ! ( vec_extend_s64( v) . as_array( ) , & [ 7 , 15 ] ) ;
5542
+
5543
+ let v = vector_signed_short ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
5544
+ assert_eq ! ( vec_extend_s64( v) . as_array( ) , & [ 3 , 7 ] ) ;
5545
+
5546
+ let v = vector_signed_int ( [ 0 , 1 , 2 , 3 ] ) ;
5547
+ assert_eq ! ( vec_extend_s64( v) . as_array( ) , & [ 1 , 3 ] ) ;
5548
+ }
5549
+ }
5462
5550
}
0 commit comments