Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8e4ad29
Disable NEON on musl ARMv7
sanxiyn Feb 23, 2018
ffb6291
Improve --help performance for x.py
Phlosioneer Feb 27, 2018
0c9afa8
Provide missing comma in match arm suggestion
estebank Feb 18, 2018
ba7039c
Detect missing `if` blocks
estebank Feb 19, 2018
36baa81
Add label to primary span in some parse errors
estebank Feb 19, 2018
d63d363
Diagnostic tweaks (review)
estebank Feb 24, 2018
24be75d
fix rebase
estebank Feb 28, 2018
5ac4f62
impl Clone for ::std_unicode::char::{ToLowercase, ToUppercase}
strake Mar 1, 2018
39d0b05
Restore the download of rust-mingw
segevfiner Mar 1, 2018
5332d9a
Document why we download rust-mingw
segevfiner Mar 1, 2018
2e9d9d4
rustc: More stable hashes of command line arguments
alexcrichton Mar 1, 2018
2269ff5
Remove print_what_bootstrap_means
Phlosioneer Mar 2, 2018
9d2f1e5
Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkov
Manishearth Mar 2, 2018
4d63f81
std: Add `arch` and `simd` modules
alexcrichton Feb 18, 2018
c54f204
Rollup merge of #48637 - segevfiner:restore-rust-mingw-download, r=al…
Manishearth Mar 2, 2018
a6f6f2e
Rollup merge of #48466 - sanxiyn:no-neon, r=alexcrichton
Manishearth Mar 2, 2018
03f32b9
Rollup merge of #48569 - Phlosioneer:x-py-help-optimization, r=petroc…
Manishearth Mar 2, 2018
a000d41
Rollup merge of #48629 - strake:char, r=alexcrichton
Manishearth Mar 2, 2018
a62c9d5
Rollup merge of #48513 - alexcrichton:simd, r=JoshTriplett
Manishearth Mar 2, 2018
bc90898
Rollup merge of #48641 - alexcrichton:no-hash-l-paths, r=michaelwoeri…
Manishearth Mar 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
std: Add arch and simd modules
This commit imports the `stdsimd` crate into the standard library,
creating an `arch` and `simd` module inside of both libcore and libstd.
Both of these modules are **unstable** and will continue to be so until
RFC 2335 is stabilized.

As a brief recap, the modules are organized as so:

* `arch` contains all current architectures with intrinsics, for example
  `std::arch::x86`, `std::arch::x86_64`, `std::arch::arm`, etc. These
  modules contain all of the intrinsics defined for the platform, like
  `_mm_set1_epi8`.
* In the standard library, the `arch` module also exports a
  `is_target_feature_detected` macro which performs runtime detection to
  determine whether a target feature is available at runtime.
* The `simd` module contains experimental versions of strongly-typed
  lane-aware SIMD primitives, to be fully fleshed out in a future RFC.

The main purpose of this commit is to start pulling in all these
intrinsics and such into the standard library on nightly and allow
testing and such. This'll help allow users to easily kick the tires and
see if intrinsics work as well as allow us to test out all the
infrastructure for moving the intrinsics into the standard library.
  • Loading branch information
alexcrichton committed Mar 2, 2018
commit 4d63f8161b832f9c30f1c9815ceb6b5226eb85fa
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@
[submodule "src/llvm-emscripten"]
path = src/llvm-emscripten
url = https://github.com/rust-lang/llvm
[submodule "src/stdsimd"]
path = src/stdsimd
url = https://github.com/rust-lang-nursery/stdsimd
33 changes: 29 additions & 4 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,39 @@
#![feature(allow_internal_unstable)]
#![feature(asm)]
#![feature(associated_type_defaults)]
#![feature(attr_literals)]
#![feature(cfg_target_feature)]
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(custom_attribute)]
#![feature(doc_spotlight)]
#![feature(fundamental)]
#![feature(i128_type)]
#![feature(inclusive_range_syntax)]
#![feature(intrinsics)]
#![feature(iterator_flatten)]
#![feature(iterator_repeat_with)]
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(never_type)]
#![feature(no_core)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
#![feature(prelude_import)]
#![feature(repr_simd, platform_intrinsics)]
#![feature(rustc_attrs)]
#![feature(rustc_const_unstable)]
#![feature(simd_ffi)]
#![feature(specialization)]
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]
#![feature(target_feature)]
#![feature(unboxed_closures)]
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![feature(doc_spotlight)]
#![feature(rustc_const_unstable)]
#![feature(iterator_repeat_with)]
#![feature(iterator_flatten)]

#![cfg_attr(stage0, allow(unused_attributes))]

#[prelude_import]
#[allow(unused)]
Expand Down Expand Up @@ -179,3 +186,21 @@ mod char_private;
mod iter_private;
mod tuple;
mod unit;

// Pull in the the `coresimd` crate directly into libcore. This is where all the
// architecture-specific (and vendor-specific) intrinsics are defined. AKA
// things like SIMD and such. Note that the actual source for all this lies in a
// different repository, rust-lang-nursery/stdsimd. That's why the setup here is
// a bit wonky.
#[path = "../stdsimd/coresimd/mod.rs"]
#[allow(missing_docs, missing_debug_implementations, dead_code)]
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
mod coresimd;

#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(not(stage0))]
pub use coresimd::simd;
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(not(stage0))]
pub use coresimd::arch;
30 changes: 30 additions & 0 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
#![feature(rand)]
#![feature(raw)]
#![feature(rustc_attrs)]
#![feature(stdsimd)]
#![feature(sip_hash_13)]
#![feature(slice_bytes)]
#![feature(slice_concat_ext)]
Expand Down Expand Up @@ -501,6 +502,35 @@ mod memchr;
// compiler
pub mod rt;

// Pull in the the `stdsimd` crate directly into libstd. This is the same as
// libcore's arch/simd modules where the source of truth here is in a different
// repository, but we pull things in here manually to get it into libstd.
//
// Note that the #[cfg] here is intended to do two things. First it allows us to
// change the rustc implementation of intrinsics in stage0 by not compiling simd
// intrinsics in stage0. Next it doesn't compile anything in test mode as
// stdsimd has tons of its own tests which we don't want to run.
#[path = "../stdsimd/stdsimd/mod.rs"]
#[allow(missing_debug_implementations, missing_docs)]
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test)))]
mod stdsimd;

// A "fake" module needed by the `stdsimd` module to compile, not actually
// exported though.
#[cfg(not(stage0))]
mod coresimd {
pub use core::arch;
pub use core::simd;
}

#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test)))]
pub use stdsimd::simd;
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test)))]
pub use stdsimd::arch;

// Include a number of private modules that exist solely to provide
// the rustdoc documentation for primitive types. Using `include!`
// because rustdoc only looks for these modules at the crate level.
Expand Down
1 change: 1 addition & 0 deletions src/stdsimd
Submodule stdsimd added at 678cbd
1 change: 1 addition & 0 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fn filter_dirs(path: &Path) -> bool {
"src/librustc/mir/interpret",
"src/librustc_mir/interpret",
"src/target",
"src/stdsimd",
];
skip.iter().any(|p| path.ends_with(p))
}
Expand Down