about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2025-02-14 14:05:27 -0800
committerGitHub <noreply@github.com>2025-02-14 14:05:27 -0800
commitdb5238a525e288149686e8f70943758ec6d9d1bd (patch)
treea500f2085f98f089415836ab9a58b18132c08cb7 /tests/ui
parentbaa5a76b97398bb3cef5f69a5a5ec0a201ba8a42 (diff)
parent2eff2155e5467c42f43143f282dd96f9ccb7bf08 (diff)
downloadrust-db5238a525e288149686e8f70943758ec6d9d1bd.tar.gz
rust-db5238a525e288149686e8f70943758ec6d9d1bd.zip
Rollup merge of #137037 - RalfJung:x86-sse2-abi, r=workingjubilee
add x86-sse2 (32bit) ABI that requires SSE2 target feature

This is the first commit of https://github.com/rust-lang/rust/pull/135408:

The primary goal of this is to make SSE2 required for our i686 targets (at least for the ones that use Pentium 4 as their baseline), to ensure they cannot be affected by https://github.com/rust-lang/rust/issues/114479. This has been MCPd in https://github.com/rust-lang/compiler-team/issues/808, and is tracked in https://github.com/rust-lang/rust/issues/133611.

We do this by defining a new ABI that these targets select, and making SSE2 required by the ABI (that's the first commit). That's kind of a hack, but it is the easiest way to make a target feature required via the target spec. In a follow-up change (https://github.com/rust-lang/rust/pull/135408), we can actually make use of SSE2 for the ABI, but that is running into some infrastructure issues.

r? `@workingjubilee`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: aarch64-gnu-debug
try-job: test-various
try-job: x86_64-gnu-nopt
try-job: dist-i586-gnu-i586-i686-musl
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/sse-abi-checks.rs2
-rw-r--r--tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs12
-rw-r--r--tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr7
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-abi-checks.rs
index c453e91d11b..d400e6eb698 100644
--- a/tests/ui/sse-abi-checks.rs
+++ b/tests/ui/sse-abi-checks.rs
@@ -1,6 +1,6 @@
 //! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled
 //! on a target, but disabled in this file via a `-C` flag.
-//@ compile-flags: --crate-type=rlib --target=i686-unknown-linux-gnu -C target-feature=-sse,-sse2
+//@ compile-flags: --crate-type=rlib --target=i586-unknown-linux-gnu -C target-feature=-sse,-sse2
 //@ build-pass
 //@ ignore-pass (test emits codegen-time warnings)
 //@ needs-llvm-components: x86
diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs
new file mode 100644
index 00000000000..28d026c1a9a
--- /dev/null
+++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs
@@ -0,0 +1,12 @@
+//@ compile-flags: --target=i686-unknown-linux-gnu --crate-type=lib
+//@ needs-llvm-components: x86
+//@ compile-flags: -Ctarget-cpu=pentium
+// For now this is just a warning.
+//@ build-pass
+//@error-pattern: must be enabled
+
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr
new file mode 100644
index 00000000000..7ec8b04cfce
--- /dev/null
+++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr
@@ -0,0 +1,7 @@
+warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly
+   |
+   = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344>
+
+warning: 1 warning emitted
+