about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-19 06:03:20 +0200
committerGitHub <noreply@github.com>2019-04-19 06:03:20 +0200
commitdd9f9b4b9dc782f307e9873f7a99828c4f58398e (patch)
tree65e0bdb24b7cec32bbfbbf0403c85de5b8690094
parent34f1c1fff13f9d9959e39ae97dc2cf394c8e6537 (diff)
parent365a48a8bf0d4dbb343889c53f773adad74ef965 (diff)
downloadrust-dd9f9b4b9dc782f307e9873f7a99828c4f58398e.tar.gz
rust-dd9f9b4b9dc782f307e9873f7a99828c4f58398e.zip
Rollup merge of #60060 - mtak-:rtm-x86-feature, r=petrochenkov
whitelist RTM x86 target cpu feature

This PR adds support for intels restricted transactional memory cpu feature. I mostly copied what was done for the [movbe](https://github.com/rust-lang/rust/pull/57999) feature.

https://github.com/rust-lang-nursery/stdsimd/issues/718
-rw-r--r--src/librustc_codegen_llvm/llvm_util.rs1
-rw-r--r--src/librustc_typeck/collect.rs1
-rw-r--r--src/libsyntax/feature_gate.rs1
-rw-r--r--src/test/ui/target-feature-gate.rs1
-rw-r--r--src/test/ui/target-feature-gate.stderr2
5 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs
index 5fea9c8747e..0cba15b3166 100644
--- a/src/librustc_codegen_llvm/llvm_util.rs
+++ b/src/librustc_codegen_llvm/llvm_util.rs
@@ -154,6 +154,7 @@ const X86_WHITELIST: &[(&str, Option<&str>)] = &[
     ("popcnt", None),
     ("rdrand", None),
     ("rdseed", None),
+    ("rtm", Some("rtm_target_feature")),
     ("sha", None),
     ("sse", None),
     ("sse2", None),
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 0cd7fe91594..d601c962fc6 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -2432,6 +2432,7 @@ fn from_target_feature(
                 Some("cmpxchg16b_target_feature") => rust_features.cmpxchg16b_target_feature,
                 Some("adx_target_feature") => rust_features.adx_target_feature,
                 Some("movbe_target_feature") => rust_features.movbe_target_feature,
+                Some("rtm_target_feature") => rust_features.rtm_target_feature,
                 Some(name) => bug!("unknown target feature gate {}", name),
                 None => true,
             };
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index c8b020d8c0b..7bae5ba7571 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -402,6 +402,7 @@ declare_features! (
     (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),
 
     // Allows macro invocations on modules expressions and statements and
     // procedural macros to expand to non-items.
diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs
index 84300301b76..8f3a52ba5d6 100644
--- a/src/test/ui/target-feature-gate.rs
+++ b/src/test/ui/target-feature-gate.rs
@@ -23,6 +23,7 @@
 // gate-test-adx_target_feature
 // gate-test-cmpxchg16b_target_feature
 // gate-test-movbe_target_feature
+// gate-test-rtm_target_feature
 // min-llvm-version 6.0
 
 #[target_feature(enable = "avx512bw")]
diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr
index 155298e5062..e142125225f 100644
--- a/src/test/ui/target-feature-gate.stderr
+++ b/src/test/ui/target-feature-gate.stderr
@@ -1,5 +1,5 @@
 error[E0658]: the target feature `avx512bw` is currently unstable
-  --> $DIR/target-feature-gate.rs:28:18
+  --> $DIR/target-feature-gate.rs:29:18
    |
 LL | #[target_feature(enable = "avx512bw")]
    |                  ^^^^^^^^^^^^^^^^^^^