rust/tests/ui/target-feature
bors feb32c6546 Auto merge of #134794 - RalfJung:abi-required-target-features, r=workingjubilee
Add a notion of "some ABIs require certain target features"

I think I finally found the right shape for the data and checks that I recently added in https://github.com/rust-lang/rust/pull/133099, https://github.com/rust-lang/rust/pull/133417, https://github.com/rust-lang/rust/pull/134337: we have a notion of "this ABI requires the following list of target features, and it is incompatible with the following list of target features". Both `-Ctarget-feature` and `#[target_feature]` are updated to ensure we follow the rules of the ABI.  This removes all the "toggleability" stuff introduced before, though we do keep the notion of a fully "forbidden" target feature -- this is needed to deal with target features that are actual ABI switches, and hence are needed to even compute the list of required target features.

We always explicitly (un)set all required and in-conflict features, just to avoid potential trouble caused by the default features of whatever the base CPU is. We do this *before* applying `-Ctarget-feature` to maintain backward compatibility; this poses a slight risk of missing some implicit feature dependencies in LLVM but has the advantage of not breaking users that deliberately toggle ABI-relevant target features. They get a warning but the feature does get toggled the way they requested.

For now, our logic supports x86, ARM, and RISC-V (just like the previous logic did). Unsurprisingly, RISC-V is the nicest. ;)

As a side-effect this also (unstably) allows *enabling* `x87` when that is harmless. I used the opportunity to mark SSE2 as required on x86-64, to better match the actual logic in LLVM and because all x86-64 chips do have SSE2. This infrastructure also prepares us for requiring SSE on x86-32 when we want to use that for our ABI (and for float semantics sanity), see https://github.com/rust-lang/rust/issues/133611, but no such change is happening in this PR.

r? `@workingjubilee`
2025-01-05 23:21:06 +00:00
..
auxiliary mark some target features as 'forbidden' so they cannot be (un)set 2024-11-04 22:56:47 +01:00
aarch64-neon-works.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
allowed-softfloat-target-feature-attribute.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
allowed-softfloat-target-feature-flag-disable.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
allowed-softfloat-target-feature-flag-disable.stderr forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
asm-implied-features-issue-128125.rs Add test to ensure implied target features work with asm, and fix failing tests 2024-08-07 00:41:48 -04:00
feature-hierarchy.aarch64-sve2.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
feature-hierarchy.rs remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
forbidden-hardfloat-target-feature-attribute.rs explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-hardfloat-target-feature-attribute.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-hardfloat-target-feature-cfg.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
forbidden-hardfloat-target-feature-flag-disable-implied.rs x86-64 hardfloat actually requires sse2 2024-12-31 12:41:20 +01:00
forbidden-hardfloat-target-feature-flag-disable-implied.stderr x86-64 hardfloat actually requires sse2 2024-12-31 12:41:20 +01:00
forbidden-hardfloat-target-feature-flag-disable-neon.rs reject aarch64 target feature toggling that would change the float ABI 2024-12-14 08:24:18 +01:00
forbidden-hardfloat-target-feature-flag-disable-neon.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-hardfloat-target-feature-flag-disable.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
forbidden-hardfloat-target-feature-flag-disable.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-target-feature-attribute.rs explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-target-feature-attribute.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-target-feature-cfg.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
forbidden-target-feature-flag-disable.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
forbidden-target-feature-flag-disable.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
forbidden-target-feature-flag.rs forbid toggling x87 and fpregs on hard-float targets 2024-12-11 22:18:50 +01:00
forbidden-target-feature-flag.stderr explicitly model that certain ABIs require/forbid certain target features 2024-12-31 12:41:20 +01:00
gate.rs Add m68k_target_feature 2024-12-15 15:26:50 +09:00
gate.stderr Add m68k_target_feature 2024-12-15 15:26:50 +09:00
implicit-features-cli.rs Implement a implicit target feature mechanism 2024-08-04 08:44:23 +02:00
implicit-features.rs Implement a implicit target feature mechanism 2024-08-04 08:44:23 +02:00
implied-features.rs Add test to ensure implied target features work with asm, and fix failing tests 2024-08-07 00:41:48 -04:00
invalid-attribute.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
invalid-attribute.stderr Merge collect_mod_item_types query into check_well_formed 2024-03-07 14:26:31 +00:00
missing-plusminus-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
missing-plusminus-2.stderr
missing-plusminus.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
missing-plusminus.stderr
no-llvm-leaks.rs rustc_intrinsic: support functions without body; they are implicitly marked as must-be-overridden 2025-01-04 11:41:51 +01:00
rust-specific-name-no-warnings.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
similar-feature-suggestion.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
similar-feature-suggestion.stderr
tied-features-cli.one.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
tied-features-cli.rs Fix test problems discovered by the revision check 2024-05-09 14:47:09 +10:00
tied-features-cli.three.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
tied-features-cli.two.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
tied-features-no-implication-1.paca.stderr tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features-no-implication-1.pacg.stderr tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features-no-implication-1.rs tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features-no-implication.paca.stderr tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features-no-implication.pacg.stderr tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features-no-implication.rs tests: add test for #105111 2024-09-24 15:42:15 +01:00
tied-features.rs codegen_ssa: consolidate tied feature checking 2024-09-24 15:48:49 +01:00
tied-features.stderr codegen_ssa: consolidate tied feature checking 2024-09-24 15:48:49 +01:00
unstable-feature.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unstable-feature.stderr
using-target-feature-unstable.rs mark some target features as 'forbidden' so they cannot be (un)set 2024-11-04 22:56:47 +01:00
wasm-disable-simd.rs Add a regression test for #131031 2024-10-30 22:34:45 +08:00
wasm-relaxed-simd.rs Implement a implicit target feature mechanism 2024-08-04 08:44:23 +02:00
wasm-safe.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00