1
Fork 0
rust/tests/ui/check-cfg
Michael Goulet 828a3a41b3
Rollup merge of #137417 - taiki-e:riscv-atomic, r=Amanieu
rustc_target: Add more RISC-V atomic-related features

This is a continuation of https://github.com/rust-lang/rust/pull/130877 and adds a few target features, including `zacas`, which was experimental in LLVM 19 and marked non-experimental in LLVM 20.

This adds the following target features to unstable riscv_target_feature:

- `za64rs` (Za64rs Extension 1.0): Reservation Set Size of at Most 64 Bytes
  ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L227-L228), [available since LLVM 18](8649328060))
- `za128rs` (Za128rs Extension 1.0): Reservation Set Size of at Most 128 Bytes
  ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L230-L231), [available since LLVM 18](8649328060))
  - IIUC, `za*rs` can be referenced when implementing helpers to reduce contention in synchronization primitives, like [`crossbeam_utils::CachePadded`](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html). (relevant discussion: https://github.com/riscv/riscv-profiles/issues/79)
- `zacas` (Zacas Extension 1.0): Atomic Compare-And-Swap Instructions (`amocas.{w,d,q}{,.aq,.rl,.aqrl}` and `amocas.{b,h}{,.aq,.rl,.aqrl}` when `zabha` is also enabled)
  ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L240-L243), [available as non-experimental since LLVM 20](614aeda93b))
  - This implies `zaamo`.
  - This is used to optimize CAS in existing atomics and/or implement 64-bit/128-bit atomics on riscv32/riscv64 (e.g., https://github.com/taiki-e/portable-atomic/pull/173).
  - Note that [LLVM does not automatically use this instruction for 64-bit/128-bit atomics on riscv32/riscv64 even if this feature is enabled, because doing it changes the ABI](876174ffd7/llvm/docs/RISCVUsage.rst (riscv-zacas-note)). (If the ability to do that is provided by LLVM in the future, it should probably be controlled by another ABI feature similar to `forced-atomics`.)
- `zama16b` (Zama16b Extension 1.0): Atomic 16-byte misaligned loads, stores and AMOs
  ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L255-L256), [available since LLVM 19](b090569685))
  - IIUC, unlike AArch64 FEAT_LSE2 which also makes 16-byte aligned ldp ({i,u}128 load) atomic, this extension only affects instructions that already considered atomic if they were naturally aligned. i.e., fld (f64 load) on riscv32 would not be atomic with or without this extension ([relevant QEMU code](b69801dd6b/target/riscv/insn_trans/trans_rvd.c.inc (L50-L62))).
- `zawrs` (Zawrs Extension 1.0): Wait on Reservation Set (`wrs.nto` and `wrs.sto`)
  ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L258), [available as non-experimental since LLVM 17](d41a73aa94))
  - This is used to optimize synchronization primitives (e.g., Linux uses this for spinlocks (b8ddb0df30)).

Btw, the question of whether `zaamo` is implied by `zabha` or not, which was discussed in https://github.com/rust-lang/rust/pull/130877, has been resolved in LLVM 20, since LLVM now treats `zaamo` as implied by `zabha`/`zacas` (https://github.com/llvm/llvm-project/pull/115694), just like GCC and rustc.

r? `@Amanieu`

