Skip to content

Commit dd70524

Browse files
committed
Add kl and widekl target features, and the feature gate
1 parent 207ed1b commit dd70524

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

compiler/rustc_feature/src/unstable.rs

+2
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@ declare_features! (
525525
(unstable, inline_const_pat, "1.58.0", Some(76001)),
526526
/// Allows using `pointer` and `reference` in intra-doc links
527527
(unstable, intra_doc_pointers, "1.51.0", Some(80896)),
528+
// Allows using the `kl` and `widekl` target features and the associated intrinsics
529+
(unstable, keylocker_x86, "CURRENT_RUSTC_VERSION", Some(134813)),
528530
// Allows setting the threshold for the `large_assignments` lint.
529531
(unstable, large_assignments, "1.52.0", Some(83518)),
530532
/// Allow to have type alias types for inter-crate use.

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ symbols! {
11481148
iterator,
11491149
iterator_collect_fn,
11501150
kcfi,
1151+
keylocker_x86,
11511152
keyword,
11521153
kind,
11531154
kreg,

compiler/rustc_target/src/target_features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ const X86_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
508508
("fma", STABLE, &["avx"]),
509509
("fxsr", STABLE, &[]),
510510
("gfni", unstable(sym::avx512_target_feature), &["sse2"]),
511+
("kl", unstable(sym::keylocker_x86), &["sse2"]),
511512
("lahfsahf", unstable(sym::lahfsahf_target_feature), &[]),
512513
("lzcnt", STABLE, &[]),
513514
("movbe", STABLE, &[]),
@@ -532,6 +533,7 @@ const X86_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
532533
("tbm", unstable(sym::tbm_target_feature), &[]),
533534
("vaes", unstable(sym::avx512_target_feature), &["avx2", "aes"]),
534535
("vpclmulqdq", unstable(sym::avx512_target_feature), &["avx", "pclmulqdq"]),
536+
("widekl", unstable(sym::keylocker_x86), &["kl"]),
535537
(
536538
"x87",
537539
Stability::Unstable {

tests/ui/check-cfg/target_feature.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
127127
`isa-68881`
128128
`isa-68882`
129129
`jsconv`
130+
`kl`
130131
`lahfsahf`
131132
`lasx`
132133
`lbt`
@@ -270,6 +271,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
270271
`vsx`
271272
`wfxt`
272273
`wide-arithmetic`
274+
`widekl`
273275
`x87`
274276
`xop`
275277
`xsave`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ only-x86_64
2+
#[target_feature(enable = "kl")]
3+
//~^ ERROR: currently unstable
4+
unsafe fn foo() {}
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0658]: the target feature `kl` is currently unstable
2+
--> $DIR/feature-gate-keylocker_x86.rs:2:18
3+
|
4+
LL | #[target_feature(enable = "kl")]
5+
| ^^^^^^^^^^^^^
6+
|
7+
= note: see issue #134813 <https://github.com/rust-lang/rust/issues/134813> for more information
8+
= help: add `#![feature(keylocker_x86)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)