Skip to content

Commit

Permalink
Reorganize and refactor source tree (rust-lang#324)
Browse files Browse the repository at this point in the history
With RFC 2325 looking close to being accepted, I took a crack at
reorganizing this repository to being more amenable for inclusion in
libstd/libcore. My current plan is to add stdsimd as a submodule in
rust-lang/rust and then use `#[path]` to include the modules directly
into libstd/libcore.

Before this commit, however, the source code of coresimd/stdsimd
themselves were not quite ready for this. Imports wouldn't compile for
one reason or another, and the organization was also different than the
RFC itself!

In addition to moving a lot of files around, this commit has the
following major changes:

* The `cfg_feature_enabled!` macro is now renamed to
  `is_target_feature_detected!`
* The `vendor` module is now called `arch`.
* Under the `arch` module is a suite of modules like `x86`, `x86_64`,
  etc. One per `cfg!(target_arch)`.
* The `is_target_feature_detected!` macro was removed from coresimd.
  Unfortunately libcore has no ability to export unstable macros, so for
  now all feature detection is canonicalized in stdsimd.

The `coresimd` and `stdsimd` crates have been updated to the planned
organization in RFC 2325 as well. The runtime bits saw the largest
amount of refactoring, seeing a good deal of simplification without the
core/std split.
  • Loading branch information
alexcrichton authored Feb 18, 2018
1 parent b01b28f commit 80a524d
Show file tree
Hide file tree
Showing 123 changed files with 1,843 additions and 2,042 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ matrix:
- env: DOCUMENTATION
install: true
script: ci/dox.sh
- script: cargo test --manifest-path stdsimd-verify/Cargo.toml
- script: cargo test --manifest-path crates/stdsimd-verify/Cargo.toml
install: true
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
script: |
Expand Down
40 changes: 4 additions & 36 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
[package]
name = "stdsimd"
version = "0.0.3"
authors = ["Andrew Gallant <[email protected]>"]
description = "SIMD support in Rust's standard library."
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"]
categories = ["hardware-support"]
license = "MIT/Apache-2.0"

[workspace]
members = ["stdsimd-verify"]

[badges]
travis-ci = { repository = "rust-lang-nursery/stdsimd" }
appveyor = { repository = "rust-lang-nursery/stdsimd" }
is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/stdsimd" }
is-it-maintained-open-issues = { repository = "rust-lang-nursery/stdsimd" }
maintenance = { status = "experimental" }

[dependencies]
coresimd = { version = "0.0.3", path = "coresimd/" }

[dev-dependencies]
auxv = "0.3.3"
quickcheck = "0.6"
rand = "0.4"
members = [
"crates/stdsimd-verify",
"crates/stdsimd",
]

[profile.release]
debug = true
Expand All @@ -36,10 +11,3 @@ opt-level = 3
[profile.bench]
debug = 1
opt-level = 3

[features]
# Internal-usage only: denies all warnings.
strict = [ "coresimd/strict" ]
# Internal-usage only: enables only those intrinsics supported by Intel's
# Software Development Environment (SDE).
intel_sde = [ "coresimd/intel_sde" ]
10 changes: 6 additions & 4 deletions ci/dox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ dox() {
rm -rf target/doc/$arch
mkdir target/doc/$arch

cargo build --target $target
cargo build --target $target --manifest-path crates/stdsimd/Cargo.toml

rustdoc --target $target \
-o target/doc/$arch coresimd/src/lib.rs \
-o target/doc/$arch crates/coresimd/src/lib.rs \
--crate-name coresimd \
--library-path target/$target/debug/deps
rustdoc --target $target \
-o target/doc/$arch src/lib.rs \
-o target/doc/$arch crates/stdsimd/src/lib.rs \
--crate-name stdsimd \
--library-path target/$target/debug/deps
--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`
}

dox i686 i686-unknown-linux-gnu
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo "OBJDUMP=${OBJDUMP}"

cargo_test() {
cmd="cargo test --target=$TARGET --features $FEATURES $1"
cmd="$cmd -p coresimd -p stdsimd"
cmd="$cmd -p coresimd -p stdsimd --manifest-path crates/stdsimd/Cargo.toml"
cmd="$cmd -- $2"
$cmd
}
Expand Down
1 change: 0 additions & 1 deletion coresimd/LICENSE-APACHE

This file was deleted.

1 change: 0 additions & 1 deletion coresimd/LICENSE-MIT

This file was deleted.

1 change: 0 additions & 1 deletion coresimd/README.md

This file was deleted.

File renamed without changes.
8 changes: 4 additions & 4 deletions coresimd/src/aarch64/neon.rs → coresimd/aarch64/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#[cfg(test)]
use stdsimd_test::assert_instr;
use simd_llvm::simd_add;
use v128::f64x2;
use coresimd::simd_llvm::simd_add;
use coresimd::v128::f64x2;

/// Vector add.
#[inline]
Expand Down Expand Up @@ -41,8 +41,8 @@ pub unsafe fn vaddd_u64(a: u64, b: u64) -> u64 {

#[cfg(test)]
mod tests {
use super::f64x2;
use aarch64::neon;
use simd::f64x2;
use coresimd::aarch64::neon;
use stdsimd_test::simd_test;

#[simd_test = "neon"]
Expand Down
2 changes: 1 addition & 1 deletion coresimd/src/aarch64/v8.rs → coresimd/aarch64/v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub unsafe fn _cls_u64(x: u64) -> u64 {

#[cfg(test)]
mod tests {
use aarch64::v8;
use coresimd::aarch64::v8;

#[test]
fn _rev_u64() {
Expand Down
File renamed without changes.
9 changes: 4 additions & 5 deletions coresimd/src/arm/neon.rs → coresimd/arm/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
#[cfg(test)]
use stdsimd_test::assert_instr;

use simd_llvm::simd_add;

use v64::{f32x2, i16x4, i32x2, i8x8, u16x4, u32x2, u8x8};
use v128::{f32x4, i16x8, i32x4, i64x2, i8x16, u16x8, u32x4, u64x2, u8x16};
use coresimd::simd_llvm::simd_add;
use coresimd::v64::*;
use coresimd::v128::*;

/// Vector add.
#[inline]
Expand Down Expand Up @@ -216,7 +215,7 @@ pub unsafe fn vrsqrte_f32(a: f32x2) -> f32x2 {
mod tests {
use stdsimd_test::simd_test;
use simd::*;
use arm::neon;
use coresimd::arm::neon;

#[simd_test = "neon"]
unsafe fn vadd_s8() {
Expand Down
2 changes: 1 addition & 1 deletion coresimd/src/arm/v6.rs → coresimd/arm/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub unsafe fn _rev_u32(x: u32) -> u32 {

#[cfg(test)]
mod tests {
use arm::v6;
use coresimd::arm::v6;

#[test]
fn _rev_u16() {
Expand Down
2 changes: 1 addition & 1 deletion coresimd/src/arm/v7.rs → coresimd/arm/v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {

#[cfg(test)]
mod tests {
use arm::v7;
use coresimd::arm::v7;

#[test]
fn _clz_u8() {
Expand Down
Loading

0 comments on commit 80a524d

Please sign in to comment.