From ec5d49478d957add660beaf0e0ce2ae461693907 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 19 Apr 2019 11:24:55 +0200 Subject: [PATCH 1/5] Stabilize ADX, TBM, and SSE4a target features --- src/libsyntax/feature_gate.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 7f80e2099f6ad..dca9193df08bd 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -268,10 +268,7 @@ declare_features! ( (active, mips_target_feature, "1.27.0", Some(44839), None), (active, avx512_target_feature, "1.27.0", Some(44839), None), (active, mmx_target_feature, "1.27.0", Some(44839), None), - (active, sse4a_target_feature, "1.27.0", Some(44839), None), - (active, tbm_target_feature, "1.27.0", Some(44839), None), (active, wasm_target_feature, "1.30.0", Some(44839), None), - (active, adx_target_feature, "1.32.0", Some(44839), None), (active, cmpxchg16b_target_feature, "1.32.0", Some(44839), None), (active, movbe_target_feature, "1.34.0", Some(44839), None), (active, rtm_target_feature, "1.35.0", Some(44839), None), @@ -850,6 +847,12 @@ declare_features! ( (accepted, repr_align_enum, "1.37.0", Some(57996), None), // Allows `const _: TYPE = VALUE`. (accepted, underscore_const_names, "1.37.0", Some(54912), None), + // Allows using SSE4A intrinsics from `core::arch::{x86, x86_64}`. + (accepted, sse4a_target_feature, "1.37.0", Some(44839), None), + // Allows using TBM intrinsics from `core::arch::{x86, x86_64}`. + (accepted, tbm_target_feature, "1.37.0", Some(44839), None), + // Allows using ADX intrinsics from `core::arch::{x86, x86_64}`. + (accepted, adx_target_feature, "1.37.0", Some(44839), None), // ------------------------------------------------------------------------- // feature-group-end: accepted features From e07447cf986dbafade72c859f1c08b331903abf0 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 21 Jun 2019 19:03:21 +0200 Subject: [PATCH 2/5] Whitelist stable target-features in typeck --- src/librustc_typeck/collect.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 52cda4ac3c628..19fe4037e95b3 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2362,14 +2362,16 @@ fn from_target_feature( Some(sym::mips_target_feature) => rust_features.mips_target_feature, Some(sym::avx512_target_feature) => rust_features.avx512_target_feature, Some(sym::mmx_target_feature) => rust_features.mmx_target_feature, - Some(sym::sse4a_target_feature) => rust_features.sse4a_target_feature, - Some(sym::tbm_target_feature) => rust_features.tbm_target_feature, Some(sym::wasm_target_feature) => rust_features.wasm_target_feature, Some(sym::cmpxchg16b_target_feature) => rust_features.cmpxchg16b_target_feature, - Some(sym::adx_target_feature) => rust_features.adx_target_feature, Some(sym::movbe_target_feature) => rust_features.movbe_target_feature, Some(sym::rtm_target_feature) => rust_features.rtm_target_feature, Some(sym::f16c_target_feature) => rust_features.f16c_target_feature, + // These are stable: + | Some(sym::sse4a_target_feature) + | Some(sym::tbm_target_feature) + | Some(sym::adx_target_feature) + => true, Some(name) => bug!("unknown target feature gate {}", name), None => true, }; From b654b1d24019db7276fd5707447921b38d80983a Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 22 Jun 2019 15:00:21 +0200 Subject: [PATCH 3/5] Remove feature flags from libcore --- src/libcore/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1bfb852424d63..ccf7f1ed912e8 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -107,8 +107,6 @@ #![feature(unwind_attributes)] #![feature(doc_alias)] #![feature(mmx_target_feature)] -#![feature(tbm_target_feature)] -#![feature(sse4a_target_feature)] #![feature(arm_target_feature)] #![feature(powerpc_target_feature)] #![feature(mips_target_feature)] @@ -124,7 +122,6 @@ #![feature(non_exhaustive)] #![feature(structural_match)] #![feature(abi_unadjusted)] -#![feature(adx_target_feature)] #![feature(maybe_uninit_slice, maybe_uninit_array)] #![feature(external_doc)] From 915ca5b47e971ad7ae8be0e5e06270473e00b23d Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 22 Jun 2019 15:22:44 +0200 Subject: [PATCH 4/5] SSE4, TBM, and ADX do not need feature flags --- src/librustc_codegen_llvm/llvm_util.rs | 6 +++--- src/librustc_typeck/collect.rs | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 274c89659628d..426a1c9d20fb2 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -129,7 +129,7 @@ const AARCH64_WHITELIST: &[(&str, Option)] = &[ ]; const X86_WHITELIST: &[(&str, Option)] = &[ - ("adx", Some(sym::adx_target_feature)), + ("adx", None), ("aes", None), ("avx", None), ("avx2", None), @@ -163,9 +163,9 @@ const X86_WHITELIST: &[(&str, Option)] = &[ ("sse3", None), ("sse4.1", None), ("sse4.2", None), - ("sse4a", Some(sym::sse4a_target_feature)), + ("sse4a", None), ("ssse3", None), - ("tbm", Some(sym::tbm_target_feature)), + ("tbm", None), ("xsave", None), ("xsavec", None), ("xsaveopt", None), diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 19fe4037e95b3..bc043fedc6fa2 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2367,11 +2367,6 @@ fn from_target_feature( Some(sym::movbe_target_feature) => rust_features.movbe_target_feature, Some(sym::rtm_target_feature) => rust_features.rtm_target_feature, Some(sym::f16c_target_feature) => rust_features.f16c_target_feature, - // These are stable: - | Some(sym::sse4a_target_feature) - | Some(sym::tbm_target_feature) - | Some(sym::adx_target_feature) - => true, Some(name) => bug!("unknown target feature gate {}", name), None => true, }; From 672d0e6269289aa32bc0e279b9202fbbfe900644 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 22 Jun 2019 15:47:00 +0200 Subject: [PATCH 5/5] Enable stable target features in libcore during bootstraping only --- src/libcore/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index ccf7f1ed912e8..218418599ea98 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -124,6 +124,9 @@ #![feature(abi_unadjusted)] #![feature(maybe_uninit_slice, maybe_uninit_array)] #![feature(external_doc)] +#![cfg_attr(bootstrap, feature(sse4a_target_feature))] +#![cfg_attr(bootstrap, feature(tbm_target_feature))] +#![cfg_attr(bootstrap, feature(adx_target_feature))] #[prelude_import] #[allow(unused)]