diff --git a/library/stdarch/src/lib.rs b/library/stdarch/src/lib.rs index 1aa713742844..8ecf0850f680 100644 --- a/library/stdarch/src/lib.rs +++ b/library/stdarch/src/lib.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] #![feature( const_fn, link_llvm_intrinsics, platform_intrinsics, repr_simd, simd_ffi, - target_feature, + target_feature, cfg_target_feature )] /// Platform independent SIMD vector types and operations. diff --git a/library/stdarch/src/x86/avx.rs b/library/stdarch/src/x86/avx.rs index 6ec764c3776b..7b23d1e6cde5 100644 --- a/library/stdarch/src/x86/avx.rs +++ b/library/stdarch/src/x86/avx.rs @@ -31,7 +31,7 @@ extern "C" { } -#[cfg(test)] +#[cfg(all(test, target_feature = "avx", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v256::*; use x86::avx; @@ -65,7 +65,4 @@ mod tests { let e = f64x4::new(-4.0,8.0,-4.0,12.0); assert_eq!(r, e); } - - - -} \ No newline at end of file +} diff --git a/library/stdarch/src/x86/avx2.rs b/library/stdarch/src/x86/avx2.rs index e07f26a67dec..ac81ccb9dea1 100644 --- a/library/stdarch/src/x86/avx2.rs +++ b/library/stdarch/src/x86/avx2.rs @@ -1044,7 +1044,7 @@ extern "C" { } -#[cfg(test)] +#[cfg(all(test, target_feature = "avx2", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v256::*; use v128::*; diff --git a/library/stdarch/src/x86/sse.rs b/library/stdarch/src/x86/sse.rs index c03735624c75..d1af0e1a9b61 100644 --- a/library/stdarch/src/x86/sse.rs +++ b/library/stdarch/src/x86/sse.rs @@ -66,7 +66,7 @@ extern { fn movmskps(a: f32x4) -> i32; } -#[cfg(test)] +#[cfg(all(test, target_feature = "sse", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v128::*; use x86::sse; diff --git a/library/stdarch/src/x86/sse2.rs b/library/stdarch/src/x86/sse2.rs index b564677ea786..882259fa5502 100644 --- a/library/stdarch/src/x86/sse2.rs +++ b/library/stdarch/src/x86/sse2.rs @@ -1716,7 +1716,7 @@ extern { fn movmskpd(a: f64x2) -> i32; } -#[cfg(test)] +#[cfg(all(test, target_feature = "sse2", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use std::os::raw::c_void; diff --git a/library/stdarch/src/x86/sse41.rs b/library/stdarch/src/x86/sse41.rs index 61217f26f596..b7dc45263e39 100644 --- a/library/stdarch/src/x86/sse41.rs +++ b/library/stdarch/src/x86/sse41.rs @@ -16,13 +16,13 @@ extern { fn pblendvb(a: __m128i, b: __m128i, mask: __m128i) -> __m128i; } -#[cfg(test)] +#[cfg(all(test, target_feature = "sse4.1", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v128::*; use x86::sse41; #[test] - #[target_feature = "+sse4.2"] + #[target_feature = "+sse4.1"] fn _mm_blendv_epi8() { let a = i8x16::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); diff --git a/library/stdarch/src/x86/sse42.rs b/library/stdarch/src/x86/sse42.rs index 4789fd32d537..242906119f7c 100644 --- a/library/stdarch/src/x86/sse42.rs +++ b/library/stdarch/src/x86/sse42.rs @@ -304,7 +304,7 @@ extern { fn pcmpestri128(a: __m128i, la: i32, b: __m128i, lb: i32, imm8: i8) -> i32; } -#[cfg(test)] +#[cfg(all(test, target_feature = "sse4.2", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v128::*; use x86::{__m128i, sse42}; diff --git a/library/stdarch/src/x86/ssse3.rs b/library/stdarch/src/x86/ssse3.rs index b4b9ce21d421..1d1497f5d0d1 100644 --- a/library/stdarch/src/x86/ssse3.rs +++ b/library/stdarch/src/x86/ssse3.rs @@ -50,7 +50,7 @@ extern { fn pshufb128(a: u8x16, b: u8x16) -> u8x16; } -#[cfg(test)] +#[cfg(all(test, target_feature = "ssse3", any(target_arch = "x86", target_arch = "x86_64")))] mod tests { use v128::*; use x86::ssse3 as ssse3;