Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize the avx512 target features #138940

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
@@ -82,6 +82,8 @@ declare_features! (
(accepted, attr_literals, "1.30.0", Some(34981)),
/// Allows overloading augmented assignment operations like `a += b`.
(accepted, augmented_assignments, "1.8.0", Some(28235)),
/// Allows using `avx512*` target features
(accepted, avx512_target_feature, "CURRENT_RUSTC_VERSION", Some(44839)),
/// Allows mixing bind-by-move in patterns and references to those identifiers in guards.
(accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287)),
/// Allows bindings in the subpattern of a binding pattern.
1 change: 0 additions & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
@@ -315,7 +315,6 @@ declare_features! (
(unstable, aarch64_unstable_target_feature, "1.82.0", Some(44839)),
(unstable, aarch64_ver_target_feature, "1.27.0", Some(44839)),
(unstable, arm_target_feature, "1.27.0", Some(44839)),
(unstable, avx512_target_feature, "1.27.0", Some(44839)),
(unstable, bpf_target_feature, "1.54.0", Some(44839)),
(unstable, csky_target_feature, "1.73.0", Some(44839)),
(unstable, ermsb_target_feature, "1.49.0", Some(44839)),
44 changes: 22 additions & 22 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
@@ -392,33 +392,33 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("amx-transpose", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
("avx", Stable, &["sse4.2"]),
("avx2", Stable, &["avx"]),
("avx512bf16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
("avx512bitalg", Unstable(sym::avx512_target_feature), &["avx512bw"]),
("avx512bw", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512cd", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512dq", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512f", Unstable(sym::avx512_target_feature), &["avx2", "fma", "f16c"]),
("avx512fp16", Unstable(sym::avx512_target_feature), &["avx512bw", "avx512vl", "avx512dq"]),
("avx512ifma", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512vbmi", Unstable(sym::avx512_target_feature), &["avx512bw"]),
("avx512vbmi2", Unstable(sym::avx512_target_feature), &["avx512bw"]),
("avx512vl", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512vnni", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512vp2intersect", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avx512vpopcntdq", Unstable(sym::avx512_target_feature), &["avx512f"]),
("avxifma", Unstable(sym::avx512_target_feature), &["avx2"]),
("avxneconvert", Unstable(sym::avx512_target_feature), &["avx2"]),
("avxvnni", Unstable(sym::avx512_target_feature), &["avx2"]),
("avxvnniint16", Unstable(sym::avx512_target_feature), &["avx2"]),
("avxvnniint8", Unstable(sym::avx512_target_feature), &["avx2"]),
("avx512bf16", Stable, &["avx512bw"]),
("avx512bitalg", Stable, &["avx512bw"]),
("avx512bw", Stable, &["avx512f"]),
("avx512cd", Stable, &["avx512f"]),
("avx512dq", Stable, &["avx512f"]),
("avx512f", Stable, &["avx2", "fma", "f16c"]),
("avx512fp16", Stable, &["avx512bw", "avx512vl", "avx512dq"]),
("avx512ifma", Stable, &["avx512f"]),
("avx512vbmi", Stable, &["avx512bw"]),
("avx512vbmi2", Stable, &["avx512bw"]),
("avx512vl", Stable, &["avx512f"]),
("avx512vnni", Stable, &["avx512f"]),
("avx512vp2intersect", Stable, &["avx512f"]),
("avx512vpopcntdq", Stable, &["avx512f"]),
("avxifma", Stable, &["avx2"]),
("avxneconvert", Stable, &["avx2"]),
("avxvnni", Stable, &["avx2"]),
("avxvnniint16", Stable, &["avx2"]),
("avxvnniint8", Stable, &["avx2"]),
("bmi1", Stable, &[]),
("bmi2", Stable, &[]),
("cmpxchg16b", Stable, &[]),
("ermsb", Unstable(sym::ermsb_target_feature), &[]),
("f16c", Stable, &["avx"]),
("fma", Stable, &["avx"]),
("fxsr", Stable, &[]),
("gfni", Unstable(sym::avx512_target_feature), &["sse2"]),
("gfni", Stable, &["sse2"]),
("kl", Unstable(sym::keylocker_x86), &["sse2"]),
("lahfsahf", Unstable(sym::lahfsahf_target_feature), &[]),
("lzcnt", Stable, &[]),
@@ -445,8 +445,8 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("sse4a", Unstable(sym::sse4a_target_feature), &["sse3"]),
("ssse3", Stable, &["sse3"]),
("tbm", Unstable(sym::tbm_target_feature), &[]),
("vaes", Unstable(sym::avx512_target_feature), &["avx2", "aes"]),
("vpclmulqdq", Unstable(sym::avx512_target_feature), &["avx", "pclmulqdq"]),
("vaes", Stable, &["avx2", "aes"]),
("vpclmulqdq", Stable, &["avx", "pclmulqdq"]),
("widekl", Unstable(sym::keylocker_x86), &["kl"]),
("x87", Unstable(sym::x87_target_feature), &[]),
("xop", Unstable(sym::xop_target_feature), &[/*"fma4", */ "avx", "sse4a"]),
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -190,9 +190,9 @@
//
// Target features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(avx512_target_feature))]
#![feature(aarch64_unstable_target_feature)]
#![feature(arm_target_feature)]
#![feature(avx512_target_feature)]
#![feature(hexagon_target_feature)]
#![feature(keylocker_x86)]
#![feature(loongarch_target_feature)]
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
//@only-target: x86_64 i686
//@compile-flags: -C target-feature=+aes,+vaes,+avx512f

#![feature(avx512_target_feature, stdarch_x86_avx512)]
#![feature(stdarch_x86_avx512)]

use core::mem::transmute;
#[cfg(target_arch = "x86")]
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
//@only-target: x86_64 i686
//@compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bitalg,+avx512vpopcntdq

#![feature(avx512_target_feature)]
#![feature(stdarch_x86_avx512)]

#[cfg(target_arch = "x86")]
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/shims/x86/intrinsics-x86-gfni.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
// be interpreted as integers; signedness does not make sense for them, but
// __mXXXi happens to be defined in terms of signed integers.
#![allow(overflowing_literals)]
#![feature(avx512_target_feature)]
#![feature(stdarch_x86_avx512)]

#[cfg(target_arch = "x86")]
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
// be interpreted as integers; signedness does not make sense for them, but
// __mXXXi happens to be defined in terms of signed integers.
#![allow(overflowing_literals)]
#![feature(avx512_target_feature)]
#![feature(stdarch_x86_avx512)]

#[cfg(target_arch = "x86")]
2 changes: 0 additions & 2 deletions tests/ui/abi/homogenous-floats-target-feature-mixup.rs
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@
//@ run-pass
//@ needs-subprocess

#![feature(avx512_target_feature)]

#![allow(overflowing_literals)]
#![allow(unused_variables)]

1 change: 0 additions & 1 deletion tests/ui/abi/simd-abi-checks-avx.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
//@ ignore-pass (test emits codegen-time warnings)
//@ compile-flags: -C target-feature=-avx

#![feature(avx512_target_feature)]
#![feature(portable_simd)]
#![feature(simd_ffi)]
#![allow(improper_ctypes_definitions)]
1 change: 0 additions & 1 deletion tests/ui/asm/x86_64/evex512-implicit-feature.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
//@ only-x86_64
//@ compile-flags: --crate-type=lib -C target-cpu=skylake

#![feature(avx512_target_feature)]
#![feature(stdarch_x86_avx512)]

use std::arch::x86_64::*;
2 changes: 0 additions & 2 deletions tests/ui/asm/x86_64/target-feature-attr.rs
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
// Set the base cpu explicitly, in case the default has been changed.
//@ compile-flags: -C target-cpu=x86-64

#![feature(avx512_target_feature)]

use std::arch::asm;

#[target_feature(enable = "avx")]
8 changes: 4 additions & 4 deletions tests/ui/asm/x86_64/target-feature-attr.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error: register class `ymm_reg` requires the `avx` target feature
--> $DIR/target-feature-attr.rs:20:40
--> $DIR/target-feature-attr.rs:18:40
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^

error: register class `ymm_reg` requires the `avx` target feature
--> $DIR/target-feature-attr.rs:20:55
--> $DIR/target-feature-attr.rs:18:55
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^

error: register class `ymm_reg` requires the `avx` target feature
--> $DIR/target-feature-attr.rs:20:70
--> $DIR/target-feature-attr.rs:18:70
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^^^^^^

error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f
--> $DIR/target-feature-attr.rs:35:23
--> $DIR/target-feature-attr.rs:33:23
|
LL | asm!("/* {0} */", in(kreg) x);
| ^^^^^^^^^^
1 change: 0 additions & 1 deletion tests/ui/simd/target-feature-mixup.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
//@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590)

#![feature(repr_simd, target_feature, cfg_target_feature)]
#![feature(avx512_target_feature)]

use std::process::{Command, ExitStatus};
use std::env;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(avx512_target_feature)]
#![feature(cmpxchg16b_target_feature)]

#[inline]
#[target_feature(enable = "avx512ifma")]
#[target_feature(enable = "cmpxchg16b")]
pub unsafe fn foo() {}
3 changes: 1 addition & 2 deletions tests/ui/target-feature/gate.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
//
// gate-test-sse4a_target_feature
// gate-test-powerpc_target_feature
// gate-test-avx512_target_feature
// gate-test-tbm_target_feature
// gate-test-arm_target_feature
// gate-test-hexagon_target_feature
@@ -27,7 +26,7 @@
// gate-test-x87_target_feature
// gate-test-m68k_target_feature

#[target_feature(enable = "avx512bw")]
#[target_feature(enable = "cmpxchg16b")]
//~^ ERROR: currently unstable
unsafe fn foo() {}

6 changes: 3 additions & 3 deletions tests/ui/target-feature/gate.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0658]: the target feature `avx512bw` is currently unstable
--> $DIR/gate.rs:30:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
LL | #[target_feature(enable = "cmpxchg16b")]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #44839 <https://github.com/rust-lang/rust/issues/44839> for more information
= help: add `#![feature(avx512_target_feature)]` to the crate attributes to enable
= help: add `#![feature(cmpxchg16b_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
2 changes: 1 addition & 1 deletion tests/ui/target-feature/unstable-feature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ compile-flags: -Ctarget-feature=+vaes --crate-type=rlib --target=x86_64-unknown-linux-gnu
//@ compile-flags: -Ctarget-feature=+cmpxchg16b --crate-type=rlib --target=x86_64-unknown-linux-gnu
//@ build-pass
//@ needs-llvm-components: x86

2 changes: 1 addition & 1 deletion tests/ui/target-feature/unstable-feature.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: unstable feature specified for `-Ctarget-feature`: `vaes`
warning: unstable feature specified for `-Ctarget-feature`: `cmpxchg16b`
|
= note: this feature is not stably supported; its behavior can change in the future