diff options
| author | Ralf Jung <post@ralfj.de> | 2025-02-18 17:17:16 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-02-20 12:40:58 +0100 |
| commit | 83fd16f6258f3ae6fb6c8d6cf06eb4f8c654333e (patch) | |
| tree | 13201e916be9e6065e1283705468ebbbdead850c /tests/ui | |
| parent | 79b2360d985d325741e066e7b6070ed465b785df (diff) | |
| download | rust-83fd16f6258f3ae6fb6c8d6cf06eb4f8c654333e.tar.gz rust-83fd16f6258f3ae6fb6c8d6cf06eb4f8c654333e.zip | |
vectorcall ABI: error if sse2 is not available
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/abi/simd-abi-checks-avx.rs (renamed from tests/ui/abi/simd-abi-checks.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/abi/simd-abi-checks-avx.stderr (renamed from tests/ui/abi/simd-abi-checks.stderr) | 44 | ||||
| -rw-r--r-- | tests/ui/abi/simd-abi-checks-sse.rs (renamed from tests/ui/abi/sse-abi-checks.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/abi/simd-abi-checks-sse.stderr (renamed from tests/ui/abi/sse-abi-checks.stderr) | 4 | ||||
| -rw-r--r-- | tests/ui/abi/vectorcall-abi-checks.rs | 21 | ||||
| -rw-r--r-- | tests/ui/abi/vectorcall-abi-checks.stderr | 18 | ||||
| -rw-r--r-- | tests/ui/extern/extern-vectorcall.rs | 1 | ||||
| -rw-r--r-- | tests/ui/sse-simd-abi-checks.rs | 23 | ||||
| -rw-r--r-- | tests/ui/sse-simd-abi-checks.stderr | 25 |
9 files changed, 64 insertions, 72 deletions
diff --git a/tests/ui/abi/simd-abi-checks.rs b/tests/ui/abi/simd-abi-checks-avx.rs index acab74300b8..acab74300b8 100644 --- a/tests/ui/abi/simd-abi-checks.rs +++ b/tests/ui/abi/simd-abi-checks-avx.rs diff --git a/tests/ui/abi/simd-abi-checks.stderr b/tests/ui/abi/simd-abi-checks-avx.stderr index a849993a166..0dddc7dfa1c 100644 --- a/tests/ui/abi/simd-abi-checks.stderr +++ b/tests/ui/abi/simd-abi-checks-avx.stderr @@ -1,5 +1,5 @@ warning: 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 - --> $DIR/simd-abi-checks.rs:64:11 + --> $DIR/simd-abi-checks-avx.rs:64:11 | LL | f(g()); | ^^^ function called here @@ -10,7 +10,7 @@ LL | f(g()); = note: `#[warn(abi_unsupported_vector_types)]` on by default warning: 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 - --> $DIR/simd-abi-checks.rs:64:9 + --> $DIR/simd-abi-checks-avx.rs:64:9 | LL | f(g()); | ^^^^^^ function called here @@ -20,7 +20,7 @@ LL | f(g()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:72:14 + --> $DIR/simd-abi-checks-avx.rs:72:14 | LL | gavx(favx()); | ^^^^^^ function called here @@ -30,7 +30,7 @@ LL | gavx(favx()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:72:9 + --> $DIR/simd-abi-checks-avx.rs:72:9 | LL | gavx(favx()); | ^^^^^^^^^^^^ function called here @@ -40,7 +40,7 @@ LL | gavx(favx()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:84:19 + --> $DIR/simd-abi-checks-avx.rs:84:19 | LL | w(Wrapper(g())); | ^^^ function called here @@ -50,7 +50,7 @@ LL | w(Wrapper(g())); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:84:9 + --> $DIR/simd-abi-checks-avx.rs:84:9 | LL | w(Wrapper(g())); | ^^^^^^^^^^^^^^^ function called here @@ -60,7 +60,7 @@ LL | w(Wrapper(g())); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:100:9 + --> $DIR/simd-abi-checks-avx.rs:100:9 | LL | some_extern(); | ^^^^^^^^^^^^^ function called here @@ -70,7 +70,7 @@ LL | some_extern(); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:27:1 + --> $DIR/simd-abi-checks-avx.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -80,7 +80,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:21:1 + --> $DIR/simd-abi-checks-avx.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -90,7 +90,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled - --> $DIR/simd-abi-checks.rs:15:1 + --> $DIR/simd-abi-checks-avx.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -100,7 +100,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) warning: 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 - --> $DIR/simd-abi-checks.rs:57:8 + --> $DIR/simd-abi-checks-avx.rs:57:8 | LL | || g() | ^^^ function called here @@ -113,7 +113,7 @@ warning: 11 warnings emitted Future incompatibility report: Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:64:11 + --> $DIR/simd-abi-checks-avx.rs:64:11 | LL | f(g()); | ^^^ function called here @@ -125,7 +125,7 @@ LL | f(g()); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:64:9 + --> $DIR/simd-abi-checks-avx.rs:64:9 | LL | f(g()); | ^^^^^^ function called here @@ -137,7 +137,7 @@ LL | f(g()); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:72:14 + --> $DIR/simd-abi-checks-avx.rs:72:14 | LL | gavx(favx()); | ^^^^^^ function called here @@ -149,7 +149,7 @@ LL | gavx(favx()); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:72:9 + --> $DIR/simd-abi-checks-avx.rs:72:9 | LL | gavx(favx()); | ^^^^^^^^^^^^ function called here @@ -161,7 +161,7 @@ LL | gavx(favx()); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:84:19 + --> $DIR/simd-abi-checks-avx.rs:84:19 | LL | w(Wrapper(g())); | ^^^ function called here @@ -173,7 +173,7 @@ LL | w(Wrapper(g())); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:84:9 + --> $DIR/simd-abi-checks-avx.rs:84:9 | LL | w(Wrapper(g())); | ^^^^^^^^^^^^^^^ function called here @@ -185,7 +185,7 @@ LL | w(Wrapper(g())); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:100:9 + --> $DIR/simd-abi-checks-avx.rs:100:9 | LL | some_extern(); | ^^^^^^^^^^^^^ function called here @@ -197,7 +197,7 @@ LL | some_extern(); Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:27:1 + --> $DIR/simd-abi-checks-avx.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -209,7 +209,7 @@ LL | unsafe extern "C" fn g() -> __m256 { Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:21:1 + --> $DIR/simd-abi-checks-avx.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -221,7 +221,7 @@ LL | unsafe extern "C" fn f(_: __m256) { Future breakage diagnostic: warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled - --> $DIR/simd-abi-checks.rs:15:1 + --> $DIR/simd-abi-checks-avx.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -233,7 +233,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { Future breakage diagnostic: warning: 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 - --> $DIR/simd-abi-checks.rs:57:8 + --> $DIR/simd-abi-checks-avx.rs:57:8 | LL | || g() | ^^^ function called here diff --git a/tests/ui/abi/sse-abi-checks.rs b/tests/ui/abi/simd-abi-checks-sse.rs index cb708bea3ca..cb708bea3ca 100644 --- a/tests/ui/abi/sse-abi-checks.rs +++ b/tests/ui/abi/simd-abi-checks-sse.rs diff --git a/tests/ui/abi/sse-abi-checks.stderr b/tests/ui/abi/simd-abi-checks-sse.stderr index 95486f480d2..c0f2e6e1e1b 100644 --- a/tests/ui/abi/sse-abi-checks.stderr +++ b/tests/ui/abi/simd-abi-checks-sse.stderr @@ -1,5 +1,5 @@ warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-simd-abi-checks.rs:20:1 + --> $DIR/simd-abi-checks-sse.rs:20:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -13,7 +13,7 @@ warning: 1 warning emitted Future incompatibility report: Future breakage diagnostic: warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-simd-abi-checks.rs:20:1 + --> $DIR/simd-abi-checks-sse.rs:20:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/abi/vectorcall-abi-checks.rs b/tests/ui/abi/vectorcall-abi-checks.rs new file mode 100644 index 00000000000..d83bbffa745 --- /dev/null +++ b/tests/ui/abi/vectorcall-abi-checks.rs @@ -0,0 +1,21 @@ +//@ add-core-stubs +//@ compile-flags: --crate-type=rlib --target=i586-unknown-linux-gnu -C target-feature=-sse,-sse2 +//@ build-fail +//@ ignore-pass (test emits codegen-time errors) +//@ needs-llvm-components: x86 +#![feature(no_core, abi_vectorcall)] +#![no_core] + +extern crate minicore; +use minicore::*; + +#[no_mangle] +pub extern "vectorcall" fn f() { + //~^ ABI "vectorcall" which requires the `sse2` target feature +} + +#[no_mangle] +pub fn call_site() { + f(); + //~^ ABI "vectorcall" which requires the `sse2` target feature +} diff --git a/tests/ui/abi/vectorcall-abi-checks.stderr b/tests/ui/abi/vectorcall-abi-checks.stderr new file mode 100644 index 00000000000..671ebc25b42 --- /dev/null +++ b/tests/ui/abi/vectorcall-abi-checks.stderr @@ -0,0 +1,18 @@ +error: this function definition uses ABI "vectorcall" which requires the `sse2` target feature, which is not enabled + --> $DIR/vectorcall-abi-checks.rs:13:1 + | +LL | pub extern "vectorcall" fn f() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here + | + = help: consider enabling it globally (`-C target-feature=+sse2`) or locally (`#[target_feature(enable="sse2")]`) + +error: this function call uses ABI "vectorcall" which requires the `sse2` target feature, which is not enabled in the caller + --> $DIR/vectorcall-abi-checks.rs:19:5 + | +LL | f(); + | ^^^ function called here + | + = help: consider enabling it globally (`-C target-feature=+sse2`) or locally (`#[target_feature(enable="sse2")]`) + +error: aborting due to 2 previous errors + diff --git a/tests/ui/extern/extern-vectorcall.rs b/tests/ui/extern/extern-vectorcall.rs index c0d872bc14b..fb23c4cd5b5 100644 --- a/tests/ui/extern/extern-vectorcall.rs +++ b/tests/ui/extern/extern-vectorcall.rs @@ -2,6 +2,7 @@ //@ revisions: x64 x32 //@ [x64]only-x86_64 //@ [x32]only-x86 +//@ [x32]compile-flags: -Ctarget-feature=+sse2 #![feature(abi_vectorcall)] diff --git a/tests/ui/sse-simd-abi-checks.rs b/tests/ui/sse-simd-abi-checks.rs deleted file mode 100644 index cb708bea3ca..00000000000 --- a/tests/ui/sse-simd-abi-checks.rs +++ /dev/null @@ -1,23 +0,0 @@ -//! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled -//! on a target via the base CPU, but disabled in this file via a `-C` flag. -//@ compile-flags: --crate-type=rlib --target=i586-unknown-linux-gnu -//@ compile-flags: -Ctarget-cpu=pentium4 -C target-feature=-sse,-sse2 -//@ add-core-stubs -//@ build-pass -//@ ignore-pass (test emits codegen-time warnings) -//@ needs-llvm-components: x86 -#![feature(no_core, repr_simd)] -#![no_core] -#![allow(improper_ctypes_definitions)] - -extern crate minicore; -use minicore::*; - -#[repr(simd)] -pub struct SseVector([i64; 2]); - -#[no_mangle] -pub unsafe extern "C" fn f(_: SseVector) { - //~^ this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled - //~| WARNING this was previously accepted by the compiler -} diff --git a/tests/ui/sse-simd-abi-checks.stderr b/tests/ui/sse-simd-abi-checks.stderr deleted file mode 100644 index 95486f480d2..00000000000 --- a/tests/ui/sse-simd-abi-checks.stderr +++ /dev/null @@ -1,25 +0,0 @@ -warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-simd-abi-checks.rs:20:1 - | -LL | pub unsafe extern "C" fn f(_: SseVector) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> - = help: consider enabling it globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`) - = note: `#[warn(abi_unsupported_vector_types)]` on by default - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-simd-abi-checks.rs:20:1 - | -LL | pub unsafe extern "C" fn f(_: SseVector) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> - = help: consider enabling it globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`) - = note: `#[warn(abi_unsupported_vector_types)]` on by default - |
