@@ -52,18 +52,20 @@ pub fn simd_test(_: TokenStream, item: TokenStream) -> TokenStream {
5252 // proc macros are evaluated.
5353
5454 // There is currently no way to conditionally ignore a test at runtime (see
55- // https://internals.rust-lang.org/t/pre-rfc-skippable-tests/14611). Instead, we have to assert that these CPU
56- // features are always detected and fail the test if they aren't.
55+ // https://internals.rust-lang.org/t/pre-rfc-skippable-tests/14611). Instead, we'll just pass the tests if the
56+ // target features aren't supported. This is not ideal, since it may mislead you into thinking tests have passed
57+ // when they haven't even been run, but some CI runners don't support all target features and we don't want failures
58+ // as a result of that.
5759
5860 let neon_snippet = quote ! {
5961 #[ cfg( target_arch = "aarch64" ) ]
6062 #[ test]
6163 #ignore_neon
6264 fn #neon_name( ) {
63- assert! ( std:: arch:: is_aarch64_feature_detected!( "neon" ) ) ;
64-
65- let neon = unsafe { fearless_simd :: aarch64 :: Neon :: new_unchecked ( ) } ;
66- #input_fn_name ( neon ) ;
65+ if std:: arch:: is_aarch64_feature_detected!( "neon" ) {
66+ let neon = unsafe { fearless_simd :: aarch64 :: Neon :: new_unchecked ( ) } ;
67+ #input_fn_name ( neon ) ;
68+ }
6769 }
6870 } ;
6971
@@ -72,10 +74,10 @@ pub fn simd_test(_: TokenStream, item: TokenStream) -> TokenStream {
7274 #[ test]
7375 #ignore_sse4
7476 fn #sse4_name( ) {
75- assert! ( std:: arch:: is_x86_feature_detected!( "sse4.2" ) ) ;
76-
77- let sse4 = unsafe { fearless_simd :: x86 :: Sse4_2 :: new_unchecked ( ) } ;
78- #input_fn_name ( sse4 ) ;
77+ if std:: arch:: is_x86_feature_detected!( "sse4.2" ) {
78+ let sse4 = unsafe { fearless_simd :: x86 :: Sse4_2 :: new_unchecked ( ) } ;
79+ #input_fn_name ( sse4 ) ;
80+ }
7981 }
8082 } ;
8183
@@ -84,13 +86,12 @@ pub fn simd_test(_: TokenStream, item: TokenStream) -> TokenStream {
8486 #[ test]
8587 #ignore_avx2
8688 fn #avx2_name( ) {
87- assert!(
88- std:: arch:: is_x86_feature_detected!( "avx2" )
89+ if std:: arch:: is_x86_feature_detected!( "avx2" )
8990 && std:: arch:: is_x86_feature_detected!( "fma" )
90- ) ;
91-
92- let avx2 = unsafe { fearless_simd :: x86 :: Avx2 :: new_unchecked ( ) } ;
93- #input_fn_name ( avx2 ) ;
91+ {
92+ let avx2 = unsafe { fearless_simd :: x86 :: Avx2 :: new_unchecked ( ) } ;
93+ #input_fn_name ( avx2 ) ;
94+ }
9495 }
9596 } ;
9697
0 commit comments