Conversation
[skip ci]
|
This would also cause |
Yes.
128-bit atomics are not stabilized yet although it passed FCP. |
It does mean either all code that wants to use 128-bit atomics has to special case x86_64 and only use it there is cmpxchg16b is also enabled, or if we want to keep the option open to also make it target feature dependent on other architectures, it isn't possible to use 128-bit atomics in architecture independent code at all. |
The final goal is to do this for all architectures that support 128-bit atomics but require some target features.
True. Logically this is also impossible. |
Before this PR #[cfg(all(
target_has_atomic = "128",
any(
all(target_arch = "x86_64", target_feature = "cmpxchg16b"),
// other architecture+target feature pairs
)
))]at that point I did much rather have #[cfg(any(
target_has_atomic = "128", // 128bit atomics are always supported for this target
all(target_arch = "x86_64", target_feature = "cmpxchg16b"), // x86_64 needs cmpxchg16b for 128bit atomics to be available
// other architecture+target feature pairs for targets where 128bit atomics are conditionally supported
))] |
FYI, AFAIK, riscv32/m68k/mips32r6 (64-bit atomics) and riscv64/powerpc64(be)/loongarch64/nvptx64/mips64r6 (128-bit atomics) are in a similar situation to x86_64’s cmpxchg16b (some CPUs support atomic operations with a larger width than what is available in the target's baseline). In other words, it's not specific to 128-bit atomics. Also related to 64-bit atomics which already in stable. |
For implementing traits for |
For those we set |
|
The reference defines
So, |
tracking issue: #99069
This API is inconvenient to use. Because one can't just write
The call must be in an unsafe block, otherwise
rustccomplainsblocked on llvm/llvm-project#187503
context: https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/AtomicU128.20if.20cmpexch16b.20is.20enabled
r? @Amanieu