diff --git a/ci/run.sh b/ci/run.sh index 875a206e84..2cde13c105 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -39,10 +39,6 @@ case ${TARGET} in *android*) export STDSIMD_DISABLE_ASSERT_INSTR=1 ;; - wasm32*) - # export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128" - ;; - *) ;; esac @@ -63,13 +59,17 @@ cargo_test() { cargo_test cargo_test "--release" -# Test x86 targets compiled with AVX. +# Test targets compiled with extra features. case ${TARGET} in x86*) RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx" export STDSIMD_DISABLE_ASSERT_INSTR=1 cargo_test "--release" ;; + wasm32-unknown-unknown*) + # export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128" + cargo_test "--release --features=wasm32_simd128" + ;; *) ;; esac diff --git a/coresimd/wasm32/mod.rs b/coresimd/wasm32/mod.rs index 054e187f9d..ea5a8e0ba0 100644 --- a/coresimd/wasm32/mod.rs +++ b/coresimd/wasm32/mod.rs @@ -1,11 +1,12 @@ //! WASM32 intrinsics #[macro_use] -#[cfg(not(test))] +#[cfg(all(not(test), feature = "wasm_simd128"))] mod simd128; -#[cfg(test)] + +#[cfg(all(test, feature = "wasm_simd128"))] pub mod simd128; -pub use self::simd128::*; +#[cfg(all(test, feature = "wasm_simd128"))] #[cfg(test)] use stdsimd_test::assert_instr; diff --git a/crates/coresimd/Cargo.toml b/crates/coresimd/Cargo.toml index f564ad1388..dac4d916da 100644 --- a/crates/coresimd/Cargo.toml +++ b/crates/coresimd/Cargo.toml @@ -31,3 +31,5 @@ strict = [] # Internal-usage only: enables only those intrinsics supported by Intel's # Software Development Environment (SDE). intel_sde = [] +# Enables wasm simd128 intrinsics +wasm_simd128 = [] diff --git a/crates/stdsimd/Cargo.toml b/crates/stdsimd/Cargo.toml index 4ab553db48..3db3ed1187 100644 --- a/crates/stdsimd/Cargo.toml +++ b/crates/stdsimd/Cargo.toml @@ -37,3 +37,7 @@ path = "../../examples/hex.rs" name = "wasm" crate-type = ["cdylib"] path = "../../examples/wasm.rs" + +[features] +default = [] +wasm_simd128 = ["coresimd/wasm_simd128"] \ No newline at end of file