Skip to content

Commit ad552bc

Browse files
committed
Add compiler support for LLVM's x86 ERMSB feature
This change is needed for compiler-builtins to check for this feature when implementing memcpy/memset. See: rust-lang/compiler-builtins#365 The change just does compile-time detection. I think that runtime detection will have to come in a follow-up CL to std-detect. Like all the CPU feature flags, this just references #44839 Signed-off-by: Joe Richey <[email protected]>
1 parent 8e6f69a commit ad552bc

File tree

6 files changed

+6
-1
lines changed

6 files changed

+6
-1
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
6363
("bmi1", None),
6464
("bmi2", None),
6565
("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)),
66+
("ermsb", Some(sym::ermsb_target_feature)),
6667
("f16c", Some(sym::f16c_target_feature)),
6768
("fma", None),
6869
("fxsr", None),

compiler/rustc_feature/src/active.rs

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ declare_features! (
238238
(active, rtm_target_feature, "1.35.0", Some(44839), None),
239239
(active, f16c_target_feature, "1.36.0", Some(44839), None),
240240
(active, riscv_target_feature, "1.45.0", Some(44839), None),
241+
(active, ermsb_target_feature, "1.49.0", Some(44839), None),
241242

242243
// -------------------------------------------------------------------------
243244
// feature-group-end: actual feature gates (target features)

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ symbols! {
467467
encode,
468468
env,
469469
eq,
470+
ermsb_target_feature,
470471
err,
471472
exact_div,
472473
except,

compiler/rustc_typeck/src/collect.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,7 @@ fn from_target_feature(
24142414
Some(sym::movbe_target_feature) => rust_features.movbe_target_feature,
24152415
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature,
24162416
Some(sym::f16c_target_feature) => rust_features.f16c_target_feature,
2417+
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
24172418
Some(name) => bug!("unknown target feature gate {}", name),
24182419
None => true,
24192420
};

src/test/ui/target-feature/gate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// gate-test-rtm_target_feature
2727
// gate-test-f16c_target_feature
2828
// gate-test-riscv_target_feature
29+
// gate-test-ermsb_target_feature
2930

3031
#[target_feature(enable = "avx512bw")]
3132
//~^ ERROR: currently unstable

src/test/ui/target-feature/gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the target feature `avx512bw` is currently unstable
2-
--> $DIR/gate.rs:30:18
2+
--> $DIR/gate.rs:31:18
33
|
44
LL | #[target_feature(enable = "avx512bw")]
55
| ^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)