diff --git a/Cargo.toml b/Cargo.toml index 98c4cd5e4b..e97bf7f363 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,9 @@ [workspace] members = [ "crates/stdsimd-verify", - "crates/stdsimd", + "crates/core_arch", + "crates/std_detect", + "examples/" ] exclude = [ "crates/wasm-assert-instr-tests" diff --git a/README.md b/README.md index e56d4ded7a..1341369245 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ and `libstd`. The easiest way to use it is just to import it via `use std::arch`. The `std::arch` component for `x86` is available in stable Rust. The `std::arch` -components for other architectures and the `std::simd` component require nightly -Rust. +components for other architectures requires nightly Rust. The `std::simd` +component now lives in the +[`packed_simd`](https://github.com/rust-lang-nursery/packed_simd) crate. Using `stdsimd` master branch is not recommended. It requires nightly Rust, it only works with particular Rust nightly versions, and it can (and does) break @@ -21,7 +22,8 @@ often. If you need to use `stdsimd` master branch, you can add it to your ```toml #[dependencies] -stdsimd = { git = "https://github.com/rust-lang-nursery/stdsimd.git" } +core_arch = { git = "https://github.com/rust-lang-nursery/stdsimd.git" } +std_detect = { git = "https://github.com/rust-lang-nursery/stdsimd.git" } ``` # Documentation diff --git a/ci/dox.sh b/ci/dox.sh index e7e8a740a9..1951a7b41b 100755 --- a/ci/dox.sh +++ b/ci/dox.sh @@ -22,15 +22,16 @@ dox() { rm -rf "target/doc/${arch}" mkdir "target/doc/${arch}" - cargo build --verbose --target "${target}" --manifest-path crates/stdsimd/Cargo.toml + cargo build --verbose --target "${target}" --manifest-path crates/core_arch/Cargo.toml + cargo build --verbose --target "${target}" --manifest-path crates/std_detect/Cargo.toml rustdoc --verbose --target "${target}" \ - -o "target/doc/${arch}" crates/coresimd/src/lib.rs \ - --crate-name coresimd \ + -o "target/doc/${arch}" crates/core_arch/src/lib.rs \ + --crate-name core_arch \ --library-path "target/${target}/debug/deps" rustdoc --verbose --target "${target}" \ - -o "target/doc/${arch}" crates/stdsimd/src/lib.rs \ - --crate-name stdsimd \ + -o "target/doc/${arch}" crates/std_detect/src/lib.rs \ + --crate-name std_detect \ --library-path "target/${target}/debug/deps" \ --extern cfg_if="$(ls target/"${target}"/debug/deps/libcfg_if-*.rlib)" \ --extern libc="$(ls target/"${target}"/debug/deps/liblibc-*.rlib)" diff --git a/ci/run.sh b/ci/run.sh index e4ba2b9d2d..d12662ed83 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -60,9 +60,9 @@ cargo_test() { cmd="$cmd ${subcmd} --target=$TARGET $1" if [ "$NOSTD" = "1" ] then - cmd="$cmd -p coresimd" + cmd="$cmd -p core_arch" else - cmd="$cmd -p coresimd -p stdsimd" + cmd="$cmd -p core_arch -p std_detect -p stdsimd_examples" fi cmd="$cmd -- $2" if [ "$NORUN" != "1" ] @@ -109,4 +109,12 @@ case ${TARGET} in ;; *) ;; + esac + +# Test examples +( + cd examples + cargo test + echo test | cargo run --release hex +) diff --git a/coresimd/mod.rs b/coresimd/mod.rs deleted file mode 100644 index 62ffa42f72..0000000000 --- a/coresimd/mod.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! `coresimd` - -#[macro_use] -mod macros; - -mod simd; - -/// Platform dependent vendor intrinsics. -/// -/// This documentation is for the version of this module in the `coresimd` -/// crate, but you probably want to use the [`stdsimd` crate][stdsimd] which -/// should have more complete documentation. -/// -/// [stdsimd]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/index.html -/// -/// Also note that while this module may appear to contains the intrinsics for -/// only one platform it actually contains intrinsics for multiple platforms -/// compiled in conditionally. For other platforms of stdsimd see: -/// -/// * [`x86`] -/// * [`x86_64`] -/// * [`arm`] -/// * [`aarch64`] -/// * [`mips`] -/// * [`mips64`] -/// * [`PowerPC`] -/// * [`PowerPC64`] -/// * [`NVPTX`] -/// * [`wasm32`] -/// -/// [`x86`]: https://rust-lang-nursery.github.io/stdsimd/x86/stdsimd/arch/index.html -/// [`x86_64`]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/index.html -/// [`arm`]: https://rust-lang-nursery.github.io/stdsimd/arm/stdsimd/arch/index.html -/// [`aarch64`]: https://rust-lang-nursery.github.io/stdsimd/aarch64/stdsimd/arch/index.html -/// [`mips`]: https://rust-lang-nursery.github.io/stdsimd/mips/stdsimd/arch/index.html -/// [`mips64`]: https://rust-lang-nursery.github.io/stdsimd/mips64/stdsimd/arch/index.html -/// [`PowerPC`]: https://rust-lang-nursery.github.io/stdsimd/powerpc/stdsimd/arch/index.html -/// [`PowerPC64`]: https://rust-lang-nursery.github.io/stdsimd/powerpc64/stdsimd/arch/index.html -/// [`NVPTX`]: https://rust-lang-nursery.github.io/stdsimd/nvptx/stdsimd/arch/index.html -/// [`wasm32`]: https://rust-lang-nursery.github.io/stdsimd/wasm32/stdsimd/arch/index.html -#[stable(feature = "simd_arch", since = "1.27.0")] -pub mod arch { - /// Platform-specific intrinsics for the `x86` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "x86", dox))] - #[doc(cfg(target_arch = "x86"))] - #[stable(feature = "simd_x86", since = "1.27.0")] - pub mod x86 { - #[stable(feature = "simd_x86", since = "1.27.0")] - pub use coresimd::x86::*; - } - - /// Platform-specific intrinsics for the `x86_64` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "x86_64", dox))] - #[doc(cfg(target_arch = "x86_64"))] - #[stable(feature = "simd_x86", since = "1.27.0")] - pub mod x86_64 { - #[stable(feature = "simd_x86", since = "1.27.0")] - pub use coresimd::x86::*; - #[stable(feature = "simd_x86", since = "1.27.0")] - pub use coresimd::x86_64::*; - } - - /// Platform-specific intrinsics for the `arm` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "arm", dox))] - #[doc(cfg(target_arch = "arm"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod arm { - pub use coresimd::arm::*; - } - - /// Platform-specific intrinsics for the `aarch64` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "aarch64", dox))] - #[doc(cfg(target_arch = "aarch64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod aarch64 { - pub use coresimd::aarch64::*; - pub use coresimd::arm::*; - } - - /// Platform-specific intrinsics for the `wasm32` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "wasm32", dox))] - #[doc(cfg(target_arch = "wasm32"))] - #[stable(feature = "simd_wasm32", since = "1.33.0")] - pub mod wasm32 { - #[stable(feature = "simd_wasm32", since = "1.33.0")] - pub use coresimd::wasm32::*; - } - - /// Platform-specific intrinsics for the `mips` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "mips", dox))] - #[doc(cfg(target_arch = "mips"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod mips { - pub use coresimd::mips::*; - } - - /// Platform-specific intrinsics for the `mips64` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "mips64", dox))] - #[doc(cfg(target_arch = "mips64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod mips64 { - pub use coresimd::mips::*; - } - - /// Platform-specific intrinsics for the `PowerPC` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "powerpc", dox))] - #[doc(cfg(target_arch = "powerpc"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod powerpc { - pub use coresimd::powerpc::*; - } - - /// Platform-specific intrinsics for the `PowerPC64` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "powerpc64", dox))] - #[doc(cfg(target_arch = "powerpc64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod powerpc64 { - pub use coresimd::powerpc64::*; - } - - /// Platform-specific intrinsics for the `NVPTX` platform. - /// - /// See the [module documentation](../index.html) for more details. - #[cfg(any(target_arch = "nvptx", target_arch = "nvptx64", dox))] - #[doc(cfg(any(target_arch = "nvptx", target_arch = "nvptx64")))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod nvptx { - pub use coresimd::nvptx::*; - } -} - -mod simd_llvm; - -#[cfg(any(target_arch = "x86", target_arch = "x86_64", dox))] -#[doc(cfg(any(target_arch = "x86", target_arch = "x86_64")))] -mod x86; -#[cfg(any(target_arch = "x86_64", dox))] -#[doc(cfg(target_arch = "x86_64"))] -mod x86_64; - -#[cfg(any(target_arch = "aarch64", dox))] -#[doc(cfg(target_arch = "aarch64"))] -mod aarch64; -#[cfg(any(target_arch = "arm", target_arch = "aarch64", dox))] -#[doc(cfg(any(target_arch = "arm", target_arch = "aarch64")))] -mod arm; - -#[cfg(any(target_arch = "wasm32", dox))] -#[doc(cfg(target_arch = "wasm32"))] -mod wasm32; - -#[cfg(any(target_arch = "mips", target_arch = "mips64", dox))] -#[doc(cfg(any(target_arch = "mips", target_arch = "mips64")))] -mod mips; - -#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64", dox))] -#[doc(cfg(any(target_arch = "powerpc", target_arch = "powerpc64")))] -mod powerpc; - -#[cfg(any(target_arch = "powerpc64", dox))] -#[doc(cfg(target_arch = "powerpc64"))] -mod powerpc64; - -#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64", dox))] -#[doc(cfg(any(target_arch = "nvptx", target_arch = "nvptx64")))] -mod nvptx; diff --git a/crates/coresimd/Cargo.toml b/crates/core_arch/Cargo.toml similarity index 85% rename from crates/coresimd/Cargo.toml rename to crates/core_arch/Cargo.toml index d96672baf2..09bf17bc61 100644 --- a/crates/coresimd/Cargo.toml +++ b/crates/core_arch/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "coresimd" +name = "core_arch" version = "0.1.3" authors = [ "Alex Crichton ", @@ -7,11 +7,11 @@ authors = [ "Gonzalo Brito Gadeschi ", ] description = "SIMD support in Rust's core library." -documentation = "https://docs.rs/stdsimd" +documentation = "https://docs.rs/core_arch" homepage = "https://github.com/rust-lang-nursery/stdsimd" repository = "https://github.com/rust-lang-nursery/stdsimd" readme = "README.md" -keywords = ["core", "simd", "intrinsics"] +keywords = ["core", "simd", "arch", "intrinsics"] categories = ["hardware-support", "no-std"] license = "MIT/Apache-2.0" @@ -24,7 +24,7 @@ maintenance = { status = "experimental" } [dev-dependencies] stdsimd-test = { version = "0.*", path = "../stdsimd-test" } -stdsimd = { version = "0.1.3", path = "../stdsimd" } +std_detect = { version = "0.1.3", path = "../std_detect" } [target.wasm32-unknown-unknown.dev-dependencies] wasm-bindgen-test = "=0.2.19" diff --git a/crates/coresimd/build.rs b/crates/core_arch/build.rs similarity index 100% rename from crates/coresimd/build.rs rename to crates/core_arch/build.rs diff --git a/crates/coresimd/foo.wasm b/crates/core_arch/foo.wasm similarity index 100% rename from crates/coresimd/foo.wasm rename to crates/core_arch/foo.wasm diff --git a/coresimd/aarch64/crc.rs b/crates/core_arch/src/aarch64/crc.rs similarity index 98% rename from coresimd/aarch64/crc.rs rename to crates/core_arch/src/aarch64/crc.rs index 6d6e299148..f43b163678 100644 --- a/coresimd/aarch64/crc.rs +++ b/crates/core_arch/src/aarch64/crc.rs @@ -87,8 +87,8 @@ pub unsafe fn __crc32cd(crc: u32, data: u64) -> u32 { #[cfg(test)] mod tests { - use coresimd::aarch64::*; - use coresimd::simd::*; + use core_arch::aarch64::*; + use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/aarch64/crypto.rs b/crates/core_arch/src/aarch64/crypto.rs similarity index 98% rename from coresimd/aarch64/crypto.rs rename to crates/core_arch/src/aarch64/crypto.rs index 940470cc99..1676d37901 100644 --- a/coresimd/aarch64/crypto.rs +++ b/crates/core_arch/src/aarch64/crypto.rs @@ -1,5 +1,5 @@ -use coresimd::arm::uint32x4_t; -use coresimd::arm::uint8x16_t; +use core_arch::arm::uint32x4_t; +use core_arch::arm::uint8x16_t; #[allow(improper_ctypes)] extern "C" { @@ -164,8 +164,8 @@ pub unsafe fn vsha256su1q_u32( #[cfg(test)] mod tests { - use coresimd::aarch64::*; - use coresimd::simd::*; + use core_arch::aarch64::*; + use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/aarch64/mod.rs b/crates/core_arch/src/aarch64/mod.rs similarity index 100% rename from coresimd/aarch64/mod.rs rename to crates/core_arch/src/aarch64/mod.rs diff --git a/coresimd/aarch64/neon.rs b/crates/core_arch/src/aarch64/neon.rs similarity index 99% rename from coresimd/aarch64/neon.rs rename to crates/core_arch/src/aarch64/neon.rs index ac0144f4cd..0c43810dfa 100644 --- a/coresimd/aarch64/neon.rs +++ b/crates/core_arch/src/aarch64/neon.rs @@ -4,8 +4,8 @@ // FIXME: replace neon with asimd -use coresimd::arm::*; -use coresimd::simd_llvm::*; +use core_arch::arm::*; +use core_arch::simd_llvm::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -894,7 +894,7 @@ pub unsafe fn vtbl4_p8(a: poly8x8x4_t, b: uint8x8_t) -> poly8x8_t { #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx1_s8(a: int8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t { - use coresimd::simd::i8x8; + use core_arch::simd::i8x8; let r = vqtbx1_s8(a, vcombine_s8(b, ::mem::zeroed()), ::mem::transmute(c)); let m: int8x8_t = simd_lt(c, ::mem::transmute(i8x8::splat(8))); simd_select(m, r, a) @@ -906,7 +906,7 @@ pub unsafe fn vtbx1_s8(a: int8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t { #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx1_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t { - use coresimd::simd::u8x8; + use core_arch::simd::u8x8; let r = vqtbx1_u8(a, vcombine_u8(b, ::mem::zeroed()), c); let m: int8x8_t = simd_lt(c, ::mem::transmute(u8x8::splat(8))); simd_select(m, r, a) @@ -918,7 +918,7 @@ pub unsafe fn vtbx1_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t { #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx1_p8(a: poly8x8_t, b: poly8x8_t, c: uint8x8_t) -> poly8x8_t { - use coresimd::simd::u8x8; + use core_arch::simd::u8x8; let r = vqtbx1_p8(a, vcombine_p8(b, ::mem::zeroed()), c); let m: int8x8_t = simd_lt(c, ::mem::transmute(u8x8::splat(8))); simd_select(m, r, a) @@ -957,7 +957,7 @@ pub unsafe fn vtbx2_p8(a: poly8x8_t, b: poly8x8x2_t, c: uint8x8_t) -> poly8x8_t #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx3_s8(a: int8x8_t, b: int8x8x3_t, c: int8x8_t) -> int8x8_t { - use coresimd::simd::i8x8; + use core_arch::simd::i8x8; let r = vqtbx2_s8( a, int8x16x2_t(vcombine_s8(b.0, b.1), vcombine_s8(b.2, ::mem::zeroed())), @@ -973,7 +973,7 @@ pub unsafe fn vtbx3_s8(a: int8x8_t, b: int8x8x3_t, c: int8x8_t) -> int8x8_t { #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx3_u8(a: uint8x8_t, b: uint8x8x3_t, c: uint8x8_t) -> uint8x8_t { - use coresimd::simd::u8x8; + use core_arch::simd::u8x8; let r = vqtbx2_u8( a, uint8x16x2_t(vcombine_u8(b.0, b.1), vcombine_u8(b.2, ::mem::zeroed())), @@ -989,7 +989,7 @@ pub unsafe fn vtbx3_u8(a: uint8x8_t, b: uint8x8x3_t, c: uint8x8_t) -> uint8x8_t #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(tbx))] pub unsafe fn vtbx3_p8(a: poly8x8_t, b: poly8x8x3_t, c: uint8x8_t) -> poly8x8_t { - use coresimd::simd::u8x8; + use core_arch::simd::u8x8; let r = vqtbx2_p8( a, poly8x16x2_t(vcombine_p8(b.0, b.1), vcombine_p8(b.2, ::mem::zeroed())), @@ -1576,8 +1576,8 @@ pub unsafe fn vqtbx4q_p8(a: poly8x16_t, t: poly8x16x4_t, idx: uint8x16_t) -> pol #[cfg(test)] mod tests { - use coresimd::aarch64::*; - use coresimd::simd::*; + use core_arch::aarch64::*; + use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/aarch64/v8.rs b/crates/core_arch/src/aarch64/v8.rs similarity index 98% rename from coresimd/aarch64/v8.rs rename to crates/core_arch/src/aarch64/v8.rs index b537df9a3c..fdc9e78aac 100644 --- a/coresimd/aarch64/v8.rs +++ b/crates/core_arch/src/aarch64/v8.rs @@ -52,7 +52,7 @@ pub unsafe fn _cls_u64(x: u64) -> u64 { #[cfg(test)] mod tests { - use coresimd::aarch64::v8; + use core_arch::aarch64::v8; #[test] fn _rev_u64() { diff --git a/coresimd/arm/armclang.rs b/crates/core_arch/src/arm/armclang.rs similarity index 100% rename from coresimd/arm/armclang.rs rename to crates/core_arch/src/arm/armclang.rs diff --git a/coresimd/arm/cmsis.rs b/crates/core_arch/src/arm/cmsis.rs similarity index 100% rename from coresimd/arm/cmsis.rs rename to crates/core_arch/src/arm/cmsis.rs diff --git a/coresimd/arm/dsp.rs b/crates/core_arch/src/arm/dsp.rs similarity index 99% rename from coresimd/arm/dsp.rs rename to crates/core_arch/src/arm/dsp.rs index 7ac4708202..8385e7ed21 100644 --- a/coresimd/arm/dsp.rs +++ b/crates/core_arch/src/arm/dsp.rs @@ -392,8 +392,8 @@ pub unsafe fn usad8a(a: int8x4_t, b: int8x4_t, c: u32) -> u32 { #[cfg(test)] mod tests { - use coresimd::arm::*; - use coresimd::simd::*; + use core_arch::arm::*; + use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/arm/mod.rs b/crates/core_arch/src/arm/mod.rs similarity index 100% rename from coresimd/arm/mod.rs rename to crates/core_arch/src/arm/mod.rs diff --git a/coresimd/arm/neon.rs b/crates/core_arch/src/arm/neon.rs similarity index 99% rename from coresimd/arm/neon.rs rename to crates/core_arch/src/arm/neon.rs index 99f31be8b9..799f2a14ee 100644 --- a/coresimd/arm/neon.rs +++ b/crates/core_arch/src/arm/neon.rs @@ -1,6 +1,6 @@ //! ARMv7 NEON intrinsics -use coresimd::simd_llvm::*; +use core_arch::simd_llvm::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -992,8 +992,8 @@ pub unsafe fn vtbx4_p8(a: poly8x8_t, b: poly8x8x4_t, c: uint8x8_t) -> poly8x8_t #[cfg(test)] mod tests { - use coresimd::arm::*; - use coresimd::simd::*; + use core_arch::arm::*; + use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/arm/table_lookup_tests.rs b/crates/core_arch/src/arm/table_lookup_tests.rs similarity index 99% rename from coresimd/arm/table_lookup_tests.rs rename to crates/core_arch/src/arm/table_lookup_tests.rs index 936fea5b89..4d0c21ee01 100644 --- a/coresimd/arm/table_lookup_tests.rs +++ b/crates/core_arch/src/arm/table_lookup_tests.rs @@ -5,12 +5,12 @@ use super::*; #[cfg(target_arch = "aarch64")] -use coresimd::aarch64::*; +use core_arch::aarch64::*; #[cfg(target_arch = "arm")] -use coresimd::arm::*; +use core_arch::arm::*; -use coresimd::simd::*; +use core_arch::simd::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/arm/v6.rs b/crates/core_arch/src/arm/v6.rs similarity index 97% rename from coresimd/arm/v6.rs rename to crates/core_arch/src/arm/v6.rs index e8bc887eff..c24c40f963 100644 --- a/coresimd/arm/v6.rs +++ b/crates/core_arch/src/arm/v6.rs @@ -25,7 +25,7 @@ pub unsafe fn _rev_u32(x: u32) -> u32 { #[cfg(test)] mod tests { - use coresimd::arm::v6; + use core_arch::arm::v6; #[test] fn _rev_u16() { diff --git a/coresimd/arm/v7.rs b/crates/core_arch/src/arm/v7.rs similarity index 98% rename from coresimd/arm/v7.rs rename to crates/core_arch/src/arm/v7.rs index aefd7c7465..608907ce81 100644 --- a/coresimd/arm/v7.rs +++ b/crates/core_arch/src/arm/v7.rs @@ -53,7 +53,7 @@ pub unsafe fn _rbit_u32(x: u32) -> u32 { #[cfg(test)] mod tests { - use coresimd::arm::v7; + use core_arch::arm::v7; #[test] fn _clz_u8() { diff --git a/crates/coresimd/src/lib.rs b/crates/core_arch/src/lib.rs similarity index 88% rename from crates/coresimd/src/lib.rs rename to crates/core_arch/src/lib.rs index fdb4fb277d..f179dbde8a 100644 --- a/crates/coresimd/src/lib.rs +++ b/crates/core_arch/src/lib.rs @@ -1,10 +1,4 @@ -//! SIMD and vendor intrinsics support library. -//! -//! This documentation is for the `coresimd` crate, but you probably want to -//! use the [`stdsimd` crate][stdsimd] which should have more complete -//! documentation. -//! -//! [stdsimd]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/ +//! Architecture-specific intrinsics. #![cfg_attr(stdsimd_strict, deny(warnings))] #![allow(dead_code)] @@ -85,7 +79,7 @@ extern crate core as _core; extern crate std; #[cfg(test)] #[macro_use] -extern crate stdsimd; +extern crate std_detect; #[cfg(test)] extern crate stdsimd_test; #[cfg(test)] @@ -94,10 +88,10 @@ extern crate test; #[cfg(all(test, target_arch = "wasm32"))] extern crate wasm_bindgen_test; -#[path = "../../../coresimd/mod.rs"] -mod coresimd; +#[path = "mod.rs"] +mod core_arch; -pub use coresimd::arch; +pub use core_arch::arch; #[allow(unused_imports)] use _core::clone; diff --git a/coresimd/macros.rs b/crates/core_arch/src/macros.rs similarity index 100% rename from coresimd/macros.rs rename to crates/core_arch/src/macros.rs diff --git a/coresimd/mips/mod.rs b/crates/core_arch/src/mips/mod.rs similarity index 100% rename from coresimd/mips/mod.rs rename to crates/core_arch/src/mips/mod.rs diff --git a/coresimd/mips/msa.rs b/crates/core_arch/src/mips/msa.rs similarity index 97% rename from coresimd/mips/msa.rs rename to crates/core_arch/src/mips/msa.rs index 1190450844..6e1d6c3cff 100644 --- a/coresimd/mips/msa.rs +++ b/crates/core_arch/src/mips/msa.rs @@ -35,7 +35,7 @@ pub unsafe fn __msa_add_a_b(a: i8x16, b: i8x16) -> i8x16 { #[cfg(test)] mod tests { - use coresimd::mips64::msa; + use core_arch::mips64::msa; use simd::*; use stdsimd_test::simd_test; diff --git a/stdsimd/mod.rs b/crates/core_arch/src/mod.rs similarity index 75% rename from stdsimd/mod.rs rename to crates/core_arch/src/mod.rs index 7ed8bc5ba8..f6f986b957 100644 --- a/stdsimd/mod.rs +++ b/crates/core_arch/src/mod.rs @@ -1,4 +1,9 @@ -//! `stdsimd` +//! `core_arch` + +#[macro_use] +mod macros; + +mod simd; /// SIMD and vendor intrinsics module. /// @@ -212,10 +217,10 @@ /// AVX2 and also for the default platform. /// /// ```rust -/// # #![cfg_attr(not(dox),feature(cfg_target_feature, target_feature, stdsimd))] +/// # #![cfg_attr(not(dox),feature(stdsimd))] /// # #[cfg(not(dox))] -/// # #[macro_use] -/// # extern crate stdsimd; +/// # #[macro_use(is_x86_feature_detected)] +/// # extern crate std_detect; /// /// fn main() { /// let mut dst = [0]; @@ -253,13 +258,15 @@ /// we'll be using SSE4.1 features to implement hex encoding. /// /// ``` -/// # #![cfg_attr(not(dox),feature(cfg_target_feature, target_feature, stdsimd))] +/// # #![cfg_attr(not(dox),feature(stdsimd))] /// # #![cfg_attr(not(dox), no_std)] /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] -/// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate core_arch as std; +/// # #[cfg(not(dox))] +/// # #[macro_use(is_x86_feature_detected)] +/// # extern crate std_detect; /// /// fn main() { /// let mut dst = [0; 32]; @@ -355,167 +362,145 @@ /// ``` #[stable(feature = "simd_arch", since = "1.27.0")] pub mod arch { - #[cfg(all(not(dox), target_arch = "x86"))] - #[stable(feature = "simd_x86", since = "1.27.0")] - pub use coresimd::arch::x86; - - #[cfg(all(not(dox), target_arch = "x86_64"))] - #[stable(feature = "simd_x86", since = "1.27.0")] - pub use coresimd::arch::x86_64; - - #[cfg(all(not(dox), target_arch = "arm"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::arm; - - #[cfg(all(not(dox), target_arch = "aarch64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::aarch64; - - #[cfg(all(not(dox), target_arch = "mips"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::mips; - - #[cfg(all(not(dox), target_arch = "mips64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::mips64; - - #[cfg(all(not(dox), target_arch = "powerpc"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::powerpc; - - #[cfg(all(not(dox), target_arch = "powerpc64"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::powerpc64; - - #[cfg(all(not(dox), any(target_arch = "nvptx", target_arch = "nvptx64")))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::nvptx; - - #[cfg(all(not(dox), target_arch = "wasm32"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub use coresimd::arch::wasm32; - - #[doc(hidden)] // unstable implementation detail - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod detect; - /// Platform-specific intrinsics for the `x86` platform. /// - /// The documentation with the full listing of `x86` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/x86/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "x86", dox))] #[doc(cfg(target_arch = "x86"))] #[stable(feature = "simd_x86", since = "1.27.0")] - pub mod x86 {} + pub mod x86 { + #[stable(feature = "simd_x86", since = "1.27.0")] + pub use core_arch::x86::*; + } /// Platform-specific intrinsics for the `x86_64` platform. /// - /// The documentation with the full listing of `x86_64` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/x86_64/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "x86_64", dox))] #[doc(cfg(target_arch = "x86_64"))] #[stable(feature = "simd_x86", since = "1.27.0")] - pub mod x86_64 {} + pub mod x86_64 { + #[stable(feature = "simd_x86", since = "1.27.0")] + pub use core_arch::x86::*; + #[stable(feature = "simd_x86", since = "1.27.0")] + pub use core_arch::x86_64::*; + } /// Platform-specific intrinsics for the `arm` platform. /// - /// The documentation with the full listing of `arm` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/arm/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "arm", dox))] #[doc(cfg(target_arch = "arm"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod arm {} + pub mod arm { + pub use core_arch::arm::*; + } /// Platform-specific intrinsics for the `aarch64` platform. /// - /// The documentation with the full listing of `aarch64` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/aarch64/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "aarch64", dox))] #[doc(cfg(target_arch = "aarch64"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod aarch64 {} + pub mod aarch64 { + pub use core_arch::aarch64::*; + pub use core_arch::arm::*; + } - /// Platform-specific intrinsics for the `mips` platform. + /// Platform-specific intrinsics for the `wasm32` platform. /// - /// The documentation with the full listing of `mips` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "wasm32", dox))] + #[doc(cfg(target_arch = "wasm32"))] + #[stable(feature = "simd_wasm32", since = "1.33.0")] + pub mod wasm32 { + #[stable(feature = "simd_wasm32", since = "1.33.0")] + pub use core_arch::wasm32::*; + } + + /// Platform-specific intrinsics for the `mips` platform. /// - /// [libcore]: ../../../core/arch/mips/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "mips", dox))] #[doc(cfg(target_arch = "mips"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod mips {} + pub mod mips { + pub use core_arch::mips::*; + } /// Platform-specific intrinsics for the `mips64` platform. /// - /// The documentation with the full listing of `mips64` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/mips64/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "mips64", dox))] #[doc(cfg(target_arch = "mips64"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod mips64 {} + pub mod mips64 { + pub use core_arch::mips::*; + } - /// Platform-specific intrinsics for the `powerpc` platform. - /// - /// The documentation with the full listing of `powerpc` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. + /// Platform-specific intrinsics for the `PowerPC` platform. /// - /// [libcore]: ../../../core/arch/powerpc/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "powerpc", dox))] #[doc(cfg(target_arch = "powerpc"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod powerpc {} + pub mod powerpc { + pub use core_arch::powerpc::*; + } - /// Platform-specific intrinsics for the `powerpc64` platform. + /// Platform-specific intrinsics for the `PowerPC64` platform. /// - /// The documentation with the full listing of `powerpc64` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/powerpc64/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "powerpc64", dox))] #[doc(cfg(target_arch = "powerpc64"))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod powerpc64 {} + pub mod powerpc64 { + pub use core_arch::powerpc64::*; + } - /// Platform-specific intrinsics for the `nvptx` platform. - /// - /// The documentation with the full listing of `nvptx` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. + /// Platform-specific intrinsics for the `NVPTX` platform. /// - /// [libcore]: ../../../core/arch/nvptx/index.html - #[cfg(dox)] + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "nvptx", target_arch = "nvptx64", dox))] #[doc(cfg(any(target_arch = "nvptx", target_arch = "nvptx64")))] #[unstable(feature = "stdsimd", issue = "27731")] - pub mod nvptx {} - - /// Platform-specific intrinsics for the `wasm32` platform. - /// - /// The documentation with the full listing of `wasm32` intrinsics is - /// available in [libcore], but the module is re-exported here in std - /// as well. - /// - /// [libcore]: ../../../core/arch/wasm32/index.html - #[cfg(dox)] - #[doc(cfg(target_arch = "wasm32"))] - #[unstable(feature = "stdsimd", issue = "27731")] - pub mod wasm32 {} + pub mod nvptx { + pub use core_arch::nvptx::*; + } } + +mod simd_llvm; + +#[cfg(any(target_arch = "x86", target_arch = "x86_64", dox))] +#[doc(cfg(any(target_arch = "x86", target_arch = "x86_64")))] +mod x86; +#[cfg(any(target_arch = "x86_64", dox))] +#[doc(cfg(target_arch = "x86_64"))] +mod x86_64; + +#[cfg(any(target_arch = "aarch64", dox))] +#[doc(cfg(target_arch = "aarch64"))] +mod aarch64; +#[cfg(any(target_arch = "arm", target_arch = "aarch64", dox))] +#[doc(cfg(any(target_arch = "arm", target_arch = "aarch64")))] +mod arm; + +#[cfg(any(target_arch = "wasm32", dox))] +#[doc(cfg(target_arch = "wasm32"))] +mod wasm32; + +#[cfg(any(target_arch = "mips", target_arch = "mips64", dox))] +#[doc(cfg(any(target_arch = "mips", target_arch = "mips64")))] +mod mips; + +#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64", dox))] +#[doc(cfg(any(target_arch = "powerpc", target_arch = "powerpc64")))] +mod powerpc; + +#[cfg(any(target_arch = "powerpc64", dox))] +#[doc(cfg(target_arch = "powerpc64"))] +mod powerpc64; + +#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64", dox))] +#[doc(cfg(any(target_arch = "nvptx", target_arch = "nvptx64")))] +mod nvptx; diff --git a/coresimd/nvptx/mod.rs b/crates/core_arch/src/nvptx/mod.rs similarity index 100% rename from coresimd/nvptx/mod.rs rename to crates/core_arch/src/nvptx/mod.rs diff --git a/coresimd/powerpc/altivec.rs b/crates/core_arch/src/powerpc/altivec.rs similarity index 99% rename from coresimd/powerpc/altivec.rs rename to crates/core_arch/src/powerpc/altivec.rs index bcdd843104..409b92d902 100644 --- a/coresimd/powerpc/altivec.rs +++ b/crates/core_arch/src/powerpc/altivec.rs @@ -13,8 +13,8 @@ #![allow(non_camel_case_types)] -use coresimd::simd::*; -use coresimd::simd_llvm::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; use mem; @@ -1027,12 +1027,12 @@ pub use self::endian::*; #[cfg(test)] mod tests { #[cfg(target_arch = "powerpc")] - use coresimd::arch::powerpc::*; + use core_arch::arch::powerpc::*; #[cfg(target_arch = "powerpc64")] - use coresimd::arch::powerpc64::*; + use core_arch::arch::powerpc64::*; - use coresimd::simd::*; + use core_arch::simd::*; use stdsimd_test::simd_test; macro_rules! test_vec_perm { diff --git a/coresimd/powerpc/mod.rs b/crates/core_arch/src/powerpc/mod.rs similarity index 100% rename from coresimd/powerpc/mod.rs rename to crates/core_arch/src/powerpc/mod.rs diff --git a/coresimd/powerpc/vsx.rs b/crates/core_arch/src/powerpc/vsx.rs similarity index 96% rename from coresimd/powerpc/vsx.rs rename to crates/core_arch/src/powerpc/vsx.rs index 56faf07950..e6d3798407 100644 --- a/coresimd/powerpc/vsx.rs +++ b/crates/core_arch/src/powerpc/vsx.rs @@ -8,7 +8,7 @@ #![allow(non_camel_case_types)] -use coresimd::simd_llvm::*; +use core_arch::simd_llvm::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -34,7 +34,7 @@ types! { mod sealed { use super::*; - use coresimd::simd::*; + use core_arch::simd::*; pub trait VectorPermDI { unsafe fn vec_xxpermdi(self, b: Self, dm: u8) -> Self; @@ -86,12 +86,12 @@ where #[cfg(test)] mod tests { #[cfg(target_arch = "powerpc")] - use coresimd::arch::powerpc::*; + use core_arch::arch::powerpc::*; #[cfg(target_arch = "powerpc64")] - use coresimd::arch::powerpc64::*; + use core_arch::arch::powerpc64::*; - use coresimd::simd::*; + use core_arch::simd::*; use stdsimd_test::simd_test; macro_rules! test_vec_xxpermdi { diff --git a/coresimd/powerpc64/mod.rs b/crates/core_arch/src/powerpc64/mod.rs similarity index 89% rename from coresimd/powerpc64/mod.rs rename to crates/core_arch/src/powerpc64/mod.rs index 19148ca366..2e5c329fc7 100644 --- a/coresimd/powerpc64/mod.rs +++ b/crates/core_arch/src/powerpc64/mod.rs @@ -5,4 +5,4 @@ //! //! [64-Bit ELF V2 ABI Specification - Power Architecture]: http://openpowerfoundation.org/wp-content/uploads/resources/leabi/leabi-20170510.pdf -pub use coresimd::powerpc::*; +pub use core_arch::powerpc::*; diff --git a/coresimd/simd.rs b/crates/core_arch/src/simd.rs similarity index 97% rename from coresimd/simd.rs rename to crates/core_arch/src/simd.rs index 144050f01e..468b1e380b 100644 --- a/coresimd/simd.rs +++ b/crates/core_arch/src/simd.rs @@ -27,7 +27,7 @@ macro_rules! simd_ty { #[inline] pub(crate) fn extract(self, index: usize) -> $ety { unsafe { - ::coresimd::simd_llvm::simd_extract(self, index as u32) + ::core_arch::simd_llvm::simd_extract(self, index as u32) } } } @@ -63,7 +63,7 @@ macro_rules! simd_m_ty { #[inline] pub(crate) fn extract(self, index: usize) -> bool { let r: $ety = unsafe { - ::coresimd::simd_llvm::simd_extract(self, index as u32) + ::core_arch::simd_llvm::simd_extract(self, index as u32) }; r != 0 } diff --git a/coresimd/simd_llvm.rs b/crates/core_arch/src/simd_llvm.rs similarity index 100% rename from coresimd/simd_llvm.rs rename to crates/core_arch/src/simd_llvm.rs diff --git a/coresimd/v64.rs b/crates/core_arch/src/v64.rs similarity index 98% rename from coresimd/v64.rs rename to crates/core_arch/src/v64.rs index 04ce0768b7..724f1fb0c4 100644 --- a/coresimd/v64.rs +++ b/crates/core_arch/src/v64.rs @@ -2,7 +2,7 @@ use prelude::v1::*; -use coresimd::simd_llvm::*; +use core_arch::simd_llvm::*; define_ty_doc! { f32x2, f32, f32 | diff --git a/coresimd/wasm32/atomic.rs b/crates/core_arch/src/wasm32/atomic.rs similarity index 100% rename from coresimd/wasm32/atomic.rs rename to crates/core_arch/src/wasm32/atomic.rs diff --git a/coresimd/wasm32/memory.rs b/crates/core_arch/src/wasm32/memory.rs similarity index 100% rename from coresimd/wasm32/memory.rs rename to crates/core_arch/src/wasm32/memory.rs diff --git a/coresimd/wasm32/mod.rs b/crates/core_arch/src/wasm32/mod.rs similarity index 100% rename from coresimd/wasm32/mod.rs rename to crates/core_arch/src/wasm32/mod.rs diff --git a/coresimd/wasm32/simd128.rs b/crates/core_arch/src/wasm32/simd128.rs similarity index 99% rename from coresimd/wasm32/simd128.rs rename to crates/core_arch/src/wasm32/simd128.rs index 9ae24aaa4f..5723abab69 100644 --- a/coresimd/wasm32/simd128.rs +++ b/crates/core_arch/src/wasm32/simd128.rs @@ -5,8 +5,8 @@ #![allow(non_camel_case_types)] -use coresimd::simd::*; -use coresimd::simd_llvm::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; use marker::Sized; use mem; use ptr; diff --git a/coresimd/x86/abm.rs b/crates/core_arch/src/x86/abm.rs similarity index 98% rename from coresimd/x86/abm.rs rename to crates/core_arch/src/x86/abm.rs index 51157ab773..b763902211 100644 --- a/coresimd/x86/abm.rs +++ b/crates/core_arch/src/x86/abm.rs @@ -48,7 +48,7 @@ pub unsafe fn _popcnt32(x: i32) -> i32 { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "lzcnt")] unsafe fn test_lzcnt_u32() { diff --git a/coresimd/x86/adx.rs b/crates/core_arch/src/x86/adx.rs similarity index 100% rename from coresimd/x86/adx.rs rename to crates/core_arch/src/x86/adx.rs diff --git a/coresimd/x86/aes.rs b/crates/core_arch/src/x86/aes.rs similarity index 99% rename from coresimd/x86/aes.rs rename to crates/core_arch/src/x86/aes.rs index 6a6e30c3d1..c90bb122d5 100644 --- a/coresimd/x86/aes.rs +++ b/crates/core_arch/src/x86/aes.rs @@ -7,7 +7,7 @@ //! //! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf -use coresimd::x86::__m128i; +use core_arch::x86::__m128i; #[cfg(test)] use stdsimd_test::assert_instr; @@ -113,7 +113,7 @@ mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "aes")] unsafe fn test_mm_aesdec_si128() { diff --git a/coresimd/x86/avx.rs b/crates/core_arch/src/x86/avx.rs similarity index 99% rename from coresimd/x86/avx.rs rename to crates/core_arch/src/x86/avx.rs index ed871abaea..9a350f6eab 100644 --- a/coresimd/x86/avx.rs +++ b/crates/core_arch/src/x86/avx.rs @@ -13,9 +13,9 @@ //! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf //! [wiki]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use intrinsics; use mem; use ptr; @@ -3313,7 +3313,7 @@ mod tests { use stdsimd_test::simd_test; use test::black_box; // Used to inhibit constant-folding. - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "avx")] unsafe fn test_mm256_add_pd() { diff --git a/coresimd/x86/avx2.rs b/crates/core_arch/src/x86/avx2.rs similarity index 99% rename from coresimd/x86/avx2.rs rename to crates/core_arch/src/x86/avx2.rs index b0cff8e875..bc4d0e12f5 100644 --- a/coresimd/x86/avx2.rs +++ b/crates/core_arch/src/x86/avx2.rs @@ -18,9 +18,9 @@ //! [wiki_avx]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions //! [wiki_fma]: https://en.wikipedia.org/wiki/Fused_multiply-accumulate -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -2636,7 +2636,7 @@ pub unsafe fn _mm256_shuffle_epi8(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3388,7 +3388,7 @@ pub unsafe fn _mm256_subs_epu8(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3448,7 +3448,7 @@ pub unsafe fn _mm256_unpackhi_epi8(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3507,7 +3507,7 @@ pub unsafe fn _mm256_unpacklo_epi8(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3560,7 +3560,7 @@ pub unsafe fn _mm256_unpackhi_epi16(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3614,7 +3614,7 @@ pub unsafe fn _mm256_unpacklo_epi16(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3657,7 +3657,7 @@ pub unsafe fn _mm256_unpackhi_epi32(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3700,7 +3700,7 @@ pub unsafe fn _mm256_unpacklo_epi32(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -3743,7 +3743,7 @@ pub unsafe fn _mm256_unpackhi_epi64(a: __m256i, b: __m256i) -> __m256i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -4113,7 +4113,7 @@ mod tests { use std; use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "avx2")] unsafe fn test_mm256_abs_epi32() { diff --git a/coresimd/x86/avx512f.rs b/crates/core_arch/src/x86/avx512f.rs similarity index 98% rename from coresimd/x86/avx512f.rs rename to crates/core_arch/src/x86/avx512f.rs index c240a67af3..94efadac74 100644 --- a/coresimd/x86/avx512f.rs +++ b/crates/core_arch/src/x86/avx512f.rs @@ -1,6 +1,6 @@ -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use mem::{self, MaybeUninit}; #[cfg(test)] @@ -92,7 +92,7 @@ mod tests { use std; use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "avx512f")] unsafe fn test_mm512_abs_epi32() { diff --git a/coresimd/x86/bmi1.rs b/crates/core_arch/src/x86/bmi1.rs similarity index 99% rename from coresimd/x86/bmi1.rs rename to crates/core_arch/src/x86/bmi1.rs index a84763b7e8..ece4d76dc3 100644 --- a/coresimd/x86/bmi1.rs +++ b/crates/core_arch/src/x86/bmi1.rs @@ -120,7 +120,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "bmi1")] unsafe fn test_bextr_u32() { diff --git a/coresimd/x86/bmi2.rs b/crates/core_arch/src/x86/bmi2.rs similarity index 99% rename from coresimd/x86/bmi2.rs rename to crates/core_arch/src/x86/bmi2.rs index e808fe0792..ab8cab3138 100644 --- a/coresimd/x86/bmi2.rs +++ b/crates/core_arch/src/x86/bmi2.rs @@ -79,7 +79,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "bmi2")] unsafe fn test_pext_u32() { diff --git a/coresimd/x86/bswap.rs b/crates/core_arch/src/x86/bswap.rs similarity index 100% rename from coresimd/x86/bswap.rs rename to crates/core_arch/src/x86/bswap.rs diff --git a/coresimd/x86/cpuid.rs b/crates/core_arch/src/x86/cpuid.rs similarity index 99% rename from coresimd/x86/cpuid.rs rename to crates/core_arch/src/x86/cpuid.rs index f22e451566..adf3e127d6 100644 --- a/coresimd/x86/cpuid.rs +++ b/crates/core_arch/src/x86/cpuid.rs @@ -171,7 +171,7 @@ pub unsafe fn __get_cpuid_max(leaf: u32) -> (u32, u32) { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; #[test] fn test_always_has_cpuid() { diff --git a/coresimd/x86/eflags.rs b/crates/core_arch/src/x86/eflags.rs similarity index 98% rename from coresimd/x86/eflags.rs rename to crates/core_arch/src/x86/eflags.rs index 264b9b2363..68c0b6ee84 100644 --- a/coresimd/x86/eflags.rs +++ b/crates/core_arch/src/x86/eflags.rs @@ -66,7 +66,7 @@ pub unsafe fn __writeeflags(eflags: u64) { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; #[test] #[allow(deprecated)] diff --git a/coresimd/x86/fma.rs b/crates/core_arch/src/x86/fma.rs similarity index 99% rename from coresimd/x86/fma.rs rename to crates/core_arch/src/x86/fma.rs index a5f2c09ed7..4915c44f57 100644 --- a/coresimd/x86/fma.rs +++ b/crates/core_arch/src/x86/fma.rs @@ -18,7 +18,7 @@ //! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf //! [wiki_fma]: https://en.wikipedia.org/wiki/Fused_multiply-accumulate -use coresimd::x86::*; +use core_arch::x86::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -510,7 +510,7 @@ mod tests { use std; use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "fma")] unsafe fn test_mm_fmadd_pd() { diff --git a/coresimd/x86/fxsr.rs b/crates/core_arch/src/x86/fxsr.rs similarity index 99% rename from coresimd/x86/fxsr.rs rename to crates/core_arch/src/x86/fxsr.rs index 91261c721c..df511972db 100644 --- a/coresimd/x86/fxsr.rs +++ b/crates/core_arch/src/x86/fxsr.rs @@ -57,7 +57,7 @@ pub unsafe fn _fxrstor(mem_addr: *const u8) { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; use std::{cmp::PartialEq, fmt}; use stdsimd_test::simd_test; diff --git a/coresimd/x86/macros.rs b/crates/core_arch/src/x86/macros.rs similarity index 100% rename from coresimd/x86/macros.rs rename to crates/core_arch/src/x86/macros.rs diff --git a/coresimd/x86/mmx.rs b/crates/core_arch/src/x86/mmx.rs similarity index 99% rename from coresimd/x86/mmx.rs rename to crates/core_arch/src/x86/mmx.rs index eaaecfa038..82f085cf95 100644 --- a/coresimd/x86/mmx.rs +++ b/crates/core_arch/src/x86/mmx.rs @@ -8,8 +8,8 @@ //! //! [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf -use coresimd::simd::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -530,7 +530,7 @@ extern "C" { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; use stdsimd_test::simd_test; #[simd_test(enable = "mmx")] diff --git a/coresimd/x86/mod.rs b/crates/core_arch/src/x86/mod.rs similarity index 91% rename from coresimd/x86/mod.rs rename to crates/core_arch/src/x86/mod.rs index e490c9442d..ee7c5219fe 100644 --- a/coresimd/x86/mod.rs +++ b/crates/core_arch/src/x86/mod.rs @@ -38,8 +38,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -88,8 +89,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -132,8 +134,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -176,8 +179,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -224,8 +228,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -268,8 +273,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -312,8 +318,9 @@ types! { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] - /// # #[macro_use] - /// # extern crate stdsimd as std; + /// # extern crate core_arch as std; + /// # #[macro_use(is_x86_feature_detected)] + /// # extern crate std_detect; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -406,42 +413,42 @@ pub(crate) trait m128iExt: Sized { fn as_m128i(self) -> __m128i; #[inline] - fn as_u8x16(self) -> ::coresimd::simd::u8x16 { + fn as_u8x16(self) -> ::core_arch::simd::u8x16 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_u16x8(self) -> ::coresimd::simd::u16x8 { + fn as_u16x8(self) -> ::core_arch::simd::u16x8 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_u32x4(self) -> ::coresimd::simd::u32x4 { + fn as_u32x4(self) -> ::core_arch::simd::u32x4 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_u64x2(self) -> ::coresimd::simd::u64x2 { + fn as_u64x2(self) -> ::core_arch::simd::u64x2 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_i8x16(self) -> ::coresimd::simd::i8x16 { + fn as_i8x16(self) -> ::core_arch::simd::i8x16 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_i16x8(self) -> ::coresimd::simd::i16x8 { + fn as_i16x8(self) -> ::core_arch::simd::i16x8 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_i32x4(self) -> ::coresimd::simd::i32x4 { + fn as_i32x4(self) -> ::core_arch::simd::i32x4 { unsafe { mem::transmute(self.as_m128i()) } } #[inline] - fn as_i64x2(self) -> ::coresimd::simd::i64x2 { + fn as_i64x2(self) -> ::core_arch::simd::i64x2 { unsafe { mem::transmute(self.as_m128i()) } } } @@ -459,42 +466,42 @@ pub(crate) trait m256iExt: Sized { fn as_m256i(self) -> __m256i; #[inline] - fn as_u8x32(self) -> ::coresimd::simd::u8x32 { + fn as_u8x32(self) -> ::core_arch::simd::u8x32 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_u16x16(self) -> ::coresimd::simd::u16x16 { + fn as_u16x16(self) -> ::core_arch::simd::u16x16 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_u32x8(self) -> ::coresimd::simd::u32x8 { + fn as_u32x8(self) -> ::core_arch::simd::u32x8 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_u64x4(self) -> ::coresimd::simd::u64x4 { + fn as_u64x4(self) -> ::core_arch::simd::u64x4 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_i8x32(self) -> ::coresimd::simd::i8x32 { + fn as_i8x32(self) -> ::core_arch::simd::i8x32 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_i16x16(self) -> ::coresimd::simd::i16x16 { + fn as_i16x16(self) -> ::core_arch::simd::i16x16 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_i32x8(self) -> ::coresimd::simd::i32x8 { + fn as_i32x8(self) -> ::core_arch::simd::i32x8 { unsafe { mem::transmute(self.as_m256i()) } } #[inline] - fn as_i64x4(self) -> ::coresimd::simd::i64x4 { + fn as_i64x4(self) -> ::core_arch::simd::i64x4 { unsafe { mem::transmute(self.as_m256i()) } } } @@ -512,7 +519,7 @@ pub(crate) trait m512iExt: Sized { fn as_m512i(self) -> __m512i; #[inline] - fn as_i32x16(self) -> ::coresimd::simd::i32x16 { + fn as_i32x16(self) -> ::core_arch::simd::i32x16 { unsafe { mem::transmute(self.as_m512i()) } } } diff --git a/coresimd/x86/pclmulqdq.rs b/crates/core_arch/src/x86/pclmulqdq.rs similarity index 98% rename from coresimd/x86/pclmulqdq.rs rename to crates/core_arch/src/x86/pclmulqdq.rs index c8cd9f3769..c047b3b1cd 100644 --- a/coresimd/x86/pclmulqdq.rs +++ b/crates/core_arch/src/x86/pclmulqdq.rs @@ -5,7 +5,7 @@ //! //! [intel64_ref]: http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf -use coresimd::x86::__m128i; +use core_arch::x86::__m128i; #[cfg(test)] use stdsimd_test::assert_instr; @@ -50,7 +50,7 @@ mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "pclmulqdq")] unsafe fn test_mm_clmulepi64_si128() { diff --git a/coresimd/x86/rdrand.rs b/crates/core_arch/src/x86/rdrand.rs similarity index 100% rename from coresimd/x86/rdrand.rs rename to crates/core_arch/src/x86/rdrand.rs diff --git a/coresimd/x86/rdtsc.rs b/crates/core_arch/src/x86/rdtsc.rs similarity index 98% rename from coresimd/x86/rdtsc.rs rename to crates/core_arch/src/x86/rdtsc.rs index 630a72bafb..5ed5d49611 100644 --- a/coresimd/x86/rdtsc.rs +++ b/crates/core_arch/src/x86/rdtsc.rs @@ -59,7 +59,7 @@ extern "C" { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; use stdsimd_test::simd_test; #[simd_test(enable = "sse2")] diff --git a/coresimd/x86/sha.rs b/crates/core_arch/src/x86/sha.rs similarity index 98% rename from coresimd/x86/sha.rs rename to crates/core_arch/src/x86/sha.rs index c748b0d1ff..98bf4707f8 100644 --- a/coresimd/x86/sha.rs +++ b/crates/core_arch/src/x86/sha.rs @@ -1,5 +1,5 @@ -use coresimd::simd::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::x86::*; use mem; #[allow(improper_ctypes)] @@ -134,8 +134,8 @@ mod tests { use std::i32; use std::mem::{self, transmute}; - use coresimd::simd::*; - use coresimd::x86::*; + use core_arch::simd::*; + use core_arch::x86::*; use stdsimd_test::simd_test; use test::black_box; // Used to inhibit constant-folding. diff --git a/coresimd/x86/sse.rs b/crates/core_arch/src/x86/sse.rs similarity index 98% rename from coresimd/x86/sse.rs rename to crates/core_arch/src/x86/sse.rs index ec69eff3f7..8d1c237f53 100644 --- a/coresimd/x86/sse.rs +++ b/crates/core_arch/src/x86/sse.rs @@ -1,8 +1,8 @@ //! Streaming SIMD Extensions (SSE) -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use intrinsics; use mem; use ptr; @@ -1109,39 +1109,6 @@ pub unsafe fn _mm_movemask_ps(a: __m128) -> i32 { /// Set the upper two single-precision floating-point values with 64 bits of /// data loaded from the address `p`; the lower two values are passed through /// from `a`. -/// -/// This corresponds to the `MOVHPS` / `MOVHPD` / `VMOVHPD` instructions. -/// -/// ```rust -/// # #![feature(stdsimd)] -/// # #![cfg_attr(not(dox), no_std)] -/// # #[cfg(not(dox))] -/// # extern crate std as real_std; -/// # #[cfg(not(dox))] -/// # #[macro_use] -/// # extern crate stdsimd as std; -/// #[cfg(target_arch = "x86")] -/// use std::arch::x86::*; -/// #[cfg(target_arch = "x86_64")] -/// use std::arch::x86_64::*; -/// -/// # -/// # // The real main function -/// # fn main() { -/// # if is_x86_feature_detected!("sse") { -/// # #[target_feature(enable = "sse")] -/// # unsafe fn worker() { -/// # -/// let a = _mm_setr_ps(1.0, 2.0, 3.0, 4.0); -/// let data: [f32; 4] = [5.0, 6.0, 7.0, 8.0]; -/// let r = _mm_loadh_pi(a, data[..].as_ptr() as *const _); -/// // assert_eq!(r, _mm_setr_ps(1.0, 2.0, 5.0, 6.0)); -/// # -/// # } -/// # unsafe { worker(); } -/// # } -/// # } -/// ``` #[inline] #[target_feature(enable = "sse")] #[cfg_attr( @@ -1170,38 +1137,6 @@ pub unsafe fn _mm_loadh_pi(a: __m128, p: *const __m64) -> __m128 { /// Load two floats from `p` into the lower half of a `__m128`. The upper half /// is copied from the upper half of `a`. -/// -/// This corresponds to the `MOVLPS` / `MOVLDP` / `VMOVLDP` instructions. -/// -/// ```rust -/// # #![feature(stdsimd)] -/// # #![cfg_attr(not(dox), no_std)] -/// # #[cfg(not(dox))] -/// # extern crate std as real_std; -/// # #[cfg(not(dox))] -/// # #[macro_use] -/// # extern crate stdsimd as std; -/// #[cfg(target_arch = "x86")] -/// use std::arch::x86::*; -/// #[cfg(target_arch = "x86_64")] -/// use std::arch::x86_64::*; -/// -/// # // The real main function -/// # fn main() { -/// # if is_x86_feature_detected!("sse") { -/// # #[target_feature(enable = "sse")] -/// # unsafe fn worker() { -/// # -/// let a = _mm_setr_ps(1.0, 2.0, 3.0, 4.0); -/// let data: [f32; 4] = [5.0, 6.0, 7.0, 8.0]; -/// let r = _mm_loadh_pi(a, data[..].as_ptr() as *const _); -/// // assert_eq!(r, _mm_setr_ps(5.0, 6.0, 3.0, 4.0)); -/// # -/// # } -/// # unsafe { worker(); } -/// # } -/// # } -/// ``` #[inline] #[target_feature(enable = "sse")] #[cfg_attr(all(test, target_arch = "x86_64"), assert_instr(movlpd))] @@ -2569,8 +2504,8 @@ mod tests { use stdsimd_test::simd_test; use test::black_box; // Used to inhibit constant-folding. - use coresimd::simd::*; - use coresimd::x86::*; + use core_arch::simd::*; + use core_arch::x86::*; #[simd_test(enable = "sse")] unsafe fn test_mm_add_ps() { diff --git a/coresimd/x86/sse2.rs b/crates/core_arch/src/x86/sse2.rs similarity index 99% rename from coresimd/x86/sse2.rs rename to crates/core_arch/src/x86/sse2.rs index 31aff1eb48..a21743ec4a 100644 --- a/coresimd/x86/sse2.rs +++ b/crates/core_arch/src/x86/sse2.rs @@ -3,9 +3,9 @@ #[cfg(test)] use stdsimd_test::assert_instr; -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use intrinsics; use mem; use ptr; @@ -3187,8 +3187,8 @@ mod tests { use std::i32; use std::mem::{self, transmute}; - use coresimd::simd::*; - use coresimd::x86::*; + use core_arch::simd::*; + use core_arch::x86::*; use stdsimd_test::simd_test; use test::black_box; // Used to inhibit constant-folding. diff --git a/coresimd/x86/sse3.rs b/crates/core_arch/src/x86/sse3.rs similarity index 98% rename from coresimd/x86/sse3.rs rename to crates/core_arch/src/x86/sse3.rs index 5ef3077747..394909763d 100644 --- a/coresimd/x86/sse3.rs +++ b/crates/core_arch/src/x86/sse3.rs @@ -1,8 +1,8 @@ //! Streaming SIMD Extensions 3 (SSE3) -use coresimd::simd::*; -use coresimd::simd_llvm::{simd_shuffle2, simd_shuffle4}; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::{simd_shuffle2, simd_shuffle4}; +use core_arch::x86::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -162,7 +162,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "sse3")] unsafe fn test_mm_addsub_ps() { diff --git a/coresimd/x86/sse41.rs b/crates/core_arch/src/x86/sse41.rs similarity index 99% rename from coresimd/x86/sse41.rs rename to crates/core_arch/src/x86/sse41.rs index 20606aead1..e7d7ea837a 100644 --- a/coresimd/x86/sse41.rs +++ b/crates/core_arch/src/x86/sse41.rs @@ -1,8 +1,8 @@ //! Streaming SIMD Extensions 4.1 (SSE4.1) -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -714,7 +714,7 @@ pub unsafe fn _mm_ceil_ss(a: __m128, b: __m128) -> __m128 { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; @@ -767,7 +767,7 @@ pub unsafe fn _mm_round_pd(a: __m128d, rounding: i32) -> __m128d { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; @@ -821,7 +821,7 @@ pub unsafe fn _mm_round_ps(a: __m128, rounding: i32) -> __m128 { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; @@ -875,7 +875,7 @@ pub unsafe fn _mm_round_sd(a: __m128d, b: __m128d, rounding: i32) -> __m128d { /// # #[cfg(not(dox))] /// # extern crate std as real_std; /// # #[cfg(not(dox))] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; @@ -1221,7 +1221,7 @@ extern "C" { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; use std::mem; use stdsimd_test::simd_test; diff --git a/coresimd/x86/sse42.rs b/crates/core_arch/src/x86/sse42.rs similarity index 99% rename from coresimd/x86/sse42.rs rename to crates/core_arch/src/x86/sse42.rs index be877d8ddf..c32568fefc 100644 --- a/coresimd/x86/sse42.rs +++ b/crates/core_arch/src/x86/sse42.rs @@ -5,9 +5,9 @@ #[cfg(test)] use stdsimd_test::assert_instr; -use coresimd::simd::*; -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; /// String contains unsigned 8-bit characters *(Default)* #[stable(feature = "simd_x86", since = "1.27.0")] @@ -125,7 +125,7 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i32) -> __m128i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// # #[cfg(not(dox))] /// # use real_std::prelude::v1::*; /// #[cfg(target_arch = "x86")] @@ -172,7 +172,7 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i32) -> __m128i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -216,7 +216,7 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i32) -> __m128i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -260,7 +260,7 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i32) -> __m128i { /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -489,7 +489,7 @@ pub unsafe fn _mm_cmpestrm(a: __m128i, la: i32, b: __m128i, lb: i32, imm8: i32) /// # extern crate std as real_std; /// # #[cfg(not(dox))] /// # #[macro_use] -/// # extern crate stdsimd as std; +/// # extern crate std_detect as std; /// #[cfg(target_arch = "x86")] /// use std::arch::x86::*; /// #[cfg(target_arch = "x86_64")] @@ -750,7 +750,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; use std::ptr; // Currently one cannot `load` a &[u8] that is is less than 16 diff --git a/coresimd/x86/sse4a.rs b/crates/core_arch/src/x86/sse4a.rs similarity index 98% rename from coresimd/x86/sse4a.rs rename to crates/core_arch/src/x86/sse4a.rs index 2c184166fb..ac172f9b04 100644 --- a/coresimd/x86/sse4a.rs +++ b/crates/core_arch/src/x86/sse4a.rs @@ -1,7 +1,7 @@ //! `i686`'s Streaming SIMD Extensions 4a (`SSE4a`) -use coresimd::simd::*; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -78,7 +78,7 @@ pub unsafe fn _mm_stream_ss(p: *mut f32, a: __m128) { #[cfg(test)] mod tests { - use coresimd::x86::*; + use core_arch::x86::*; use stdsimd_test::simd_test; #[simd_test(enable = "sse4a")] diff --git a/coresimd/x86/ssse3.rs b/crates/core_arch/src/x86/ssse3.rs similarity index 99% rename from coresimd/x86/ssse3.rs rename to crates/core_arch/src/x86/ssse3.rs index 0d14bb1f2f..a013ab6551 100644 --- a/coresimd/x86/ssse3.rs +++ b/crates/core_arch/src/x86/ssse3.rs @@ -1,8 +1,8 @@ //! Supplemental Streaming SIMD Extensions 3 (SSSE3) -use coresimd::simd::*; -use coresimd::simd_llvm::simd_shuffle16; -use coresimd::x86::*; +use core_arch::simd::*; +use core_arch::simd_llvm::simd_shuffle16; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -562,7 +562,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "ssse3")] unsafe fn test_mm_abs_epi8() { diff --git a/coresimd/x86/tbm.rs b/crates/core_arch/src/x86/tbm.rs similarity index 99% rename from coresimd/x86/tbm.rs rename to crates/core_arch/src/x86/tbm.rs index 974e30dd57..314c5e36c7 100644 --- a/coresimd/x86/tbm.rs +++ b/crates/core_arch/src/x86/tbm.rs @@ -281,7 +281,7 @@ pub unsafe fn _tzmsk_u64(x: u64) -> u64 { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; /* #[simd_test(enable = "tbm")] diff --git a/coresimd/x86/test.rs b/crates/core_arch/src/x86/test.rs similarity index 96% rename from coresimd/x86/test.rs rename to crates/core_arch/src/x86/test.rs index 40a49402f8..9dbe8c11ef 100644 --- a/coresimd/x86/test.rs +++ b/crates/core_arch/src/x86/test.rs @@ -1,6 +1,6 @@ //! Utilities used in testing the x86 intrinsics -use coresimd::x86::*; +use core_arch::x86::*; #[target_feature(enable = "mmx")] pub unsafe fn assert_eq_m64(a: __m64, b: __m64) { @@ -107,7 +107,7 @@ pub unsafe fn get_m256(a: __m256, idx: usize) -> f32 { // which doesn't exist on x86! #[cfg(target_arch = "x86")] mod x86_polyfill { - use coresimd::x86::*; + use core_arch::x86::*; pub unsafe fn _mm_insert_epi64(a: __m128i, val: i64, idx: i32) -> __m128i { union A { @@ -132,7 +132,7 @@ mod x86_polyfill { } #[cfg(target_arch = "x86_64")] mod x86_polyfill { - pub use coresimd::x86_64::{_mm256_insert_epi64, _mm_insert_epi64}; + pub use core_arch::x86_64::{_mm256_insert_epi64, _mm_insert_epi64}; } pub use self::x86_polyfill::*; diff --git a/coresimd/x86/xsave.rs b/crates/core_arch/src/x86/xsave.rs similarity index 99% rename from coresimd/x86/xsave.rs rename to crates/core_arch/src/x86/xsave.rs index 9c5d6dcd87..c52dcd8c2a 100644 --- a/coresimd/x86/xsave.rs +++ b/crates/core_arch/src/x86/xsave.rs @@ -166,7 +166,7 @@ mod tests { use std::fmt; use std::prelude::v1::*; - use coresimd::x86::*; + use core_arch::x86::*; use stdsimd_test::simd_test; #[repr(align(64))] diff --git a/coresimd/x86_64/abm.rs b/crates/core_arch/src/x86_64/abm.rs similarity index 98% rename from coresimd/x86_64/abm.rs rename to crates/core_arch/src/x86_64/abm.rs index 1f08a362fb..7a655dbe90 100644 --- a/coresimd/x86_64/abm.rs +++ b/crates/core_arch/src/x86_64/abm.rs @@ -48,7 +48,7 @@ pub unsafe fn _popcnt64(x: i64) -> i32 { mod tests { use stdsimd_test::simd_test; - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; #[simd_test(enable = "lzcnt")] unsafe fn test_lzcnt_u64() { diff --git a/coresimd/x86_64/adx.rs b/crates/core_arch/src/x86_64/adx.rs similarity index 100% rename from coresimd/x86_64/adx.rs rename to crates/core_arch/src/x86_64/adx.rs diff --git a/coresimd/x86_64/avx.rs b/crates/core_arch/src/x86_64/avx.rs similarity index 95% rename from coresimd/x86_64/avx.rs rename to crates/core_arch/src/x86_64/avx.rs index b176483fdd..429ee75c59 100644 --- a/coresimd/x86_64/avx.rs +++ b/crates/core_arch/src/x86_64/avx.rs @@ -13,8 +13,8 @@ //! [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf //! [wiki]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use mem; /// Copy `a` to result, and insert the 64-bit integer `i` into result @@ -34,7 +34,7 @@ pub unsafe fn _mm256_insert_epi64(a: __m256i, i: i64, index: i32) -> __m256i { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; + use core_arch::x86::*; #[simd_test(enable = "avx")] unsafe fn test_mm256_insert_epi64() { diff --git a/coresimd/x86_64/avx2.rs b/crates/core_arch/src/x86_64/avx2.rs similarity index 95% rename from coresimd/x86_64/avx2.rs rename to crates/core_arch/src/x86_64/avx2.rs index 8e85010ac4..a27f312575 100644 --- a/coresimd/x86_64/avx2.rs +++ b/crates/core_arch/src/x86_64/avx2.rs @@ -18,8 +18,8 @@ //! [wiki_avx]: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions //! [wiki_fma]: https://en.wikipedia.org/wiki/Fused_multiply-accumulate -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; /// Extract a 64-bit integer from `a`, selected with `imm8`. /// @@ -38,7 +38,7 @@ pub unsafe fn _mm256_extract_epi64(a: __m256i, imm8: i32) -> i64 { mod tests { use stdsimd_test::simd_test; - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; #[simd_test(enable = "avx2")] unsafe fn test_mm256_extract_epi64() { diff --git a/coresimd/x86_64/bmi.rs b/crates/core_arch/src/x86_64/bmi.rs similarity index 99% rename from coresimd/x86_64/bmi.rs rename to crates/core_arch/src/x86_64/bmi.rs index 831f524714..be3ced9e25 100644 --- a/coresimd/x86_64/bmi.rs +++ b/crates/core_arch/src/x86_64/bmi.rs @@ -125,8 +125,8 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86::*; - use coresimd::x86_64::*; + use core_arch::x86::*; + use core_arch::x86_64::*; #[simd_test(enable = "bmi1")] unsafe fn test_bextr_u64() { diff --git a/coresimd/x86_64/bmi2.rs b/crates/core_arch/src/x86_64/bmi2.rs similarity index 99% rename from coresimd/x86_64/bmi2.rs rename to crates/core_arch/src/x86_64/bmi2.rs index 0ec8f8e320..98d804ead2 100644 --- a/coresimd/x86_64/bmi2.rs +++ b/crates/core_arch/src/x86_64/bmi2.rs @@ -81,7 +81,7 @@ extern "C" { mod tests { use stdsimd_test::simd_test; - use coresimd::x86_64::*; + use core_arch::x86_64::*; #[simd_test(enable = "bmi2")] unsafe fn test_pext_u64() { diff --git a/coresimd/x86_64/bswap.rs b/crates/core_arch/src/x86_64/bswap.rs similarity index 100% rename from coresimd/x86_64/bswap.rs rename to crates/core_arch/src/x86_64/bswap.rs diff --git a/coresimd/x86_64/cmpxchg16b.rs b/crates/core_arch/src/x86_64/cmpxchg16b.rs similarity index 98% rename from coresimd/x86_64/cmpxchg16b.rs rename to crates/core_arch/src/x86_64/cmpxchg16b.rs index 0fc2f263cc..c7b43a4469 100644 --- a/coresimd/x86_64/cmpxchg16b.rs +++ b/crates/core_arch/src/x86_64/cmpxchg16b.rs @@ -69,7 +69,7 @@ pub unsafe fn cmpxchg16b( // The above block is all copied from libcore, and this statement is // also copied from libcore except that it's a panic in libcore and we // have a little bit more of a lightweight panic here. - _ => ::coresimd::x86::ud2(), + _ => ::core_arch::x86::ud2(), }; val } diff --git a/coresimd/x86_64/fxsr.rs b/crates/core_arch/src/x86_64/fxsr.rs similarity index 99% rename from coresimd/x86_64/fxsr.rs rename to crates/core_arch/src/x86_64/fxsr.rs index 846162e219..dde2f5d829 100644 --- a/coresimd/x86_64/fxsr.rs +++ b/crates/core_arch/src/x86_64/fxsr.rs @@ -57,7 +57,7 @@ pub unsafe fn _fxrstor64(mem_addr: *const u8) { #[cfg(test)] mod tests { - use coresimd::x86_64::*; + use core_arch::x86_64::*; use std::{cmp::PartialEq, fmt}; use stdsimd_test::simd_test; diff --git a/coresimd/x86_64/mod.rs b/crates/core_arch/src/x86_64/mod.rs similarity index 100% rename from coresimd/x86_64/mod.rs rename to crates/core_arch/src/x86_64/mod.rs diff --git a/coresimd/x86_64/rdrand.rs b/crates/core_arch/src/x86_64/rdrand.rs similarity index 100% rename from coresimd/x86_64/rdrand.rs rename to crates/core_arch/src/x86_64/rdrand.rs diff --git a/coresimd/x86_64/sse.rs b/crates/core_arch/src/x86_64/sse.rs similarity index 98% rename from coresimd/x86_64/sse.rs rename to crates/core_arch/src/x86_64/sse.rs index dbbdb0671f..a3126e72e9 100644 --- a/coresimd/x86_64/sse.rs +++ b/crates/core_arch/src/x86_64/sse.rs @@ -1,6 +1,6 @@ //! `x86_64` Streaming SIMD Extensions (SSE) -use coresimd::x86::*; +use core_arch::x86::*; #[cfg(test)] use stdsimd_test::assert_instr; @@ -75,7 +75,7 @@ mod tests { use stdsimd_test::simd_test; - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; #[simd_test(enable = "sse")] unsafe fn test_mm_cvtss_si64() { diff --git a/coresimd/x86_64/sse2.rs b/crates/core_arch/src/x86_64/sse2.rs similarity index 98% rename from coresimd/x86_64/sse2.rs rename to crates/core_arch/src/x86_64/sse2.rs index f336f90faf..779be0a593 100644 --- a/coresimd/x86_64/sse2.rs +++ b/crates/core_arch/src/x86_64/sse2.rs @@ -1,7 +1,7 @@ //! `x86_64`'s Streaming SIMD Extensions 2 (SSE2) -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use intrinsics; #[cfg(test)] @@ -150,7 +150,7 @@ mod tests { use stdsimd_test::simd_test; - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; #[simd_test(enable = "sse2")] unsafe fn test_mm_cvtsd_si64() { diff --git a/coresimd/x86_64/sse41.rs b/crates/core_arch/src/x86_64/sse41.rs similarity index 95% rename from coresimd/x86_64/sse41.rs rename to crates/core_arch/src/x86_64/sse41.rs index 2d0cd591e4..9a22370019 100644 --- a/coresimd/x86_64/sse41.rs +++ b/crates/core_arch/src/x86_64/sse41.rs @@ -1,7 +1,7 @@ //! `i686`'s Streaming SIMD Extensions 4.1 (SSE4.1) -use coresimd::simd_llvm::*; -use coresimd::x86::*; +use core_arch::simd_llvm::*; +use core_arch::x86::*; use mem; #[cfg(test)] @@ -35,7 +35,7 @@ pub unsafe fn _mm_insert_epi64(a: __m128i, i: i64, imm8: i32) -> __m128i { #[cfg(test)] mod tests { - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; use stdsimd_test::simd_test; #[simd_test(enable = "sse4.1")] diff --git a/coresimd/x86_64/sse42.rs b/crates/core_arch/src/x86_64/sse42.rs similarity index 96% rename from coresimd/x86_64/sse42.rs rename to crates/core_arch/src/x86_64/sse42.rs index d981c176ea..3f1b614062 100644 --- a/coresimd/x86_64/sse42.rs +++ b/crates/core_arch/src/x86_64/sse42.rs @@ -23,7 +23,7 @@ pub unsafe fn _mm_crc32_u64(crc: u64, v: u64) -> u64 { #[cfg(test)] mod tests { - use coresimd::arch::x86_64::*; + use core_arch::arch::x86_64::*; use stdsimd_test::simd_test; diff --git a/coresimd/x86_64/xsave.rs b/crates/core_arch/src/x86_64/xsave.rs similarity index 99% rename from coresimd/x86_64/xsave.rs rename to crates/core_arch/src/x86_64/xsave.rs index 1684c62cd3..875b677dbd 100644 --- a/coresimd/x86_64/xsave.rs +++ b/crates/core_arch/src/x86_64/xsave.rs @@ -129,7 +129,7 @@ pub unsafe fn _xrstors64(mem_addr: *const u8, rs_mask: u64) { /* #[cfg(test)] mod tests { - use coresimd::x86::x86_64::xsave; + use core_arch::x86::x86_64::xsave; use stdsimd_test::simd_test; use std::fmt; diff --git a/crates/coresimd/tests/cpu-detection.rs b/crates/core_arch/tests/cpu-detection.rs similarity index 98% rename from crates/coresimd/tests/cpu-detection.rs rename to crates/core_arch/tests/cpu-detection.rs index ccbb9eef1c..454176b18c 100644 --- a/crates/coresimd/tests/cpu-detection.rs +++ b/crates/core_arch/tests/cpu-detection.rs @@ -7,7 +7,7 @@ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[macro_use] -extern crate stdsimd; +extern crate std_detect; #[test] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] diff --git a/crates/stdsimd/Cargo.toml b/crates/std_detect/Cargo.toml similarity index 67% rename from crates/stdsimd/Cargo.toml rename to crates/std_detect/Cargo.toml index aacfe97a3d..61dd7790ed 100644 --- a/crates/stdsimd/Cargo.toml +++ b/crates/std_detect/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "stdsimd" +name = "std_detect" version = "0.1.3" authors = [ "Alex Crichton ", @@ -11,7 +11,7 @@ documentation = "https://docs.rs/stdsimd" homepage = "https://github.com/rust-lang-nursery/stdsimd" repository = "https://github.com/rust-lang-nursery/stdsimd" readme = "README.md" -keywords = ["std", "simd", "intrinsics"] +keywords = ["std", "run-time", "feature", "detection"] categories = ["hardware-support"] license = "MIT/Apache-2.0" @@ -23,27 +23,10 @@ is-it-maintained-open-issues = { repository = "rust-lang-nursery/stdsimd" } maintenance = { status = "experimental" } [dependencies] -coresimd = { version = "0.1.3", path = "../coresimd" } libc = "0.2" cfg-if = "0.1" [dev-dependencies] +core_arch = { version = "0.1.3", path = "../core_arch" } auxv = "0.3.3" -quickcheck = "0.8" -rand = "0.6" -cupid = "0.6.0" - -[target.'cfg(target_arch = "wasm32")'.dependencies] -rand = { version = "0.6", features = ["wasm-bindgen"] } - -[[example]] -name = "hex" -path = "../../examples/hex.rs" - -[[example]] -name = "wasm" -crate-type = ["cdylib"] -path = "../../examples/wasm.rs" - -[features] -default = [] +cupid = "0.6.0" \ No newline at end of file diff --git a/stdsimd/arch/detect/arch/aarch64.rs b/crates/std_detect/src/detect/arch/aarch64.rs similarity index 71% rename from stdsimd/arch/detect/arch/aarch64.rs rename to crates/std_detect/src/detect/arch/aarch64.rs index 3fb306aea1..882c22cc17 100644 --- a/stdsimd/arch/detect/arch/aarch64.rs +++ b/crates/std_detect/src/detect/arch/aarch64.rs @@ -8,51 +8,51 @@ macro_rules! is_aarch64_feature_detected { ("neon") => { // FIXME: this should be removed once we rename Aarch64 neon to asimd cfg!(target_feature = "neon") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::asimd) + $crate::detect::check_for($crate::detect::Feature::asimd) }; ("asimd") => { cfg!(target_feature = "neon") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::asimd) + $crate::detect::check_for($crate::detect::Feature::asimd) }; ("pmull") => { cfg!(target_feature = "pmull") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::pmull) + $crate::detect::check_for($crate::detect::Feature::pmull) }; ("fp") => { cfg!(target_feature = "fp") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::fp) + $crate::detect::check_for($crate::detect::Feature::fp) }; ("fp16") => { cfg!(target_feature = "fp16") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::fp16) + $crate::detect::check_for($crate::detect::Feature::fp16) }; ("sve") => { cfg!(target_feature = "sve") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::sve) + $crate::detect::check_for($crate::detect::Feature::sve) }; ("crc") => { cfg!(target_feature = "crc") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::crc) + $crate::detect::check_for($crate::detect::Feature::crc) }; ("crypto") => { cfg!(target_feature = "crypto") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::crypto) + $crate::detect::check_for($crate::detect::Feature::crypto) }; ("lse") => { cfg!(target_feature = "lse") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::lse) + $crate::detect::check_for($crate::detect::Feature::lse) }; ("rdm") => { cfg!(target_feature = "rdm") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::rdm) + $crate::detect::check_for($crate::detect::Feature::rdm) }; ("rcpc") => { cfg!(target_feature = "rcpc") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::rcpc) + $crate::detect::check_for($crate::detect::Feature::rcpc) }; ("dotprod") => { cfg!(target_feature = "dotprod") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::dotprod) + $crate::detect::check_for($crate::detect::Feature::dotprod) }; ("ras") => { compile_error!("\"ras\" feature cannot be detected at run-time") diff --git a/stdsimd/arch/detect/arch/arm.rs b/crates/std_detect/src/detect/arch/arm.rs similarity index 87% rename from stdsimd/arch/detect/arch/arm.rs rename to crates/std_detect/src/detect/arch/arm.rs index c6a36d3e8e..cb6ac6badc 100644 --- a/stdsimd/arch/detect/arch/arm.rs +++ b/crates/std_detect/src/detect/arch/arm.rs @@ -7,11 +7,11 @@ macro_rules! is_arm_feature_detected { ("neon") => { cfg!(target_feature = "neon") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::neon) + $crate::detect::check_for($crate::detect::Feature::neon) }; ("pmull") => { cfg!(target_feature = "pmull") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::pmull) + $crate::detect::check_for($crate::detect::Feature::pmull) }; ("v7") => { compile_error!("\"v7\" feature cannot be detected at run-time") }; ("vfp2") => { compile_error!("\"vfp2\" feature cannot be detected at run-time") }; diff --git a/stdsimd/arch/detect/arch/mips.rs b/crates/std_detect/src/detect/arch/mips.rs similarity index 90% rename from stdsimd/arch/detect/arch/mips.rs rename to crates/std_detect/src/detect/arch/mips.rs index f049a1ae6a..876f8dde26 100644 --- a/stdsimd/arch/detect/arch/mips.rs +++ b/crates/std_detect/src/detect/arch/mips.rs @@ -7,7 +7,7 @@ macro_rules! is_mips_feature_detected { ("msa") => { cfg!(target_feature = "msa") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::msa) + $crate::detect::check_for($crate::detect::Feature::msa) }; ($t:tt) => { compile_error!(concat!("unknown mips target feature: ", $t)) }; } diff --git a/stdsimd/arch/detect/arch/mips64.rs b/crates/std_detect/src/detect/arch/mips64.rs similarity index 90% rename from stdsimd/arch/detect/arch/mips64.rs rename to crates/std_detect/src/detect/arch/mips64.rs index d778865a61..ab837b3d5c 100644 --- a/stdsimd/arch/detect/arch/mips64.rs +++ b/crates/std_detect/src/detect/arch/mips64.rs @@ -7,7 +7,7 @@ macro_rules! is_mips64_feature_detected { ("msa") => { cfg!(target_feature = "msa") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::msa) + $crate::detect::check_for($crate::detect::Feature::msa) }; ($t:tt) => { compile_error!(concat!("unknown mips64 target feature: ", $t)) }; } diff --git a/stdsimd/arch/detect/arch/powerpc.rs b/crates/std_detect/src/detect/arch/powerpc.rs similarity index 78% rename from stdsimd/arch/detect/arch/powerpc.rs rename to crates/std_detect/src/detect/arch/powerpc.rs index 0b3716f684..9c440b1d6b 100644 --- a/stdsimd/arch/detect/arch/powerpc.rs +++ b/crates/std_detect/src/detect/arch/powerpc.rs @@ -7,15 +7,15 @@ macro_rules! is_powerpc_feature_detected { ("altivec") => { cfg!(target_feature = "altivec") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::altivec) + $crate::detect::check_for($crate::detect::Feature::altivec) }; ("vsx") => { cfg!(target_feature = "vsx") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::vsx) + $crate::detect::check_for($crate::detect::Feature::vsx) }; ("power8") => { cfg!(target_feature = "power8") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::power8) + $crate::detect::check_for($crate::detect::Feature::power8) }; ($t:tt) => { compile_error!(concat!("unknown powerpc target feature: ", $t)) }; } diff --git a/stdsimd/arch/detect/arch/powerpc64.rs b/crates/std_detect/src/detect/arch/powerpc64.rs similarity index 78% rename from stdsimd/arch/detect/arch/powerpc64.rs rename to crates/std_detect/src/detect/arch/powerpc64.rs index f85ebe5b67..910940f0bb 100644 --- a/stdsimd/arch/detect/arch/powerpc64.rs +++ b/crates/std_detect/src/detect/arch/powerpc64.rs @@ -7,15 +7,15 @@ macro_rules! is_powerpc64_feature_detected { ("altivec") => { cfg!(target_feature = "altivec") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::altivec) + $crate::detect::check_for($crate::detect::Feature::altivec) }; ("vsx") => { cfg!(target_feature = "vsx") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::vsx) + $crate::detect::check_for($crate::detect::Feature::vsx) }; ("power8") => { cfg!(target_feature = "power8") || - $crate::arch::detect::check_for($crate::arch::detect::Feature::power8) + $crate::detect::check_for($crate::detect::Feature::power8) }; ($t:tt) => { compile_error!(concat!("unknown powerpc64 target feature: ", $t)) }; } diff --git a/stdsimd/arch/detect/arch/x86.rs b/crates/std_detect/src/detect/arch/x86.rs similarity index 55% rename from stdsimd/arch/detect/arch/x86.rs rename to crates/std_detect/src/detect/arch/x86.rs index fdf37dac72..3ef8d31d12 100644 --- a/stdsimd/arch/detect/arch/x86.rs +++ b/crates/std_detect/src/detect/arch/x86.rs @@ -6,12 +6,12 @@ //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the -//! the `__crate::arch::detect::check_for!` macro is used to map string literals (e.g. +//! the `__crate::detect::check_for!` macro is used to map string literals (e.g. //! "avx") to these bit positions (e.g. `Feature::avx`). //! //! //! The run-time feature detection is performed by the -//! `__crate::arch::detect::check_for(Feature) -> bool` function. On its first call, +//! `__crate::detect::check_for(Feature) -> bool` function. On its first call, //! this functions queries the CPU for the available features and stores them //! in a global `AtomicUsize` variable. The query is performed by just checking //! whether the feature bit in this global variable is set or cleared. @@ -82,157 +82,157 @@ #[allow_internal_unstable] macro_rules! is_x86_feature_detected { ("aes") => { - cfg!(target_feature = "aes") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::aes) }; + cfg!(target_feature = "aes") || $crate::detect::check_for( + $crate::detect::Feature::aes) }; ("pclmulqdq") => { - cfg!(target_feature = "pclmulqdq") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::pclmulqdq) }; + cfg!(target_feature = "pclmulqdq") || $crate::detect::check_for( + $crate::detect::Feature::pclmulqdq) }; ("rdrand") => { - cfg!(target_feature = "rdrand") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::rdrand) }; + cfg!(target_feature = "rdrand") || $crate::detect::check_for( + $crate::detect::Feature::rdrand) }; ("rdseed") => { - cfg!(target_feature = "rdseed") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::rdseed) }; + cfg!(target_feature = "rdseed") || $crate::detect::check_for( + $crate::detect::Feature::rdseed) }; ("tsc") => { - cfg!(target_feature = "tsc") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::tsc) }; + cfg!(target_feature = "tsc") || $crate::detect::check_for( + $crate::detect::Feature::tsc) }; ("mmx") => { - cfg!(target_feature = "mmx") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::mmx) }; + cfg!(target_feature = "mmx") || $crate::detect::check_for( + $crate::detect::Feature::mmx) }; ("sse") => { - cfg!(target_feature = "sse") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse) }; + cfg!(target_feature = "sse") || $crate::detect::check_for( + $crate::detect::Feature::sse) }; ("sse2") => { - cfg!(target_feature = "sse2") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse2) + cfg!(target_feature = "sse2") || $crate::detect::check_for( + $crate::detect::Feature::sse2) }; ("sse3") => { - cfg!(target_feature = "sse3") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse3) + cfg!(target_feature = "sse3") || $crate::detect::check_for( + $crate::detect::Feature::sse3) }; ("ssse3") => { - cfg!(target_feature = "ssse3") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::ssse3) + cfg!(target_feature = "ssse3") || $crate::detect::check_for( + $crate::detect::Feature::ssse3) }; ("sse4.1") => { - cfg!(target_feature = "sse4.1") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse4_1) + cfg!(target_feature = "sse4.1") || $crate::detect::check_for( + $crate::detect::Feature::sse4_1) }; ("sse4.2") => { - cfg!(target_feature = "sse4.2") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse4_2) + cfg!(target_feature = "sse4.2") || $crate::detect::check_for( + $crate::detect::Feature::sse4_2) }; ("sse4a") => { - cfg!(target_feature = "sse4a") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sse4a) + cfg!(target_feature = "sse4a") || $crate::detect::check_for( + $crate::detect::Feature::sse4a) }; ("sha") => { - cfg!(target_feature = "sha") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::sha) + cfg!(target_feature = "sha") || $crate::detect::check_for( + $crate::detect::Feature::sha) }; ("avx") => { - cfg!(target_feature = "avx") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx) + cfg!(target_feature = "avx") || $crate::detect::check_for( + $crate::detect::Feature::avx) }; ("avx2") => { - cfg!(target_feature = "avx2") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx2) + cfg!(target_feature = "avx2") || $crate::detect::check_for( + $crate::detect::Feature::avx2) }; ("avx512f") => { - cfg!(target_feature = "avx512f") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512f) + cfg!(target_feature = "avx512f") || $crate::detect::check_for( + $crate::detect::Feature::avx512f) }; ("avx512cd") => { - cfg!(target_feature = "avx512cd") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512cd) + cfg!(target_feature = "avx512cd") || $crate::detect::check_for( + $crate::detect::Feature::avx512cd) }; ("avx512er") => { - cfg!(target_feature = "avx512er") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512er) + cfg!(target_feature = "avx512er") || $crate::detect::check_for( + $crate::detect::Feature::avx512er) }; ("avx512pf") => { - cfg!(target_feature = "avx512pf") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512pf) + cfg!(target_feature = "avx512pf") || $crate::detect::check_for( + $crate::detect::Feature::avx512pf) }; ("avx512bw") => { - cfg!(target_feature = "avx512bw") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512bw) + cfg!(target_feature = "avx512bw") || $crate::detect::check_for( + $crate::detect::Feature::avx512bw) }; ("avx512dq") => { - cfg!(target_feature = "avx512dq") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512dq) + cfg!(target_feature = "avx512dq") || $crate::detect::check_for( + $crate::detect::Feature::avx512dq) }; ("avx512vl") => { - cfg!(target_Feature = "avx512vl") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512vl) + cfg!(target_Feature = "avx512vl") || $crate::detect::check_for( + $crate::detect::Feature::avx512vl) }; ("avx512ifma") => { - cfg!(target_feature = "avx512ifma") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512_ifma) + cfg!(target_feature = "avx512ifma") || $crate::detect::check_for( + $crate::detect::Feature::avx512_ifma) }; ("avx512vbmi") => { - cfg!(target_feature = "avx512vbmi") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512_vbmi) + cfg!(target_feature = "avx512vbmi") || $crate::detect::check_for( + $crate::detect::Feature::avx512_vbmi) }; ("avx512vpopcntdq") => { - cfg!(target_feature = "avx512vpopcntdq") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::avx512_vpopcntdq) + cfg!(target_feature = "avx512vpopcntdq") || $crate::detect::check_for( + $crate::detect::Feature::avx512_vpopcntdq) }; ("fma") => { - cfg!(target_feature = "fma") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::fma) + cfg!(target_feature = "fma") || $crate::detect::check_for( + $crate::detect::Feature::fma) }; ("bmi1") => { - cfg!(target_feature = "bmi1") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::bmi) + cfg!(target_feature = "bmi1") || $crate::detect::check_for( + $crate::detect::Feature::bmi) }; ("bmi2") => { - cfg!(target_feature = "bmi2") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::bmi2) + cfg!(target_feature = "bmi2") || $crate::detect::check_for( + $crate::detect::Feature::bmi2) }; ("abm") => { - cfg!(target_feature = "abm") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::abm) + cfg!(target_feature = "abm") || $crate::detect::check_for( + $crate::detect::Feature::abm) }; ("lzcnt") => { - cfg!(target_feature = "lzcnt") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::abm) + cfg!(target_feature = "lzcnt") || $crate::detect::check_for( + $crate::detect::Feature::abm) }; ("tbm") => { - cfg!(target_feature = "tbm") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::tbm) + cfg!(target_feature = "tbm") || $crate::detect::check_for( + $crate::detect::Feature::tbm) }; ("popcnt") => { - cfg!(target_feature = "popcnt") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::popcnt) + cfg!(target_feature = "popcnt") || $crate::detect::check_for( + $crate::detect::Feature::popcnt) }; ("fxsr") => { - cfg!(target_feature = "fxsr") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::fxsr) + cfg!(target_feature = "fxsr") || $crate::detect::check_for( + $crate::detect::Feature::fxsr) }; ("xsave") => { - cfg!(target_feature = "xsave") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::xsave) + cfg!(target_feature = "xsave") || $crate::detect::check_for( + $crate::detect::Feature::xsave) }; ("xsaveopt") => { - cfg!(target_feature = "xsaveopt") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::xsaveopt) + cfg!(target_feature = "xsaveopt") || $crate::detect::check_for( + $crate::detect::Feature::xsaveopt) }; ("xsaves") => { - cfg!(target_feature = "xsaves") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::xsaves) + cfg!(target_feature = "xsaves") || $crate::detect::check_for( + $crate::detect::Feature::xsaves) }; ("xsavec") => { - cfg!(target_feature = "xsavec") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::xsavec) + cfg!(target_feature = "xsavec") || $crate::detect::check_for( + $crate::detect::Feature::xsavec) }; ("cmpxchg16b") => { - cfg!(target_feature = "cmpxchg16b") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::cmpxchg16b) + cfg!(target_feature = "cmpxchg16b") || $crate::detect::check_for( + $crate::detect::Feature::cmpxchg16b) }; ("adx") => { - cfg!(target_feature = "adx") || $crate::arch::detect::check_for( - $crate::arch::detect::Feature::adx) + cfg!(target_feature = "adx") || $crate::detect::check_for( + $crate::detect::Feature::adx) }; ($t:tt) => { compile_error!(concat!("unknown target feature: ", $t)) diff --git a/stdsimd/arch/detect/bit.rs b/crates/std_detect/src/detect/bit.rs similarity index 100% rename from stdsimd/arch/detect/bit.rs rename to crates/std_detect/src/detect/bit.rs diff --git a/stdsimd/arch/detect/cache.rs b/crates/std_detect/src/detect/cache.rs similarity index 98% rename from stdsimd/arch/detect/cache.rs rename to crates/std_detect/src/detect/cache.rs index ba81f35dcf..c2de4da734 100644 --- a/stdsimd/arch/detect/cache.rs +++ b/crates/std_detect/src/detect/cache.rs @@ -78,7 +78,8 @@ struct Cache(AtomicU64); impl Cache { /// Creates an uninitialized cache. const fn uninitialized() -> Self { - Cache(AtomicU64::new(u64::max_value())) + const X: AtomicU64 = AtomicU64::new(u64::max_value()); + Self(X) } /// Is the cache uninitialized? #[inline] diff --git a/stdsimd/arch/detect/error_macros.rs b/crates/std_detect/src/detect/error_macros.rs similarity index 100% rename from stdsimd/arch/detect/error_macros.rs rename to crates/std_detect/src/detect/error_macros.rs diff --git a/stdsimd/arch/detect/mod.rs b/crates/std_detect/src/detect/mod.rs similarity index 97% rename from stdsimd/arch/detect/mod.rs rename to crates/std_detect/src/detect/mod.rs index c7f55aa002..f446e88eed 100644 --- a/stdsimd/arch/detect/mod.rs +++ b/crates/std_detect/src/detect/mod.rs @@ -68,7 +68,7 @@ cfg_if! { // On x86/x86_64 no OS specific functionality is required. #[path = "os/x86.rs"] mod os; - } else if #[cfg(target_os = "linux")] { + } else if #[cfg(all(target_os = "linux", feature = "use_std"))] { #[path = "os/linux/mod.rs"] mod os; } else if #[cfg(target_os = "freebsd")] { diff --git a/stdsimd/arch/detect/os/aarch64.rs b/crates/std_detect/src/detect/os/aarch64.rs similarity index 98% rename from stdsimd/arch/detect/os/aarch64.rs rename to crates/std_detect/src/detect/os/aarch64.rs index a993619657..f28d15a7c3 100644 --- a/stdsimd/arch/detect/os/aarch64.rs +++ b/crates/std_detect/src/detect/os/aarch64.rs @@ -16,8 +16,7 @@ //! - [Zircon implementation](https://fuchsia.googlesource.com/zircon/+/master/kernel/arch/arm64/feature.cpp) //! - [Linux documentation](https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt) -use arch::detect::Feature; -use arch::detect::cache; +use crate::detect::{Feature, cache}; /// Try to read the features from the system registers. /// diff --git a/stdsimd/arch/detect/os/freebsd/aarch64.rs b/crates/std_detect/src/detect/os/freebsd/aarch64.rs similarity index 95% rename from stdsimd/arch/detect/os/freebsd/aarch64.rs rename to crates/std_detect/src/detect/os/freebsd/aarch64.rs index a1cf5cdd0e..910d2f33b3 100644 --- a/stdsimd/arch/detect/os/freebsd/aarch64.rs +++ b/crates/std_detect/src/detect/os/freebsd/aarch64.rs @@ -1,7 +1,6 @@ //! Run-time feature detection for Aarch64 on FreeBSD. -use arch::detect::Feature; -use arch::detect::cache; +use crate::detect::{Feature, cache}; use super::super::aarch64::detect_features; /// Performs run-time feature detection. diff --git a/stdsimd/arch/detect/os/freebsd/mod.rs b/crates/std_detect/src/detect/os/freebsd/mod.rs similarity index 100% rename from stdsimd/arch/detect/os/freebsd/mod.rs rename to crates/std_detect/src/detect/os/freebsd/mod.rs diff --git a/stdsimd/arch/detect/os/linux/aarch64.rs b/crates/std_detect/src/detect/os/linux/aarch64.rs similarity index 97% rename from stdsimd/arch/detect/os/linux/aarch64.rs rename to crates/std_detect/src/detect/os/linux/aarch64.rs index ebddf2d75d..f7dc0f0222 100644 --- a/stdsimd/arch/detect/os/linux/aarch64.rs +++ b/crates/std_detect/src/detect/os/linux/aarch64.rs @@ -1,10 +1,7 @@ //! Run-time feature detection for Aarch64 on Linux. -use arch::detect::Feature; -use arch::detect::cache; -use arch::detect::bit; -use super::auxvec; -use super::cpuinfo; +use crate::detect::{Feature, cache, bit}; +use super::{auxvec, cpuinfo}; /// Performs run-time feature detection. #[inline] diff --git a/stdsimd/arch/detect/os/linux/arm.rs b/crates/std_detect/src/detect/os/linux/arm.rs similarity index 93% rename from stdsimd/arch/detect/os/linux/arm.rs rename to crates/std_detect/src/detect/os/linux/arm.rs index 9d265e02db..0d58a847cd 100644 --- a/stdsimd/arch/detect/os/linux/arm.rs +++ b/crates/std_detect/src/detect/os/linux/arm.rs @@ -1,10 +1,7 @@ //! Run-time feature detection for ARM on Linux. -use arch::detect::Feature; -use arch::detect::cache; -use arch::detect::bit; -use super::auxvec; -use super::cpuinfo; +use crate::detect::{Feature, cache, bit}; +use super::{auxvec, cpuinfo}; /// Performs run-time feature detection. #[inline] diff --git a/stdsimd/arch/detect/os/linux/auxvec.rs b/crates/std_detect/src/detect/os/linux/auxvec.rs similarity index 92% rename from stdsimd/arch/detect/os/linux/auxvec.rs rename to crates/std_detect/src/detect/os/linux/auxvec.rs index 20fbb5f588..31c980fd38 100644 --- a/stdsimd/arch/detect/os/linux/auxvec.rs +++ b/crates/std_detect/src/detect/os/linux/auxvec.rs @@ -1,10 +1,10 @@ //! Parses ELF auxiliary vectors. #![cfg_attr(not(target_arch = "aarch64"), allow(dead_code))] -use mem; -use prelude::v1::*; -use fs::File; -use io::Read; +extern crate std; +use self::std::{prelude::v1::*, fs::File, io::Read}; + +use core::mem; /// Key to access the CPU Hardware capabilities bitfield. pub(crate) const AT_HWCAP: usize = 16; @@ -214,9 +214,9 @@ mod tests { if #[cfg(target_arch = "arm")] { #[test] fn linux_rpi3() { - let v = auxv_from_file( - "../../stdsimd/arch/detect/test_data/linux-rpi3.auxv", - ).unwrap(); + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv"); + println!("file: {}", file); + let v = auxv_from_file(file).unwrap(); assert_eq!(v.hwcap, 4174038); assert_eq!(v.hwcap2, 16); } @@ -224,9 +224,9 @@ mod tests { #[test] #[should_panic] fn linux_macos_vb() { - let _ = auxv_from_file( - "../../stdsimd/arch/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv" - ).unwrap(); + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv"); + println!("file: {}", file); + let v = auxv_from_file(file).unwrap(); // this file is incomplete (contains hwcap but not hwcap2), we // want to fall back to /proc/cpuinfo in this case, so // reading should fail. assert_eq!(v.hwcap, 126614527); @@ -235,9 +235,9 @@ mod tests { } else if #[cfg(target_arch = "aarch64")] { #[test] fn linux_x64() { - let v = auxv_from_file( - "../../stdsimd/arch/detect/test_data/linux-x64-i7-6850k.auxv", - ).unwrap(); + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-x64-i7-6850k.auxv"); + println!("file: {}", file); + let v = auxv_from_file(file).unwrap(); assert_eq!(v.hwcap, 3219913727); } } diff --git a/stdsimd/arch/detect/os/linux/cpuinfo.rs b/crates/std_detect/src/detect/os/linux/cpuinfo.rs similarity index 99% rename from stdsimd/arch/detect/os/linux/cpuinfo.rs rename to crates/std_detect/src/detect/os/linux/cpuinfo.rs index fd7b5876f3..b316857853 100644 --- a/stdsimd/arch/detect/os/linux/cpuinfo.rs +++ b/crates/std_detect/src/detect/os/linux/cpuinfo.rs @@ -1,9 +1,8 @@ //! Parses /proc/cpuinfo #![cfg_attr(not(target_arch = "arm"), allow(dead_code))] -use prelude::v1::*; -use fs::File; -use io::{self, Read}; +extern crate std; +use self::std::{prelude::v1::*, fs::File, io, io::Read}; /// cpuinfo pub(crate) struct CpuInfo { diff --git a/stdsimd/arch/detect/os/linux/mips.rs b/crates/std_detect/src/detect/os/linux/mips.rs similarity index 92% rename from stdsimd/arch/detect/os/linux/mips.rs rename to crates/std_detect/src/detect/os/linux/mips.rs index 92e95f057e..7c180326fe 100644 --- a/stdsimd/arch/detect/os/linux/mips.rs +++ b/crates/std_detect/src/detect/os/linux/mips.rs @@ -1,8 +1,6 @@ //! Run-time feature detection for MIPS on Linux. -use arch::detect::Feature; -use arch::detect::cache; -use arch::detect::bit; +use crate::detect::{Feature, cache, bit}; use super::auxvec; /// Performs run-time feature detection. diff --git a/stdsimd/arch/detect/os/linux/mod.rs b/crates/std_detect/src/detect/os/linux/mod.rs similarity index 95% rename from stdsimd/arch/detect/os/linux/mod.rs rename to crates/std_detect/src/detect/os/linux/mod.rs index 11ac012e24..642dfb4657 100644 --- a/stdsimd/arch/detect/os/linux/mod.rs +++ b/crates/std_detect/src/detect/os/linux/mod.rs @@ -17,7 +17,7 @@ cfg_if! { mod powerpc; pub use self::powerpc::check_for; } else { - use arch::detect::Feature; + use crate::detect::Feature; /// Performs run-time feature detection. pub fn check_for(_x: Feature) -> bool { false diff --git a/stdsimd/arch/detect/os/linux/powerpc.rs b/crates/std_detect/src/detect/os/linux/powerpc.rs similarity index 94% rename from stdsimd/arch/detect/os/linux/powerpc.rs rename to crates/std_detect/src/detect/os/linux/powerpc.rs index 41f58508f2..0022a7db98 100644 --- a/stdsimd/arch/detect/os/linux/powerpc.rs +++ b/crates/std_detect/src/detect/os/linux/powerpc.rs @@ -1,9 +1,7 @@ //! Run-time feature detection for PowerPC on Linux. -use arch::detect::Feature; -use arch::detect::cache; -use super::auxvec; -use super::cpuinfo; +use crate::detect::{Feature, cache}; +use super::{auxvec, cpuinfo}; /// Performs run-time feature detection. #[inline] diff --git a/stdsimd/arch/detect/os/other.rs b/crates/std_detect/src/detect/os/other.rs similarity index 82% rename from stdsimd/arch/detect/os/other.rs rename to crates/std_detect/src/detect/os/other.rs index 562cbfe8f1..23e399ea79 100644 --- a/stdsimd/arch/detect/os/other.rs +++ b/crates/std_detect/src/detect/os/other.rs @@ -1,6 +1,6 @@ //! Other operating systems -use arch::detect::Feature; +use crate::detect::Feature; /// Performs run-time feature detection. #[inline] diff --git a/stdsimd/arch/detect/os/x86.rs b/crates/std_detect/src/detect/os/x86.rs similarity index 98% rename from stdsimd/arch/detect/os/x86.rs rename to crates/std_detect/src/detect/os/x86.rs index ab49a6b4e7..9237d5dc0a 100644 --- a/stdsimd/arch/detect/os/x86.rs +++ b/crates/std_detect/src/detect/os/x86.rs @@ -1,15 +1,12 @@ //! x86 run-time feature detection is OS independent. -use core::prelude::v1::*; -use core::mem; +use core::{prelude::v1::*, mem}; #[cfg(target_arch = "x86")] -use coresimd::arch::x86::*; +use core::arch::x86::*; #[cfg(target_arch = "x86_64")] -use coresimd::arch::x86_64::*; +use core::arch::x86_64::*; -use arch::detect::Feature; -use arch::detect::cache; -use arch::detect::bit; +use crate::detect::{Feature, cache, bit}; /// Performs run-time feature detection. #[inline] diff --git a/stdsimd/arch/detect/test_data/linux-rpi3.auxv b/crates/std_detect/src/detect/test_data/linux-rpi3.auxv similarity index 100% rename from stdsimd/arch/detect/test_data/linux-rpi3.auxv rename to crates/std_detect/src/detect/test_data/linux-rpi3.auxv diff --git a/stdsimd/arch/detect/test_data/linux-x64-i7-6850k.auxv b/crates/std_detect/src/detect/test_data/linux-x64-i7-6850k.auxv similarity index 100% rename from stdsimd/arch/detect/test_data/linux-x64-i7-6850k.auxv rename to crates/std_detect/src/detect/test_data/linux-x64-i7-6850k.auxv diff --git a/stdsimd/arch/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv b/crates/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv similarity index 100% rename from stdsimd/arch/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv rename to crates/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv diff --git a/crates/std_detect/src/lib.rs b/crates/std_detect/src/lib.rs new file mode 100644 index 0000000000..af7fc3bdc4 --- /dev/null +++ b/crates/std_detect/src/lib.rs @@ -0,0 +1,37 @@ +//! Run-time feature detection for the Rust standard library. +//! +//! To detect whether a feature is enabled in the system running the binary +//! use one of the appropriate macro for the target: +//! +//! * `x86` and `x86_64`: [`is_x86_feature_detected`] +//! * `arm`: [`is_arm_feature_detected`] +//! * `aarch64`: [`is_aarch64_feature_detected`] +//! * `mips`: [`is_mips_feature_detected`] +//! * `mips64`: [`is_mips64_feature_detected`] +//! * `powerpc`: [`is_powerpc_feature_detected`] +//! * `powerpc64`: [`is_powerpc64_feature_detected`] + +#![unstable(feature = "stdsimd", issue = "27731")] +#![feature(const_fn, integer_atomics, staged_api, stdsimd)] +#![feature(doc_cfg, allow_internal_unstable)] +#![cfg_attr(feature = "cargo-clippy", allow(clippy::shadow_reuse))] +#![cfg_attr( + feature = "cargo-clippy", + deny(clippy::missing_inline_in_public_items,) +)] +#![cfg_attr(target_os = "linux", feature(linkage))] +#![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(asm))] +#![no_std] + +#[cfg(test)] +#[macro_use(println)] +extern crate std; + +extern crate libc; + +#[macro_use] +extern crate cfg_if; + +#[doc(hidden)] +#[unstable(feature = "stdsimd", issue = "27731")] +pub mod detect; diff --git a/crates/std_detect/src/mod.rs b/crates/std_detect/src/mod.rs new file mode 100644 index 0000000000..b630e7ff38 --- /dev/null +++ b/crates/std_detect/src/mod.rs @@ -0,0 +1,5 @@ +//! `std_detect` + +#[doc(hidden)] // unstable implementation detail +#[unstable(feature = "stdsimd", issue = "27731")] +pub mod detect; diff --git a/crates/stdsimd/tests/cpu-detection.rs b/crates/std_detect/tests/cpu-detection.rs similarity index 99% rename from crates/stdsimd/tests/cpu-detection.rs rename to crates/std_detect/tests/cpu-detection.rs index 636d530ef9..85beeee63a 100644 --- a/crates/stdsimd/tests/cpu-detection.rs +++ b/crates/std_detect/tests/cpu-detection.rs @@ -14,7 +14,7 @@ target_arch = "powerpc64" ))] #[macro_use] -extern crate stdsimd; +extern crate std_detect; #[test] #[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))] diff --git a/crates/stdsimd-verify/build.rs b/crates/stdsimd-verify/build.rs index 314de67e40..c0dc81b6a6 100644 --- a/crates/stdsimd-verify/build.rs +++ b/crates/stdsimd-verify/build.rs @@ -3,14 +3,16 @@ use std::path::Path; fn main() { let dir = Path::new(env!("CARGO_MANIFEST_DIR")); let root = dir.parent().unwrap(); - walk(&root.join("../coresimd/x86")); - walk(&root.join("../coresimd/x86_64")); - walk(&root.join("../coresimd/arm")); - walk(&root.join("../coresimd/aarch64")); + eprintln!("root: {}", root.display()); + walk(&root.join("core_arch/src/x86")); + walk(&root.join("core_arch/src/x86_64")); + walk(&root.join("core_arch/src/arm")); + walk(&root.join("core_arch/src/aarch64")); } fn walk(root: &Path) { for file in root.read_dir().unwrap() { + eprintln!("root: {}", root.display()); let file = file.unwrap(); if file.file_type().unwrap().is_dir() { walk(&file.path()); diff --git a/crates/stdsimd-verify/src/lib.rs b/crates/stdsimd-verify/src/lib.rs index 751614bbf8..45cb5f5dbc 100644 --- a/crates/stdsimd-verify/src/lib.rs +++ b/crates/stdsimd-verify/src/lib.rs @@ -13,12 +13,12 @@ use proc_macro::TokenStream; #[proc_macro] pub fn x86_functions(input: TokenStream) -> TokenStream { - functions(input, &["../coresimd/x86", "../coresimd/x86_64"]) + functions(input, &["core_arch/src/x86", "core_arch/src/x86_64"]) } #[proc_macro] pub fn arm_functions(input: TokenStream) -> TokenStream { - functions(input, &["../coresimd/arm", "../coresimd/aarch64"]) + functions(input, &["core_arch/src/arm", "core_arch/src/aarch64"]) } fn functions(input: TokenStream, dirs: &[&str]) -> TokenStream { diff --git a/crates/stdsimd/src/lib.rs b/crates/stdsimd/src/lib.rs deleted file mode 100644 index 594adccf05..0000000000 --- a/crates/stdsimd/src/lib.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! SIMD and vendor intrinsics support library. -//! -//! This crate defines the vendor intrinsics and types primarily used for SIMD -//! in Rust. - -#![feature(const_fn, integer_atomics, staged_api, stdsimd)] -#![feature(doc_cfg, allow_internal_unstable)] -#![cfg_attr(feature = "cargo-clippy", allow(clippy::shadow_reuse))] -#![cfg_attr( - feature = "cargo-clippy", - deny(clippy::missing_inline_in_public_items,) -)] -#![cfg_attr(target_os = "linux", feature(linkage))] -#![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(asm))] -#![no_std] -#![unstable(feature = "stdsimd", issue = "27731")] - -#[macro_use] -extern crate cfg_if; -extern crate coresimd; -extern crate libc; -extern crate std as __do_not_use_this_import; - -#[cfg(test)] -#[allow(unused_imports)] -#[macro_use(println, print)] -extern crate std; - -#[path = "../../../stdsimd/mod.rs"] -mod stdsimd; - -pub use stdsimd::*; - -#[allow(unused_imports)] -use __do_not_use_this_import::fs; -#[allow(unused_imports)] -use __do_not_use_this_import::io; -#[allow(unused_imports)] -use __do_not_use_this_import::mem; -#[allow(unused_imports)] -use __do_not_use_this_import::prelude; diff --git a/examples/Cargo.toml b/examples/Cargo.toml new file mode 100644 index 0000000000..6ac184606e --- /dev/null +++ b/examples/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "stdsimd_examples" +version = "0.0.0" +authors = [ + "Alex Crichton ", + "Andrew Gallant ", + "Gonzalo Brito Gadeschi ", +] +description = "Examples of the stdsimd crate." + +[dependencies] +core_arch = { path = "../crates/core_arch" } +std_detect = { path = "../crates/std_detect" } +quickcheck = "0.8" +rand = "0.6" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +rand = { version = "0.6", features = ["wasm-bindgen"] } + +[[bin]] +name = "hex" +path = "hex.rs" + +[[example]] +name = "wasm" +crate-type = ["cdylib"] +path = "wasm.rs" diff --git a/examples/hex.rs b/examples/hex.rs index 28b8581985..37f2ce7016 100644 --- a/examples/hex.rs +++ b/examples/hex.rs @@ -8,7 +8,7 @@ //! //! You can test out this program via: //! -//! echo test | cargo +nightly run --release --example hex -p stdsimd +//! echo test | cargo +nightly run --release hex //! //! and you should see `746573740a` get printed out. @@ -28,11 +28,10 @@ )] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -#[macro_use] -extern crate stdsimd; +#[macro_use(is_x86_feature_detected)] +extern crate std_detect; -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -extern crate stdsimd; +extern crate core_arch; #[cfg(test)] #[macro_use] @@ -42,9 +41,9 @@ use std::io::{self, Read}; use std::str; #[cfg(target_arch = "x86")] -use stdsimd::arch::x86::*; +use core_arch::arch::x86::*; #[cfg(target_arch = "x86_64")] -use stdsimd::arch::x86_64::*; +use core_arch::arch::x86_64::*; fn main() { let mut input = Vec::new(); @@ -290,8 +289,9 @@ mod benches { len: usize, f: for<'a> unsafe fn(&[u8], &'a mut [u8]) -> Result<&'a str, usize>, ) { - let input = rand::thread_rng() - .gen_iter::() + let mut rng = rand::thread_rng(); + let input = std::iter::repeat(()) + .map(|()| rng.gen::()) .take(len) .collect::>(); let mut dst = vec![0; input.len() * 2]; diff --git a/examples/wasm.rs b/examples/wasm.rs index 6d0fdeb02b..93124e6927 100644 --- a/examples/wasm.rs +++ b/examples/wasm.rs @@ -3,11 +3,11 @@ #![feature(stdsimd)] #![cfg(target_arch = "wasm32")] -extern crate stdsimd; +extern crate core_arch; use std::ptr; -use stdsimd::arch::wasm32::*; +use core_arch::arch::wasm32::*; static mut HEAD: *mut *mut u8 = 0 as _;