`@rustbot` label +O-riscv +A-target-feature
2025-02-24 19:21:47 -05:00
..
auxiliary Add Cargo revision and values to the check-cfg macro test 2024-11-19 22:48:36 +01:00
allow-at-crate-level.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
allow-macro-cfg.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
allow-same-level.rs Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
allow-same-level.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
allow-top-level.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
allow-upper-level.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
and-more-diagnostic.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
and-more-diagnostic.stderr Add specific test for check-cfg "and X more" diagnostic 2024-12-01 20:51:52 +01:00
cargo-build-script.rs Don't suggest adding the unexpected cfgs the build-script it-self 2024-05-22 20:58:57 +02:00
cargo-build-script.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
cargo-feature.none.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
cargo-feature.rs Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
cargo-feature.some.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
cfg-value-for-cfg-name-duplicate.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
cfg-value-for-cfg-name-duplicate.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
cfg-value-for-cfg-name-multiple.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
cfg-value-for-cfg-name-multiple.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
cfg-value-for-cfg-name.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
cfg-value-for-cfg-name.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
compact-names.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
compact-names.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
compact-values.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
compact-values.stderr Convert unexpected_cfg_{name,value} to struct diagnostics 2024-05-21 20:16:39 +00:00
concat-values.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
concat-values.stderr Convert unexpected_cfg_{name,value} to struct diagnostics 2024-05-21 20:16:39 +00:00
diagnotics.cargo.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
diagnotics.rs Fix quote escaping inside check-cfg value 2024-05-20 11:44:09 +02:00
diagnotics.rustc.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
empty-values.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
empty-values.stderr compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
exhaustive-names-values.empty_cfg.stderr Add amdgpu target 2025-01-31 09:59:41 +01:00
exhaustive-names-values.feature.stderr Auto merge of #134740 - Flakebi:amdgpu-target, r=workingjubilee 2025-02-10 05:18:36 +00:00
exhaustive-names-values.full.stderr Auto merge of #134740 - Flakebi:amdgpu-target, r=workingjubilee 2025-02-10 05:18:36 +00:00
exhaustive-names-values.rs Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
exhaustive-names.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
exhaustive-names.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
exhaustive-values.empty_cfg.stderr Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
exhaustive-values.rs Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
exhaustive-values.without_names.stderr Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
invalid-arguments.any_values.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.anything_else.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.boolean.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.cfg_none.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.giberich.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.ident_in_values_1.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.ident_in_values_2.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.mixed_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.mixed_values_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.multiple_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.multiple_values.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.multiple_values_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.none_not_empty.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.not_empty_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.not_empty_values_any.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.rs Reject leading unsafe in cfg!(...) and --check-cfg. 2024-09-30 12:15:08 +02:00
invalid-arguments.string_for_name_1.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.string_for_name_2.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.unknown_meta_item_1.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.unknown_meta_item_2.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.unknown_meta_item_3.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.unsafe_attr.stderr Reject leading unsafe in cfg!(...) and --check-cfg. 2024-09-30 12:15:08 +02:00
invalid-arguments.unterminated.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.values_any_before_ident.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
invalid-arguments.values_any_missing_values.stderr Improve check-cfg CLI errors with more structured diagnostics 2024-05-06 07:44:41 +02:00
mix.rs Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
mix.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
my-awesome-platform.json
no-expected-values.empty.stderr Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
no-expected-values.mixed.stderr Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
no-expected-values.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
no-expected-values.simple.stderr Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
order-independant.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
order-independant.values_after.stderr compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
order-independant.values_before.stderr compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
raw-keywords.edition2015.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
raw-keywords.edition2021.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
raw-keywords.rs Improve handling of raw-idents in check-cfg 2024-09-18 11:07:32 +02:00
report-in-external-macros.cargo.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
report-in-external-macros.rs Add Cargo revision and values to the check-cfg macro test 2024-11-19 22:48:36 +01:00
report-in-external-macros.rustc.stderr Update test output to include check_contracts cfg 2025-02-03 13:55:15 -08:00
stmt-no-ice.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
stmt-no-ice.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
target_feature.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
target_feature.stderr Rollup merge of #137417 - taiki-e:riscv-atomic, r=Amanieu 2025-02-24 19:21:47 -05:00
unexpected-cfg-name.rs Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
unexpected-cfg-name.stderr Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
unexpected-cfg-value.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
unexpected-cfg-value.stderr Convert unexpected_cfg_{name,value} to struct diagnostics 2024-05-21 20:16:39 +00:00
unknown-values.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
values-none.concat_1.stderr Fix test problems discovered by the revision check 2024-05-09 14:47:09 +10:00
values-none.concat_2.stderr Fix test problems discovered by the revision check 2024-05-09 14:47:09 +10:00
values-none.explicit.stderr compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
values-none.implicit.stderr compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
values-none.rs Fix test problems discovered by the revision check 2024-05-09 14:47:09 +10:00
values-none.simple.stderr Fix test problems discovered by the revision check 2024-05-09 14:47:09 +10:00
values-target-json.rs compiletest: add no-auto-check-cfg directive 2024-05-04 11:30:38 +02:00
well-known-names.rs Filter well known names from check-cfg diagnostics 2025-01-25 12:27:33 +01:00
well-known-names.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
well-known-values.rs Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
well-known-values.stderr Add cygwin target. 2025-02-10 17:13:15 +08:00