Skip to content

Commit ed7590f

Browse files
authored
Rollup merge of #139675 - sayantn:avx10, r=Amanieu
Add the AVX10 target features Parent #138843 Adds the `avx10_target_feature` feature gate, and `avx10.1` and `avx10.2` target features. It is confirmed that Intel is dropping AVX10/256 (see [this comment](#111137 (comment))), so this should be safe to implement now. The LLVM fix for llvm/llvm-project#135394 was merged, and has been backported to LLVM20, and the patch has also been propagated to rustc in #140502 `@rustbot` label O-x86_64 O-x86_32 A-target-feature A-SIMD
2 parents 3559e0a + 163fb85 commit ed7590f

File tree

8 files changed

+48
-1
lines changed

8 files changed

+48
-1
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+3
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
301301
None
302302
}
303303
("x86", "movrs") if get_version().0 < 20 => None,
304+
("x86", "avx10.1") => Some(LLVMFeature::new("avx10.1-512")),
305+
("x86", "avx10.2") if get_version().0 < 20 => None,
306+
("x86", "avx10.2") if get_version().0 >= 20 => Some(LLVMFeature::new("avx10.2-512")),
304307
(_, s) => Some(LLVMFeature::new(s)),
305308
}
306309
}

compiler/rustc_feature/src/unstable.rs

+2
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ declare_features! (
393393
(unstable, async_for_loop, "1.77.0", Some(118898)),
394394
/// Allows `async` trait bound modifier.
395395
(unstable, async_trait_bounds, "1.85.0", Some(62290)),
396+
/// Allows using Intel AVX10 target features and intrinsics
397+
(unstable, avx10_target_feature, "CURRENT_RUSTC_VERSION", Some(138843)),
396398
/// Allows using C-variadics.
397399
(unstable, c_variadic, "1.34.0", Some(44930)),
398400
/// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled.

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ symbols! {
531531
autodiff,
532532
automatically_derived,
533533
avx,
534+
avx10_target_feature,
534535
avx512_target_feature,
535536
avx512bw,
536537
avx512f,

compiler/rustc_target/src/target_features.rs

+20
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,26 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
394394
("amx-tile", Unstable(sym::x86_amx_intrinsics), &[]),
395395
("amx-transpose", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
396396
("avx", Stable, &["sse4.2"]),
397+
(
398+
"avx10.1",
399+
Unstable(sym::avx10_target_feature),
400+
&[
401+
"avx512bf16",
402+
"avx512bitalg",
403+
"avx512bw",
404+
"avx512cd",
405+
"avx512dq",
406+
"avx512f",
407+
"avx512fp16",
408+
"avx512ifma",
409+
"avx512vbmi",
410+
"avx512vbmi2",
411+
"avx512vl",
412+
"avx512vnni",
413+
"avx512vpopcntdq",
414+
],
415+
),
416+
("avx10.2", Unstable(sym::avx10_target_feature), &["avx10.1"]),
397417
("avx2", Stable, &["avx"]),
398418
("avx512bf16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
399419
("avx512bitalg", Unstable(sym::avx512_target_feature), &["avx512bw"]),

tests/ui/check-cfg/and-more-diagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//@ no-auto-check-cfg
66
//@ compile-flags: --check-cfg=cfg()
77
//@ normalize-stderr: "and \d+ more" -> "and X more"
8-
//@ normalize-stderr: "`[a-zA-Z0-9_-]+`" -> "`xxx`"
8+
//@ normalize-stderr: "`[a-zA-Z0-9_\.-]+`" -> "`xxx`"
99

1010
fn main() {
1111
cfg!(target_feature = "zebra");

tests/ui/check-cfg/target_feature.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
2929
`amx-transpose`
3030
`atomics`
3131
`avx`
32+
`avx10.1`
33+
`avx10.2`
3234
`avx2`
3335
`avx512bf16`
3436
`avx512bitalg`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ only-x86_64
2+
#[target_feature(enable = "avx10.1")]
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 `avx10.1` is currently unstable
2+
--> $DIR/feature-gate-avx10_target_feature.rs:2:18
3+
|
4+
LL | #[target_feature(enable = "avx10.1")]
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #138843 <https://github.com/rust-lang/rust/issues/138843> for more information
8+
= help: add `#![feature(avx10_target_feature)]` 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)