Skip to content

Commit a62c9d5

Browse files
committed
Rollup merge of #48513 - alexcrichton:simd, r=JoshTriplett
Fixes #47311. r? @nrc
2 parents a000d41 + 4d63f81 commit a62c9d5

File tree

5 files changed

+64
-4
lines changed

5 files changed

+64
-4
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@
5050
[submodule "src/llvm-emscripten"]
5151
path = src/llvm-emscripten
5252
url = https://github.com/rust-lang/llvm
53+
[submodule "src/stdsimd"]
54+
path = src/stdsimd
55+
url = https://github.com/rust-lang-nursery/stdsimd

src/libcore/lib.rs

+29-4
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,39 @@
6868
#![feature(allow_internal_unstable)]
6969
#![feature(asm)]
7070
#![feature(associated_type_defaults)]
71+
#![feature(attr_literals)]
7172
#![feature(cfg_target_feature)]
7273
#![feature(cfg_target_has_atomic)]
7374
#![feature(concat_idents)]
7475
#![feature(const_fn)]
7576
#![feature(custom_attribute)]
77+
#![feature(doc_spotlight)]
7678
#![feature(fundamental)]
7779
#![feature(i128_type)]
7880
#![feature(inclusive_range_syntax)]
7981
#![feature(intrinsics)]
82+
#![feature(iterator_flatten)]
83+
#![feature(iterator_repeat_with)]
8084
#![feature(lang_items)]
85+
#![feature(link_llvm_intrinsics)]
8186
#![feature(never_type)]
8287
#![feature(no_core)]
8388
#![feature(on_unimplemented)]
8489
#![feature(optin_builtin_traits)]
8590
#![feature(prelude_import)]
8691
#![feature(repr_simd, platform_intrinsics)]
8792
#![feature(rustc_attrs)]
93+
#![feature(rustc_const_unstable)]
94+
#![feature(simd_ffi)]
8895
#![feature(specialization)]
8996
#![feature(staged_api)]
97+
#![feature(stmt_expr_attributes)]
98+
#![feature(target_feature)]
9099
#![feature(unboxed_closures)]
91100
#![feature(untagged_unions)]
92101
#![feature(unwind_attributes)]
93-
#![feature(doc_spotlight)]
94-
#![feature(rustc_const_unstable)]
95-
#![feature(iterator_repeat_with)]
96-
#![feature(iterator_flatten)]
102+
103+
#![cfg_attr(stage0, allow(unused_attributes))]
97104

98105
#[prelude_import]
99106
#[allow(unused)]
@@ -179,3 +186,21 @@ mod char_private;
179186
mod iter_private;
180187
mod tuple;
181188
mod unit;
189+
190+
// Pull in the the `coresimd` crate directly into libcore. This is where all the
191+
// architecture-specific (and vendor-specific) intrinsics are defined. AKA
192+
// things like SIMD and such. Note that the actual source for all this lies in a
193+
// different repository, rust-lang-nursery/stdsimd. That's why the setup here is
194+
// a bit wonky.
195+
#[path = "../stdsimd/coresimd/mod.rs"]
196+
#[allow(missing_docs, missing_debug_implementations, dead_code)]
197+
#[unstable(feature = "stdsimd", issue = "48556")]
198+
#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
199+
mod coresimd;
200+
201+
#[unstable(feature = "stdsimd", issue = "48556")]
202+
#[cfg(not(stage0))]
203+
pub use coresimd::simd;
204+
#[unstable(feature = "stdsimd", issue = "48556")]
205+
#[cfg(not(stage0))]
206+
pub use coresimd::arch;

src/libstd/lib.rs

+30
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
#![feature(rand)]
300300
#![feature(raw)]
301301
#![feature(rustc_attrs)]
302+
#![feature(stdsimd)]
302303
#![feature(sip_hash_13)]
303304
#![feature(slice_bytes)]
304305
#![feature(slice_concat_ext)]
@@ -501,6 +502,35 @@ mod memchr;
501502
// compiler
502503
pub mod rt;
503504

505+
// Pull in the the `stdsimd` crate directly into libstd. This is the same as
506+
// libcore's arch/simd modules where the source of truth here is in a different
507+
// repository, but we pull things in here manually to get it into libstd.
508+
//
509+
// Note that the #[cfg] here is intended to do two things. First it allows us to
510+
// change the rustc implementation of intrinsics in stage0 by not compiling simd
511+
// intrinsics in stage0. Next it doesn't compile anything in test mode as
512+
// stdsimd has tons of its own tests which we don't want to run.
513+
#[path = "../stdsimd/stdsimd/mod.rs"]
514+
#[allow(missing_debug_implementations, missing_docs)]
515+
#[unstable(feature = "stdsimd", issue = "48556")]
516+
#[cfg(all(not(stage0), not(test)))]
517+
mod stdsimd;
518+
519+
// A "fake" module needed by the `stdsimd` module to compile, not actually
520+
// exported though.
521+
#[cfg(not(stage0))]
522+
mod coresimd {
523+
pub use core::arch;
524+
pub use core::simd;
525+
}
526+
527+
#[unstable(feature = "stdsimd", issue = "48556")]
528+
#[cfg(all(not(stage0), not(test)))]
529+
pub use stdsimd::simd;
530+
#[unstable(feature = "stdsimd", issue = "48556")]
531+
#[cfg(all(not(stage0), not(test)))]
532+
pub use stdsimd::arch;
533+
504534
// Include a number of private modules that exist solely to provide
505535
// the rustdoc documentation for primitive types. Using `include!`
506536
// because rustdoc only looks for these modules at the crate level.

src/stdsimd

Submodule stdsimd added at 678cbd3

src/tools/tidy/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ fn filter_dirs(path: &Path) -> bool {
7171
"src/librustc/mir/interpret",
7272
"src/librustc_mir/interpret",
7373
"src/target",
74+
"src/stdsimd",
7475
];
7576
skip.iter().any(|p| path.ends_with(p))
7677
}

0 commit comments

Comments
 (0)