@@ -2862,7 +2862,7 @@ mod sealed {
2862
2862
#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2863
2863
pub trait VectorFpTestDataClass {
2864
2864
type Result ;
2865
- unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self , ptr : * mut i32 ) -> Self :: Result ;
2865
+ unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self ) -> ( Self :: Result , i32 ) ;
2866
2866
}
2867
2867
2868
2868
#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
@@ -2871,10 +2871,9 @@ mod sealed {
2871
2871
2872
2872
#[ inline]
2873
2873
#[ target_feature( enable = "vector" ) ]
2874
- unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self , ptr : * mut i32 ) -> Self :: Result {
2874
+ unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self ) -> ( Self :: Result , i32 ) {
2875
2875
let PackedTuple { x, y } = vftcisb ( self , CLASS ) ;
2876
- unsafe { ptr. write ( y) } ;
2877
- x
2876
+ ( x, y)
2878
2877
}
2879
2878
}
2880
2879
@@ -2884,10 +2883,9 @@ mod sealed {
2884
2883
2885
2884
#[ inline]
2886
2885
#[ target_feature( enable = "vector" ) ]
2887
- unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self , ptr : * mut i32 ) -> Self :: Result {
2886
+ unsafe fn vec_fp_test_data_class < const CLASS : u32 > ( self ) -> ( Self :: Result , i32 ) {
2888
2887
let PackedTuple { x, y } = vftcidb ( self , CLASS ) ;
2889
- unsafe { ptr. write ( y) } ;
2890
- x
2888
+ ( x, y)
2891
2889
}
2892
2890
}
2893
2891
@@ -4800,7 +4798,37 @@ pub unsafe fn vec_fp_test_data_class<T: sealed::VectorFpTestDataClass, const CLA
4800
4798
a : T ,
4801
4799
c : * mut i32 ,
4802
4800
) -> T :: Result {
4803
- a. vec_fp_test_data_class :: < CLASS > ( c)
4801
+ let ( x, y) = a. vec_fp_test_data_class :: < CLASS > ( ) ;
4802
+ c. write ( y) ;
4803
+ x
4804
+ }
4805
+
4806
+ #[ inline]
4807
+ #[ target_feature( enable = "vector" ) ]
4808
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4809
+ pub unsafe fn vec_all_nan < T : sealed:: VectorFpTestDataClass > ( a : T ) -> i32 {
4810
+ i32:: from ( a. vec_fp_test_data_class :: < __VEC_CLASS_FP_NAN > ( ) . 1 == 0 )
4811
+ }
4812
+
4813
+ #[ inline]
4814
+ #[ target_feature( enable = "vector" ) ]
4815
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4816
+ pub unsafe fn vec_all_numeric < T : sealed:: VectorFpTestDataClass > ( a : T ) -> i32 {
4817
+ i32:: from ( a. vec_fp_test_data_class :: < __VEC_CLASS_FP_NAN > ( ) . 1 == 3 )
4818
+ }
4819
+
4820
+ #[ inline]
4821
+ #[ target_feature( enable = "vector" ) ]
4822
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4823
+ pub unsafe fn vec_any_nan < T : sealed:: VectorFpTestDataClass > ( a : T ) -> i32 {
4824
+ i32:: from ( a. vec_fp_test_data_class :: < __VEC_CLASS_FP_NAN > ( ) . 1 != 3 )
4825
+ }
4826
+
4827
+ #[ inline]
4828
+ #[ target_feature( enable = "vector" ) ]
4829
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4830
+ pub unsafe fn vec_any_numeric < T : sealed:: VectorFpTestDataClass > ( a : T ) -> i32 {
4831
+ i32:: from ( a. vec_fp_test_data_class :: < __VEC_CLASS_FP_NAN > ( ) . 1 != 0 )
4804
4832
}
4805
4833
4806
4834
/// Vector Test under Mask
@@ -6257,6 +6285,58 @@ mod tests {
6257
6285
}
6258
6286
}
6259
6287
6288
+ #[ simd_test( enable = "vector" ) ]
6289
+ fn test_vec_fp_any_all_nan_numeric ( ) {
6290
+ unsafe {
6291
+ assert_eq ! (
6292
+ vec_all_nan( vector_double( [ f64 :: NAN , f64 :: NAN ] ) ) ,
6293
+ i32 :: from( true )
6294
+ ) ;
6295
+ assert_eq ! (
6296
+ vec_all_nan( vector_double( [ f64 :: NAN , 1.0 ] ) ) ,
6297
+ i32 :: from( false )
6298
+ ) ;
6299
+ assert_eq ! ( vec_all_nan( vector_double( [ 0.0 , 1.0 ] ) ) , i32 :: from( false ) ) ;
6300
+
6301
+ assert_eq ! (
6302
+ vec_any_nan( vector_double( [ f64 :: NAN , f64 :: NAN ] ) ) ,
6303
+ i32 :: from( true )
6304
+ ) ;
6305
+ assert_eq ! ( vec_any_nan( vector_double( [ f64 :: NAN , 1.0 ] ) ) , i32 :: from( true ) ) ;
6306
+ assert_eq ! ( vec_any_nan( vector_double( [ 0.0 , 1.0 ] ) ) , i32 :: from( false ) ) ;
6307
+
6308
+ assert_eq ! (
6309
+ vec_all_numeric( vector_double( [ f64 :: NAN , f64 :: NAN ] ) ) ,
6310
+ i32 :: from( false )
6311
+ ) ;
6312
+ assert_eq ! (
6313
+ vec_all_numeric( vector_double( [ f64 :: NAN , 1.0 ] ) ) ,
6314
+ i32 :: from( false )
6315
+ ) ;
6316
+ assert_eq ! ( vec_all_numeric( vector_double( [ 0.0 , 1.0 ] ) ) , i32 :: from( true ) ) ;
6317
+
6318
+ assert_eq ! (
6319
+ vec_any_numeric( vector_double( [ f64 :: NAN , f64 :: NAN ] ) ) ,
6320
+ i32 :: from( false )
6321
+ ) ;
6322
+ assert_eq ! (
6323
+ vec_any_numeric( vector_double( [ f64 :: NAN , 1.0 ] ) ) ,
6324
+ i32 :: from( true )
6325
+ ) ;
6326
+ assert_eq ! ( vec_any_numeric( vector_double( [ 0.0 , 1.0 ] ) ) , i32 :: from( true ) ) ;
6327
+
6328
+ // "numeric" means "not NaN". infinities are numeric
6329
+ assert_eq ! (
6330
+ vec_all_numeric( vector_double( [ f64 :: INFINITY , f64 :: NEG_INFINITY ] ) ) ,
6331
+ i32 :: from( true )
6332
+ ) ;
6333
+ assert_eq ! (
6334
+ vec_any_numeric( vector_double( [ f64 :: INFINITY , f64 :: NEG_INFINITY ] ) ) ,
6335
+ i32 :: from( true )
6336
+ ) ;
6337
+ }
6338
+ }
6339
+
6260
6340
#[ simd_test( enable = "vector" ) ]
6261
6341
fn test_vec_test_mask ( ) {
6262
6342
unsafe {
0 commit comments