Skip to content

Commit 327d736

Browse files
authored
Unrolled build for rust-lang#138940
Rollup merge of rust-lang#138940 - sayantn:stabilize-avx512, r=Amanieu,traviscross Stabilize the avx512 target features This PR stabilizes the AVX512 target features - see [this comment](rust-lang#111137 (comment)). Tracking Issue - rust-lang#44839 The target feature UI tests have been changed to `x87` (chosen because this is very unlikely to stablize ever, please comment if some other feature will be better) related: rust-lang#111137
2 parents b53e5c9 + 2898680 commit 327d736

21 files changed

+54
-64
lines changed

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ declare_features! (
8282
(accepted, attr_literals, "1.30.0", Some(34981)),
8383
/// Allows overloading augmented assignment operations like `a += b`.
8484
(accepted, augmented_assignments, "1.8.0", Some(28235)),
85+
/// Allows using `avx512*` target features.
86+
(accepted, avx512_target_feature, "CURRENT_RUSTC_VERSION", Some(44839)),
8587
/// Allows mixing bind-by-move in patterns and references to those identifiers in guards.
8688
(accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287)),
8789
/// Allows bindings in the subpattern of a binding pattern.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ declare_features! (
318318
(unstable, aarch64_ver_target_feature, "1.27.0", Some(44839)),
319319
(unstable, apx_target_feature, "1.88.0", Some(139284)),
320320
(unstable, arm_target_feature, "1.27.0", Some(44839)),
321-
(unstable, avx512_target_feature, "1.27.0", Some(44839)),
322321
(unstable, bpf_target_feature, "1.54.0", Some(44839)),
323322
(unstable, csky_target_feature, "1.73.0", Some(44839)),
324323
(unstable, ermsb_target_feature, "1.49.0", Some(44839)),

