Stabilize x86/x86_64 SIMD
This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably this commit is stabilizing: * The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside. * The `is_x86_feature_detected!` macro in the standard library * The `#[target_feature(enable = "...")]` attribute * The `#[cfg(target_feature = "...")]` matcher Stabilization of the module and intrinsics were primarily done in rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in this commit. The standard library is also tweaked a bit with the new way that stdsimd is integrated. Note that other architectures like `std::arch::arm` are not stabilized as part of this commit, they will likely stabilize in the future after they've been implemented and fleshed out. Similarly the `std::simd` module is also not being stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64` is stabilized in this commit either (MMX), only SSE and up types and intrinsics are stabilized. Closes #29717 Closes #44839 Closes #48556
This commit is contained in:
parent
d6a2dd9912
commit
598d836fff
|
@ -49,7 +49,7 @@
|
|||
url = https://github.com/rust-lang/llvm
|
||||
[submodule "src/stdsimd"]
|
||||
path = src/stdsimd
|
||||
url = https://github.com/rust-lang-nursery/stdsimd
|
||||
url = https://github.com/alexcrichton/stdsimd
|
||||
[submodule "src/tools/lld"]
|
||||
path = src/tools/lld
|
||||
url = https://github.com/rust-lang/lld.git
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#![feature(asm)]
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(attr_literals)]
|
||||
#![feature(cfg_target_feature)]
|
||||
#![feature(cfg_target_has_atomic)]
|
||||
#![feature(concat_idents)]
|
||||
#![feature(const_fn)]
|
||||
|
@ -96,11 +95,13 @@
|
|||
#![feature(specialization)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![feature(target_feature)]
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(untagged_unions)]
|
||||
#![feature(unwind_attributes)]
|
||||
|
||||
#![cfg_attr(stage0, feature(target_feature))]
|
||||
#![cfg_attr(stage0, feature(cfg_target_feature))]
|
||||
|
||||
#[prelude_import]
|
||||
#[allow(unused)]
|
||||
use prelude::v1::*;
|
||||
|
@ -204,6 +205,20 @@ mod unit;
|
|||
// 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.
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v16 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v32 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v64 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v128 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v256 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! test_v512 { ($item:item) => {}; }
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*);)* } }
|
||||
#[path = "../stdsimd/coresimd/mod.rs"]
|
||||
#[allow(missing_docs, missing_debug_implementations, dead_code)]
|
||||
#[unstable(feature = "stdsimd", issue = "48556")]
|
||||
|
@ -213,6 +228,6 @@ mod coresimd;
|
|||
#[unstable(feature = "stdsimd", issue = "48556")]
|
||||
#[cfg(not(stage0))]
|
||||
pub use coresimd::simd;
|
||||
#[unstable(feature = "stdsimd", issue = "48556")]
|
||||
#[stable(feature = "simd_arch", since = "1.27.0")]
|
||||
#[cfg(not(stage0))]
|
||||
pub use coresimd::arch;
|
||||
|
|
|
@ -525,7 +525,7 @@ mod coresimd {
|
|||
#[unstable(feature = "stdsimd", issue = "48556")]
|
||||
#[cfg(all(not(stage0), not(test)))]
|
||||
pub use stdsimd::simd;
|
||||
#[unstable(feature = "stdsimd", issue = "48556")]
|
||||
#[stable(feature = "simd_arch", since = "1.27.0")]
|
||||
#[cfg(all(not(stage0), not(test)))]
|
||||
pub use stdsimd::arch;
|
||||
|
||||
|
|
|
@ -231,9 +231,6 @@ declare_features! (
|
|||
// allow `repr(simd)`, and importing the various simd intrinsics
|
||||
(active, repr_simd, "1.4.0", Some(27731), None),
|
||||
|
||||
// Allows cfg(target_feature = "...").
|
||||
(active, cfg_target_feature, "1.4.0", Some(29717), None),
|
||||
|
||||
// allow `extern "platform-intrinsic" { ... }`
|
||||
(active, platform_intrinsics, "1.4.0", Some(27731), None),
|
||||
|
||||
|
@ -293,9 +290,6 @@ declare_features! (
|
|||
|
||||
(active, use_extern_macros, "1.15.0", Some(35896), None),
|
||||
|
||||
// Allows #[target_feature(...)]
|
||||
(active, target_feature, "1.15.0", None, None),
|
||||
|
||||
// `extern "ptx-*" fn()`
|
||||
(active, abi_ptx, "1.15.0", None, None),
|
||||
|
||||
|
@ -574,6 +568,10 @@ declare_features! (
|
|||
(accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
|
||||
// Allows attributes on lifetime/type formal parameters in generics (RFC 1327)
|
||||
(accepted, generic_param_attrs, "1.26.0", Some(48848), None),
|
||||
// Allows cfg(target_feature = "...").
|
||||
(accepted, cfg_target_feature, "1.27.0", Some(29717), None),
|
||||
// Allows #[target_feature(...)]
|
||||
(accepted, target_feature, "1.27.0", None, None),
|
||||
);
|
||||
|
||||
// If you change this, please modify src/doc/unstable-book as well. You must
|
||||
|
@ -918,10 +916,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
|
|||
"the `#[naked]` attribute \
|
||||
is an experimental feature",
|
||||
cfg_fn!(naked_functions))),
|
||||
("target_feature", Whitelisted, Gated(
|
||||
Stability::Unstable, "target_feature",
|
||||
"the `#[target_feature]` attribute is an experimental feature",
|
||||
cfg_fn!(target_feature))),
|
||||
("target_feature", Normal, Ungated),
|
||||
("export_name", Whitelisted, Ungated),
|
||||
("inline", Whitelisted, Ungated),
|
||||
("link", Whitelisted, Ungated),
|
||||
|
@ -1052,7 +1047,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
|
|||
// cfg(...)'s that are feature gated
|
||||
const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[
|
||||
// (name in cfg, feature, function to check if the feature is enabled)
|
||||
("target_feature", "cfg_target_feature", cfg_fn!(cfg_target_feature)),
|
||||
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
|
||||
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
|
||||
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bcb720e55861c38db47f2ebdf26b7198338cb39d
|
||||
Subproject commit 01ed2bb1dea492324fbe21c3069cb8efacb14ec0
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[cfg(target_feature = "x")] //~ ERROR `cfg(target_feature)` is experimental
|
||||
#[cfg_attr(target_feature = "x", x)] //~ ERROR `cfg(target_feature)` is experimental
|
||||
struct Foo(u64, u64);
|
||||
|
||||
#[cfg(not(any(all(target_feature = "x"))))] //~ ERROR `cfg(target_feature)` is experimental
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
cfg!(target_feature = "x");
|
||||
//~^ ERROR `cfg(target_feature)` is experimental and subject to change
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
error[E0658]: `cfg(target_feature)` is experimental and subject to change (see issue #29717)
|
||||
--> $DIR/feature-gate-cfg-target-feature.rs:12:12
|
||||
|
|
||||
LL | #[cfg_attr(target_feature = "x", x)] //~ ERROR `cfg(target_feature)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_feature)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_feature)` is experimental and subject to change (see issue #29717)
|
||||
--> $DIR/feature-gate-cfg-target-feature.rs:11:7
|
||||
|
|
||||
LL | #[cfg(target_feature = "x")] //~ ERROR `cfg(target_feature)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_feature)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_feature)` is experimental and subject to change (see issue #29717)
|
||||
--> $DIR/feature-gate-cfg-target-feature.rs:15:19
|
||||
|
|
||||
LL | #[cfg(not(any(all(target_feature = "x"))))] //~ ERROR `cfg(target_feature)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_feature)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_feature)` is experimental and subject to change (see issue #29717)
|
||||
--> $DIR/feature-gate-cfg-target-feature.rs:19:10
|
||||
|
|
||||
LL | cfg!(target_feature = "x");
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_feature)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[target_feature = "+sse2"]
|
||||
//~^ the `#[target_feature]` attribute is an experimental feature
|
||||
fn foo() {}
|
|
@ -1,11 +0,0 @@
|
|||
error[E0658]: the `#[target_feature]` attribute is an experimental feature
|
||||
--> $DIR/feature-gate-target_feature.rs:11:1
|
||||
|
|
||||
LL | #[target_feature = "+sse2"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(target_feature)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Reference in New Issue