Rollup merge of #138003 - sayantn:new-amx, r=Amanieu

Add the new `amx` target features and the `movrs` target feature

Adds 5 new `amx` target features included in LLVM20. These are guarded under `x86_amx_intrinsics` (#126622)

 - `amx-avx512`
 - `amx-fp8`
 - `amx-movrs`
 - `amx-tf32`
 - `amx-transpose`

Adds the `movrs` target feature (from #137976).

`@rustbot` label O-x86_64 O-x86_32 T-compiler A-target-feature
r? `@Amanieu`
This commit is contained in:
Stuart Cook 2025-04-02 13:10:36 +11:00 committed by GitHub
commit 5b0f658922
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 40 additions and 0 deletions

View file

@ -300,6 +300,13 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")),
("sparc", "v8plus") if get_version().0 < 19 => None,
("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
// These new `amx` variants and `movrs` were introduced in LLVM20
("x86", "amx-avx512" | "amx-fp8" | "amx-movrs" | "amx-tf32" | "amx-transpose")
if get_version().0 < 20 =>
{
None
}
("x86", "movrs") if get_version().0 < 20 => None,
(_, s) => Some(LLVMFeature::new(s)),
}
}

View file

@ -324,6 +324,7 @@ declare_features! (
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
(unstable, m68k_target_feature, "1.85.0", Some(134328)),
(unstable, mips_target_feature, "1.27.0", Some(44839)),
(unstable, movrs_target_feature, "CURRENT_RUSTC_VERSION", Some(137976)),
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),
(unstable, riscv_target_feature, "1.45.0", Some(44839)),

View file

@ -1378,6 +1378,7 @@ symbols! {
movbe_target_feature,
move_ref_pattern,
move_size_limit,
movrs_target_feature,
mul,
mul_assign,
mul_with_overflow,

View file

@ -380,11 +380,16 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
// tidy-alphabetical-start
("adx", Stable, &[]),
("aes", Stable, &["sse2"]),
("amx-avx512", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-bf16", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-complex", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-fp16", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-fp8", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-int8", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-movrs", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-tf32", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("amx-tile", Unstable(sym::x86_amx_intrinsics), &[]),
("amx-transpose", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("avx", Stable, &["sse4.2"]),
("avx2", Stable, &["avx"]),
("avx512bf16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
@ -418,6 +423,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("lahfsahf", Unstable(sym::lahfsahf_target_feature), &[]),
("lzcnt", Stable, &[]),
("movbe", Stable, &[]),
("movrs", Unstable(sym::movrs_target_feature), &[]),
("pclmulqdq", Stable, &["sse2"]),
("popcnt", Stable, &[]),
("prfchw", Unstable(sym::prfchw_target_feature), &[]),

View file

@ -17,11 +17,16 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`aes`
`altivec`
`alu32`
`amx-avx512`
`amx-bf16`
`amx-complex`
`amx-fp16`
`amx-fp8`
`amx-int8`
`amx-movrs`
`amx-tf32`
`amx-tile`
`amx-transpose`
`atomics`
`avx`
`avx2`
@ -152,6 +157,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`mclass`
`mops`
`movbe`
`movrs`
`mp`
`mp1e2`
`msa`

View file

@ -0,0 +1,6 @@
//@ only-x86_64
#[target_feature(enable = "movrs")]
//~^ ERROR: currently unstable
unsafe fn foo() {}
fn main() {}

View file

@ -0,0 +1,13 @@
error[E0658]: the target feature `movrs` is currently unstable
--> $DIR/feature-gate-movrs_target_feature.rs:2:18
|
LL | #[target_feature(enable = "movrs")]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #137976 <https://github.com/rust-lang/rust/issues/137976> for more information
= help: add `#![feature(movrs_target_feature)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.