compiler/rustc_target/src/target_features.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -416,33 +416,33 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
416416
),
417417
("avx10.2", Unstable(sym::avx10_target_feature), &["avx10.1"]),
418418
("avx2", Stable, &["avx"]),
419-
("avx512bf16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
420-
("avx512bitalg", Unstable(sym::avx512_target_feature), &["avx512bw"]),
421-
("avx512bw", Unstable(sym::avx512_target_feature), &["avx512f"]),
422-
("avx512cd", Unstable(sym::avx512_target_feature), &["avx512f"]),
423-
("avx512dq", Unstable(sym::avx512_target_feature), &["avx512f"]),
424-
("avx512f", Unstable(sym::avx512_target_feature), &["avx2", "fma", "f16c"]),
425-
("avx512fp16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
426-
("avx512ifma", Unstable(sym::avx512_target_feature), &["avx512f"]),
427-
("avx512vbmi", Unstable(sym::avx512_target_feature), &["avx512bw"]),
428-
("avx512vbmi2", Unstable(sym::avx512_target_feature), &["avx512bw"]),
429-
("avx512vl", Unstable(sym::avx512_target_feature), &["avx512f"]),
430-
("avx512vnni", Unstable(sym::avx512_target_feature), &["avx512f"]),
431-
("avx512vp2intersect", Unstable(sym::avx512_target_feature), &["avx512f"]),
432-
("avx512vpopcntdq", Unstable(sym::avx512_target_feature), &["avx512f"]),
433-
("avxifma", Unstable(sym::avx512_target_feature), &["avx2"]),
434-
("avxneconvert", Unstable(sym::avx512_target_feature), &["avx2"]),
435-
("avxvnni", Unstable(sym::avx512_target_feature), &["avx2"]),
436-
("avxvnniint16", Unstable(sym::avx512_target_feature), &["avx2"]),
437-
("avxvnniint8", Unstable(sym::avx512_target_feature), &["avx2"]),
419+
("avx512bf16", Stable, &["avx512bw"]),
420+
("avx512bitalg", Stable, &["avx512bw"]),
421+
("avx512bw", Stable, &["avx512f"]),
422+
("avx512cd", Stable, &["avx512f"]),
423+
("avx512dq", Stable, &["avx512f"]),
424+
("avx512f", Stable, &["avx2", "fma", "f16c"]),
425+
("avx512fp16", Stable, &["avx512bw"]),
426+
("avx512ifma", Stable, &["avx512f"]),
427+
("avx512vbmi", Stable, &["avx512bw"]),
428+
("avx512vbmi2", Stable, &["avx512bw"]),
429+
("avx512vl", Stable, &["avx512f"]),
430+
("avx512vnni", Stable, &["avx512f"]),
431+
("avx512vp2intersect", Stable, &["avx512f"]),
432+
("avx512vpopcntdq", Stable, &["avx512f"]),
433+
("avxifma", Stable, &["avx2"]),
434+
("avxneconvert", Stable, &["avx2"]),
435+
("avxvnni", Stable, &["avx2"]),
436+
("avxvnniint16", Stable, &["avx2"]),
437+
("avxvnniint8", Stable, &["avx2"]),
438438
("bmi1", Stable, &[]),
439439
("bmi2", Stable, &[]),
440440
("cmpxchg16b", Stable, &[]),
441441
("ermsb", Unstable(sym::ermsb_target_feature), &[]),
442442
("f16c", Stable, &["avx"]),
443443
("fma", Stable, &["avx"]),
444444
("fxsr", Stable, &[]),
445-
("gfni", Unstable(sym::avx512_target_feature), &["sse2"]),
445+
("gfni", Stable, &["sse2"]),
446446
("kl", Unstable(sym::keylocker_x86), &["sse2"]),
447447
("lahfsahf", Unstable(sym::lahfsahf_target_feature), &[]),
448448
("lzcnt", Stable, &[]),
@@ -469,8 +469,8 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
469469
("sse4a", Unstable(sym::sse4a_target_feature), &["sse3"]),
470470
("ssse3", Stable, &["sse3"]),
471471
("tbm", Unstable(sym::tbm_target_feature), &[]),
472-
("vaes", Unstable(sym::avx512_target_feature), &["avx2", "aes"]),
473-
("vpclmulqdq", Unstable(sym::avx512_target_feature), &["avx", "pclmulqdq"]),
472+
("vaes", Stable, &["avx2", "aes"]),
473+
("vpclmulqdq", Stable, &["avx", "pclmulqdq"]),
474474
("widekl", Unstable(sym::keylocker_x86), &["kl"]),
475475
("x87", Unstable(sym::x87_target_feature), &[]),
476476
("xop", Unstable(sym::xop_target_feature), &[/*"fma4", */ "avx", "sse4a"]),

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@
187187
//
188188
// Target features:
189189
// tidy-alphabetical-start
190+
#![cfg_attr(bootstrap, feature(avx512_target_feature))]
190191
#![feature(aarch64_unstable_target_feature)]
191192
#![feature(arm_target_feature)]
192-
#![feature(avx512_target_feature)]
193193
#![feature(hexagon_target_feature)]
194194
#![feature(keylocker_x86)]
195195
#![feature(loongarch_target_feature)]

src/tools/miri/tests/pass/shims/x86/intrinsics-x86-aes-vaes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+aes,+vaes,+avx512f
44

5-
#![feature(avx512_target_feature, stdarch_x86_avx512)]
5+
#![feature(stdarch_x86_avx512)]
66

77
use core::mem::transmute;
88
#[cfg(target_arch = "x86")]

src/tools/miri/tests/pass/shims/x86/intrinsics-x86-avx512.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bitalg,+avx512vpopcntdq
44

5-
#![feature(avx512_target_feature)]
65
#![feature(stdarch_x86_avx512)]
76

87
#[cfg(target_arch = "x86")]

src/tools/miri/tests/pass/shims/x86/intrinsics-x86-gfni.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// be interpreted as integers; signedness does not make sense for them, but
77
// __mXXXi happens to be defined in terms of signed integers.
88
#![allow(overflowing_literals)]
9-
#![feature(avx512_target_feature)]
109
#![feature(stdarch_x86_avx512)]
1110

1211
#[cfg(target_arch = "x86")]

src/tools/miri/tests/pass/shims/x86/intrinsics-x86-vpclmulqdq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// be interpreted as integers; signedness does not make sense for them, but
99
// __mXXXi happens to be defined in terms of signed integers.
1010
#![allow(overflowing_literals)]
11-
#![feature(avx512_target_feature)]
1211
#![feature(stdarch_x86_avx512)]
1312

1413
#[cfg(target_arch = "x86")]

tests/ui/abi/homogenous-floats-target-feature-mixup.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
//@ run-pass
88
//@ needs-subprocess
99

10-
#![feature(avx512_target_feature)]
11-
1210
#![allow(overflowing_literals)]
1311
#![allow(unused_variables)]
1412

tests/ui/abi/simd-abi-checks-avx.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ build-fail
33
//@ compile-flags: -C target-feature=-avx
44

5-
#![feature(avx512_target_feature)]
65
#![feature(portable_simd)]
76
#![feature(simd_ffi)]
87
#![allow(improper_ctypes_definitions)]

tests/ui/abi/simd-abi-checks-avx.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,93 @@
11
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
2-
--> $DIR/simd-abi-checks-avx.rs:60:11
2+
--> $DIR/simd-abi-checks-avx.rs:59:11
33
|
44
LL | f(g());
55
| ^^^ function called here
66
|
77
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
88

99
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
10-
--> $DIR/simd-abi-checks-avx.rs:60:9
10+
--> $DIR/simd-abi-checks-avx.rs:59:9
1111
|
1212
LL | f(g());
1313
| ^^^^^^ function called here
1414
|
1515
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
1616

1717
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
18-
--> $DIR/simd-abi-checks-avx.rs:66:14
18+
--> $DIR/simd-abi-checks-avx.rs:65:14
1919
|
2020
LL | gavx(favx());
2121
| ^^^^^^ function called here
2222
|
2323
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
2424

2525
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
26-
--> $DIR/simd-abi-checks-avx.rs:66:9
26+
--> $DIR/simd-abi-checks-avx.rs:65:9
2727
|
2828
LL | gavx(favx());
2929
| ^^^^^^^^^^^^ function called here
3030
|
3131
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
3232

3333
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
34-
--> $DIR/simd-abi-checks-avx.rs:76:19
34+
--> $DIR/simd-abi-checks-avx.rs:75:19
3535
|
3636
LL | w(Wrapper(g()));
3737
| ^^^ function called here
3838
|
3939
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
4040

4141
error: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
42-
--> $DIR/simd-abi-checks-avx.rs:76:9
42+
--> $DIR/simd-abi-checks-avx.rs:75:9
4343
|
4444
LL | w(Wrapper(g()));
4545
| ^^^^^^^^^^^^^^^ function called here
4646
|
4747
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
4848

4949
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
50-
--> $DIR/simd-abi-checks-avx.rs:90:9
50+
--> $DIR/simd-abi-checks-avx.rs:89:9
5151
|
5252
LL | some_extern();
5353
| ^^^^^^^^^^^^^ function called here
5454
|
5555
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
5656

5757
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
58-
--> $DIR/simd-abi-checks-avx.rs:25:1
58+
--> $DIR/simd-abi-checks-avx.rs:24:1
5959
|
6060
LL | unsafe extern "C" fn g() -> __m256 {
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
6262
|
6363
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
6464

6565
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
66-
--> $DIR/simd-abi-checks-avx.rs:20:1
66+
--> $DIR/simd-abi-checks-avx.rs:19:1
6767
|
6868
LL | unsafe extern "C" fn f(_: __m256) {
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
7070
|
7171
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
7272

7373
error: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
74-
--> $DIR/simd-abi-checks-avx.rs:15:1
74+
--> $DIR/simd-abi-checks-avx.rs:14:1
7575
|
7676
LL | unsafe extern "C" fn w(_: Wrapper) {
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
7878
|
7979
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
8080

8181
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
82-
--> $DIR/simd-abi-checks-avx.rs:54:8
82+
--> $DIR/simd-abi-checks-avx.rs:53:8
8383
|
8484
LL | || g()
8585
| ^^^ function called here
8686
|
8787
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
8888

8989
note: the above error was encountered while instantiating `fn in_closure::{closure#0}`
90-
--> $DIR/simd-abi-checks-avx.rs:82:9
90+
--> $DIR/simd-abi-checks-avx.rs:81:9
9191
|
9292
LL | in_closure()();
9393
| ^^^^^^^^^^^^^^

tests/ui/asm/x86_64/evex512-implicit-feature.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ only-x86_64
33
//@ compile-flags: --crate-type=lib -C target-cpu=skylake
44

5-
#![feature(avx512_target_feature)]
65
#![feature(stdarch_x86_avx512)]
76

87
use std::arch::x86_64::*;

tests/ui/asm/x86_64/target-feature-attr.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Set the base cpu explicitly, in case the default has been changed.
33
//@ compile-flags: -C target-cpu=x86-64
44

5-
#![feature(avx512_target_feature)]
6-
75
use std::arch::asm;
86

97
#[target_feature(enable = "avx")]

tests/ui/asm/x86_64/target-feature-attr.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: register class `ymm_reg` requires the `avx` target feature
2-
--> $DIR/target-feature-attr.rs:20:40
2+
--> $DIR/target-feature-attr.rs:18:40
33
|
44
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
55
| ^^^^^^^^^^^^^
66

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

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

1919
error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f
20-
--> $DIR/target-feature-attr.rs:35:23
20+
--> $DIR/target-feature-attr.rs:33:23
2121
|
2222
LL | asm!("/* {0} */", in(kreg) x);
2323
| ^^^^^^^^^^

tests/ui/simd/target-feature-mixup.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590)
88

99
#![feature(repr_simd, target_feature, cfg_target_feature)]
10-
#![feature(avx512_target_feature)]
1110

1211
use std::process::{Command, ExitStatus};
1312
use std::env;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![feature(avx512_target_feature)]
1+
#![feature(x87_target_feature)]
22

33
#[inline]
4-
#[target_feature(enable = "avx512ifma")]
4+
#[target_feature(enable = "x87")]
55
pub unsafe fn foo() {}

tests/ui/target-feature/gate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//
33
// gate-test-sse4a_target_feature
44
// gate-test-powerpc_target_feature
5-
// gate-test-avx512_target_feature
65
// gate-test-tbm_target_feature
76
// gate-test-arm_target_feature
87
// gate-test-hexagon_target_feature
@@ -27,7 +26,7 @@
2726
// gate-test-x87_target_feature
2827
// gate-test-m68k_target_feature
2928

30-
#[target_feature(enable = "avx512bw")]
29+
#[target_feature(enable = "x87")]
3130
//~^ ERROR: currently unstable
3231
unsafe fn foo() {}
3332

tests/ui/target-feature/gate.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0658]: the target feature `avx512bw` is currently unstable
2-
--> $DIR/gate.rs:30:18
1+
error[E0658]: the target feature `x87` is currently unstable
2+
--> $DIR/gate.rs:29:18
33
|
4-
LL | #[target_feature(enable = "avx512bw")]
5-
| ^^^^^^^^^^^^^^^^^^^
4+
LL | #[target_feature(enable = "x87")]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: see issue #44839 <https://github.com/rust-lang/rust/issues/44839> for more information
8-
= help: add `#![feature(avx512_target_feature)]` to the crate attributes to enable
8+
= help: add `#![feature(x87_target_feature)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error: aborting due to 1 previous error
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//@ compile-flags: -Ctarget-feature=+vaes --crate-type=rlib --target=x86_64-unknown-linux-gnu
1+
//@ compile-flags: -Ctarget-feature=+x87 --crate-type=rlib --target=x86_64-unknown-linux-gnu
22
//@ build-pass
33
//@ needs-llvm-components: x86
44

55
#![feature(no_core)]
66
#![no_core]
77

8-
//~? WARN unstable feature specified for `-Ctarget-feature`: `vaes`
8+
//~? WARN unstable feature specified for `-Ctarget-feature`: `x87`

tests/ui/target-feature/unstable-feature.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: unstable feature specified for `-Ctarget-feature`: `vaes`
1+
warning: unstable feature specified for `-Ctarget-feature`: `x87`
22
|
33
= note: this feature is not stably supported; its behavior can change in the future
44

0 commit comments

Comments
 (0)