diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/portable-atomic/src/imp/mod.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/portable-atomic/src/imp/mod.rs')
-rw-r--r-- | vendor/portable-atomic/src/imp/mod.rs | 475 |
1 files changed, 218 insertions, 257 deletions
diff --git a/vendor/portable-atomic/src/imp/mod.rs b/vendor/portable-atomic/src/imp/mod.rs index 3dbe8e6c2..cea71eb3f 100644 --- a/vendor/portable-atomic/src/imp/mod.rs +++ b/vendor/portable-atomic/src/imp/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT + // ----------------------------------------------------------------------------- // Lock-free implementations @@ -12,7 +14,10 @@ )))] #[cfg_attr( portable_atomic_no_cfg_target_has_atomic, - cfg(not(all(feature = "critical-section", portable_atomic_no_atomic_cas))) + cfg(not(all( + any(target_arch = "riscv32", target_arch = "riscv64", feature = "critical-section"), + portable_atomic_no_atomic_cas, + ))) )] #[cfg_attr( not(portable_atomic_no_cfg_target_has_atomic), @@ -23,8 +28,11 @@ )] mod core_atomic; -#[cfg(any(not(portable_atomic_no_asm), portable_atomic_unstable_asm))] -#[cfg(target_arch = "aarch64")] +// aarch64 128-bit atomics +#[cfg(all( + target_arch = "aarch64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), +))] // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. #[cfg_attr( all(any(miri, portable_atomic_sanitize_thread), portable_atomic_new_atomic_intrinsics), @@ -36,16 +44,19 @@ mod core_atomic; )] mod aarch64; -#[cfg(any(not(portable_atomic_no_asm), portable_atomic_unstable_asm))] -#[cfg(target_arch = "x86_64")] -#[cfg(any( - target_feature = "cmpxchg16b", - portable_atomic_target_feature = "cmpxchg16b", - all( - feature = "fallback", - not(portable_atomic_no_cmpxchg16b_target_feature), - not(portable_atomic_no_outline_atomics), - not(any(target_env = "sgx", miri)), +// x86_64 128-bit atomics +#[cfg(all( + target_arch = "x86_64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), + any( + target_feature = "cmpxchg16b", + portable_atomic_target_feature = "cmpxchg16b", + all( + feature = "fallback", + not(portable_atomic_no_cmpxchg16b_target_feature), + not(portable_atomic_no_outline_atomics), + not(any(target_env = "sgx", miri)), + ), ), ))] // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. @@ -53,27 +64,34 @@ mod aarch64; #[cfg_attr(not(any(miri, portable_atomic_sanitize_thread)), path = "atomic128/x86_64.rs")] mod x86_64; -#[cfg(portable_atomic_unstable_asm_experimental_arch)] -#[cfg(target_arch = "powerpc64")] -#[cfg(any( - target_feature = "quadword-atomics", - portable_atomic_target_feature = "quadword-atomics", - all( - feature = "fallback", - not(portable_atomic_no_outline_atomics), - any(test, portable_atomic_outline_atomics), // TODO(powerpc64): currently disabled by default - any( - all( - target_os = "linux", - any( - target_env = "gnu", - all(target_env = "musl", not(target_feature = "crt-static")), - portable_atomic_outline_atomics, +// powerpc64 128-bit atomics +#[cfg(all( + target_arch = "powerpc64", + portable_atomic_unstable_asm_experimental_arch, + any( + target_feature = "quadword-atomics", + portable_atomic_target_feature = "quadword-atomics", + all( + feature = "fallback", + not(portable_atomic_no_outline_atomics), + any(test, portable_atomic_outline_atomics), // TODO(powerpc64): currently disabled by default + any( + all( + target_os = "linux", + any( + target_env = "gnu", + all( + any(target_env = "musl", target_env = "ohos"), + not(target_feature = "crt-static"), + ), + portable_atomic_outline_atomics, + ), ), + target_os = "android", + target_os = "freebsd", ), - target_os = "freebsd", + not(any(miri, portable_atomic_sanitize_thread)), ), - not(any(miri, portable_atomic_sanitize_thread)), ), ))] // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. @@ -87,25 +105,20 @@ mod x86_64; )] mod powerpc64; -#[cfg(portable_atomic_unstable_asm_experimental_arch)] -#[cfg(target_arch = "s390x")] +// s390x 128-bit atomics +#[cfg(all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch))] // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. -#[cfg_attr( - all(any(miri, portable_atomic_sanitize_thread), portable_atomic_new_atomic_intrinsics), - path = "atomic128/intrinsics.rs" -)] -#[cfg_attr( - not(all(any(miri, portable_atomic_sanitize_thread), portable_atomic_new_atomic_intrinsics)), - path = "atomic128/s390x.rs" -)] +#[cfg_attr(any(miri, portable_atomic_sanitize_thread), path = "atomic128/intrinsics.rs")] +#[cfg_attr(not(any(miri, portable_atomic_sanitize_thread)), path = "atomic128/s390x.rs")] mod s390x; -// Miri and Sanitizer do not support inline assembly. +// pre-v6 ARM Linux 64-bit atomics #[cfg(feature = "fallback")] +// Miri and Sanitizer do not support inline assembly. #[cfg(all( - not(any(miri, portable_atomic_sanitize_thread)), - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), target_arch = "arm", + not(any(miri, portable_atomic_sanitize_thread)), + not(portable_atomic_no_asm), any(target_os = "linux", target_os = "android"), not(any(target_feature = "v6", portable_atomic_target_feature = "v6")), not(portable_atomic_no_outline_atomics), @@ -114,9 +127,11 @@ mod s390x; #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "64")))] mod arm_linux; +// MSP430 atomics #[cfg(target_arch = "msp430")] pub(crate) mod msp430; +// atomic load/store for RISC-V without A-extension #[cfg(any(test, not(feature = "critical-section")))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(any(test, portable_atomic_no_atomic_cas)))] #[cfg_attr( @@ -126,11 +141,12 @@ pub(crate) mod msp430; #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] mod riscv; +// x86-specific optimizations // Miri and Sanitizer do not support inline assembly. #[cfg(all( - not(any(miri, portable_atomic_sanitize_thread)), - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), any(target_arch = "x86", target_arch = "x86_64"), + not(any(miri, portable_atomic_sanitize_thread)), + not(portable_atomic_no_asm), ))] mod x86; @@ -138,31 +154,31 @@ mod x86; // Lock-based fallback implementations #[cfg(feature = "fallback")] +#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(not(portable_atomic_no_atomic_cas)))] +#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(target_has_atomic = "ptr"))] #[cfg(any( test, not(any( all( - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), target_arch = "aarch64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), ), all( + target_arch = "x86_64", any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), any(target_feature = "cmpxchg16b", portable_atomic_target_feature = "cmpxchg16b"), - target_arch = "x86_64", ), all( + target_arch = "powerpc64", portable_atomic_unstable_asm_experimental_arch, any( target_feature = "quadword-atomics", portable_atomic_target_feature = "quadword-atomics", ), - target_arch = "powerpc64", ), - all(portable_atomic_unstable_asm_experimental_arch, target_arch = "s390x"), + all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), )) ))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(not(portable_atomic_no_atomic_cas)))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(target_has_atomic = "ptr"))] mod fallback; // ----------------------------------------------------------------------------- @@ -170,7 +186,7 @@ mod fallback; // On AVR, we always use critical section based fallback implementation. // AVR can be safely assumed to be single-core, so this is sound. -// https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp#LL963 +// https://github.com/llvm/llvm-project/blob/llvmorg-17.0.0-rc2/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp#L1074 // MSP430 as well. #[cfg(any( all(test, target_os = "none"), @@ -185,13 +201,13 @@ mod fallback; cfg(any(test, not(target_has_atomic = "ptr"))) )] #[cfg(any( - feature = "critical-section", target_arch = "arm", target_arch = "avr", target_arch = "msp430", target_arch = "riscv32", target_arch = "riscv64", target_arch = "xtensa", + feature = "critical-section", ))] mod interrupt; @@ -203,7 +219,6 @@ pub(crate) mod float; // ----------------------------------------------------------------------------- -// Atomic{Isize,Usize,Bool,Ptr}, Atomic{I,U}{8,16} #[cfg(not(any( portable_atomic_no_atomic_load_store, portable_atomic_unsafe_assume_single_core, @@ -212,7 +227,10 @@ pub(crate) mod float; )))] #[cfg_attr( portable_atomic_no_cfg_target_has_atomic, - cfg(not(all(feature = "critical-section", portable_atomic_no_atomic_cas))) + cfg(not(all( + any(target_arch = "riscv32", target_arch = "riscv64", feature = "critical-section"), + portable_atomic_no_atomic_cas, + ))) )] #[cfg_attr( not(portable_atomic_no_cfg_target_has_atomic), @@ -221,29 +239,27 @@ pub(crate) mod float; not(target_has_atomic = "ptr"), ))) )] -pub(crate) use self::core_atomic::{ - AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize, -}; -// RISC-V without A-extension -#[cfg(not(any(portable_atomic_unsafe_assume_single_core, feature = "critical-section")))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] -pub(crate) use self::riscv::{ - AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize, -}; -// no core Atomic{Isize,Usize,Bool,Ptr}/Atomic{I,U}{8,16} & assume single core => critical section based fallback -#[cfg(any( - portable_atomic_unsafe_assume_single_core, - feature = "critical-section", - target_arch = "avr", - target_arch = "msp430", -))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -pub(crate) use self::interrupt::{ - AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize, -}; +items! { + pub(crate) use self::core_atomic::{ + AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, + }; + #[cfg_attr( + portable_atomic_no_cfg_target_has_atomic, + cfg(any( + not(portable_atomic_no_atomic_64), + not(any(target_pointer_width = "16", target_pointer_width = "32")), + )) + )] + #[cfg_attr( + not(portable_atomic_no_cfg_target_has_atomic), + cfg(any( + target_has_atomic = "64", + not(any(target_pointer_width = "16", target_pointer_width = "32")), + )) + )] + pub(crate) use self::core_atomic::{AtomicI64, AtomicU64}; +} // bpf #[cfg(all( target_arch = "bpf", @@ -252,33 +268,21 @@ pub(crate) use self::interrupt::{ ))] pub(crate) use self::core_atomic::{AtomicI64, AtomicIsize, AtomicPtr, AtomicU64, AtomicUsize}; -// Atomic{I,U}32 -#[cfg(not(any( - portable_atomic_no_atomic_load_store, - portable_atomic_unsafe_assume_single_core, - target_arch = "avr", - target_arch = "msp430", -)))] -#[cfg_attr( - portable_atomic_no_cfg_target_has_atomic, - cfg(not(all(feature = "critical-section", portable_atomic_no_atomic_cas))) -)] -#[cfg_attr( - not(portable_atomic_no_cfg_target_has_atomic), - cfg(not(all( - any(target_arch = "riscv32", target_arch = "riscv64", feature = "critical-section"), - not(target_has_atomic = "ptr"), - ))) -)] -pub(crate) use self::core_atomic::{AtomicI32, AtomicU32}; -// RISC-V without A-extension +// RISC-V without A-extension & !(assume single core | critical section) #[cfg(not(any(portable_atomic_unsafe_assume_single_core, feature = "critical-section")))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] -pub(crate) use self::riscv::{AtomicI32, AtomicU32}; -// no core Atomic{I,U}32 & no CAS & assume single core => critical section based fallback -#[cfg(any(not(target_pointer_width = "16"), feature = "fallback"))] +items! { + pub(crate) use self::riscv::{ + AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, + }; + #[cfg(target_arch = "riscv64")] + pub(crate) use self::riscv::{AtomicI64, AtomicU64}; +} + +// no core atomic CAS & (assume single core | critical section) => critical section based fallback #[cfg(any( portable_atomic_unsafe_assume_single_core, feature = "critical-section", @@ -287,53 +291,97 @@ pub(crate) use self::riscv::{AtomicI32, AtomicU32}; ))] #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -pub(crate) use self::interrupt::{AtomicI32, AtomicU32}; +items! { + pub(crate) use self::interrupt::{ + AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize, + }; + #[cfg(any(not(target_pointer_width = "16"), feature = "fallback"))] + pub(crate) use self::interrupt::{AtomicI32, AtomicU32}; + #[cfg(any( + not(any(target_pointer_width = "16", target_pointer_width = "32")), + feature = "fallback", + ))] + pub(crate) use self::interrupt::{AtomicI64, AtomicU64}; + #[cfg(feature = "fallback")] + pub(crate) use self::interrupt::{AtomicI128, AtomicU128}; +} -// Atomic{I,U}64 -#[cfg(not(any( - portable_atomic_no_atomic_load_store, - portable_atomic_unsafe_assume_single_core, -)))] -#[cfg_attr( - portable_atomic_no_cfg_target_has_atomic, - cfg(any( - not(portable_atomic_no_atomic_64), +// no core (64-bit | 128-bit) atomic & has CAS => use lock-base fallback +#[cfg(feature = "fallback")] +#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(not(portable_atomic_no_atomic_cas)))] +#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(target_has_atomic = "ptr"))] +items! { + #[cfg(not(all( + target_arch = "arm", + not(any(miri, portable_atomic_sanitize_thread)), + not(portable_atomic_no_asm), + any(target_os = "linux", target_os = "android"), + not(any(target_feature = "v6", portable_atomic_target_feature = "v6")), + not(portable_atomic_no_outline_atomics), + )))] + #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_64))] + #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "64")))] + pub(crate) use self::fallback::{AtomicI64, AtomicU64}; + #[cfg(not(any( all( - not(any(target_pointer_width = "16", target_pointer_width = "32")), - not(all(feature = "critical-section", portable_atomic_no_atomic_cas)), + target_arch = "aarch64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), ), - )) -)] -#[cfg_attr( - not(portable_atomic_no_cfg_target_has_atomic), - cfg(any( - target_has_atomic = "64", all( - not(any(target_pointer_width = "16", target_pointer_width = "32")), - not(all( - any( - target_arch = "riscv32", - target_arch = "riscv64", - feature = "critical-section", + target_arch = "x86_64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), + any( + target_feature = "cmpxchg16b", + portable_atomic_target_feature = "cmpxchg16b", + all( + feature = "fallback", + not(portable_atomic_no_cmpxchg16b_target_feature), + not(portable_atomic_no_outline_atomics), + not(any(target_env = "sgx", miri)), ), - not(target_has_atomic = "ptr"), - )), + ), ), - )) -)] -pub(crate) use self::core_atomic::{AtomicI64, AtomicU64}; -// RISC-V without A-extension -#[cfg(not(any(portable_atomic_unsafe_assume_single_core, feature = "critical-section")))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -#[cfg(target_arch = "riscv64")] -pub(crate) use self::riscv::{AtomicI64, AtomicU64}; + all( + target_arch = "powerpc64", + portable_atomic_unstable_asm_experimental_arch, + any( + target_feature = "quadword-atomics", + portable_atomic_target_feature = "quadword-atomics", + all( + feature = "fallback", + not(portable_atomic_no_outline_atomics), + portable_atomic_outline_atomics, // TODO(powerpc64): currently disabled by default + any( + all( + target_os = "linux", + any( + target_env = "gnu", + all( + any(target_env = "musl", target_env = "ohos"), + not(target_feature = "crt-static"), + ), + portable_atomic_outline_atomics, + ), + ), + target_os = "android", + target_os = "freebsd", + ), + not(any(miri, portable_atomic_sanitize_thread)), + ), + ), + ), + all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), + )))] + pub(crate) use self::fallback::{AtomicI128, AtomicU128}; +} + +// 64-bit atomics (platform-specific) // pre-v6 ARM Linux #[cfg(feature = "fallback")] #[cfg(all( - not(any(miri, portable_atomic_sanitize_thread)), - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), target_arch = "arm", + not(any(miri, portable_atomic_sanitize_thread)), + not(portable_atomic_no_asm), any(target_os = "linux", target_os = "android"), not(any(target_feature = "v6", portable_atomic_target_feature = "v6")), not(portable_atomic_no_outline_atomics), @@ -341,49 +389,17 @@ pub(crate) use self::riscv::{AtomicI64, AtomicU64}; #[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_64))] #[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "64")))] pub(crate) use self::arm_linux::{AtomicI64, AtomicU64}; -// no core Atomic{I,U}64 & has CAS => use lock-base fallback -#[cfg(feature = "fallback")] -#[cfg(not(all( - not(any(miri, portable_atomic_sanitize_thread)), - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), - target_arch = "arm", - any(target_os = "linux", target_os = "android"), - not(any(target_feature = "v6", portable_atomic_target_feature = "v6")), - not(portable_atomic_no_outline_atomics), -)))] -#[cfg_attr( - portable_atomic_no_cfg_target_has_atomic, - cfg(all(portable_atomic_no_atomic_64, not(portable_atomic_no_atomic_cas))) -)] -#[cfg_attr( - not(portable_atomic_no_cfg_target_has_atomic), - cfg(all(not(target_has_atomic = "64"), target_has_atomic = "ptr")) -)] -pub(crate) use self::fallback::{AtomicI64, AtomicU64}; -// no core Atomic{I,U}64 & no CAS & assume single core => critical section based fallback -#[cfg(any( - not(any(target_pointer_width = "16", target_pointer_width = "32")), - feature = "fallback", -))] -#[cfg(any( - portable_atomic_unsafe_assume_single_core, - feature = "critical-section", - target_arch = "avr", - target_arch = "msp430", -))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -pub(crate) use self::interrupt::{AtomicI64, AtomicU64}; -// Atomic{I,U}128 -// aarch64 stable +// 128-bit atomics (platform-specific) +// aarch64 #[cfg(all( - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), target_arch = "aarch64", + any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), ))] pub(crate) use self::aarch64::{AtomicI128, AtomicU128}; -// no core Atomic{I,U}128 & has cmpxchg16b => use cmpxchg16b +// x86_64 & (cmpxchg16b | outline-atomics) #[cfg(all( + target_arch = "x86_64", any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), any( target_feature = "cmpxchg16b", @@ -395,94 +411,39 @@ pub(crate) use self::aarch64::{AtomicI128, AtomicU128}; not(any(target_env = "sgx", miri)), ), ), - target_arch = "x86_64", ))] pub(crate) use self::x86_64::{AtomicI128, AtomicU128}; -// powerpc64 -#[cfg(portable_atomic_unstable_asm_experimental_arch)] -#[cfg(any( - target_feature = "quadword-atomics", - portable_atomic_target_feature = "quadword-atomics", - all( - feature = "fallback", - not(portable_atomic_no_outline_atomics), - portable_atomic_outline_atomics, // TODO(powerpc64): currently disabled by default - any( - all( - target_os = "linux", - any( - target_env = "gnu", - all(target_env = "musl", not(target_feature = "crt-static")), - portable_atomic_outline_atomics, +// powerpc64 & (pwr8 | outline-atomics) +#[cfg(all( + target_arch = "powerpc64", + portable_atomic_unstable_asm_experimental_arch, + any( + target_feature = "quadword-atomics", + portable_atomic_target_feature = "quadword-atomics", + all( + feature = "fallback", + not(portable_atomic_no_outline_atomics), + portable_atomic_outline_atomics, // TODO(powerpc64): currently disabled by default + any( + all( + target_os = "linux", + any( + target_env = "gnu", + all( + any(target_env = "musl", target_env = "ohos"), + not(target_feature = "crt-static"), + ), + portable_atomic_outline_atomics, + ), ), + target_os = "android", + target_os = "freebsd", ), - target_os = "freebsd", + not(any(miri, portable_atomic_sanitize_thread)), ), - not(any(miri, portable_atomic_sanitize_thread)), ), ))] -#[cfg(target_arch = "powerpc64")] pub(crate) use self::powerpc64::{AtomicI128, AtomicU128}; // s390x -#[cfg(portable_atomic_unstable_asm_experimental_arch)] -#[cfg(target_arch = "s390x")] +#[cfg(all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch))] pub(crate) use self::s390x::{AtomicI128, AtomicU128}; -// no core Atomic{I,U}128 & has CAS => use lock-base fallback -#[cfg(feature = "fallback")] -#[cfg(not(any( - all(any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), target_arch = "aarch64"), - all( - any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), - any( - target_feature = "cmpxchg16b", - portable_atomic_target_feature = "cmpxchg16b", - all( - feature = "fallback", - not(portable_atomic_no_cmpxchg16b_target_feature), - not(portable_atomic_no_outline_atomics), - not(any(target_env = "sgx", miri)), - ), - ), - target_arch = "x86_64", - ), - all( - portable_atomic_unstable_asm_experimental_arch, - any( - target_feature = "quadword-atomics", - portable_atomic_target_feature = "quadword-atomics", - all( - feature = "fallback", - not(portable_atomic_no_outline_atomics), - portable_atomic_outline_atomics, // TODO(powerpc64): currently disabled by default - any( - all( - target_os = "linux", - any( - target_env = "gnu", - all(target_env = "musl", not(target_feature = "crt-static")), - portable_atomic_outline_atomics, - ), - ), - target_os = "freebsd", - ), - not(any(miri, portable_atomic_sanitize_thread)), - ), - ), - target_arch = "powerpc64", - ), - all(portable_atomic_unstable_asm_experimental_arch, target_arch = "s390x"), -)))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(not(portable_atomic_no_atomic_cas)))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(target_has_atomic = "ptr"))] -pub(crate) use self::fallback::{AtomicI128, AtomicU128}; -// no core Atomic{I,U}128 & no CAS & assume_single_core => critical section based fallback -#[cfg(feature = "fallback")] -#[cfg(any( - portable_atomic_unsafe_assume_single_core, - feature = "critical-section", - target_arch = "avr", - target_arch = "msp430", -))] -#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(portable_atomic_no_atomic_cas))] -#[cfg_attr(not(portable_atomic_no_cfg_target_has_atomic), cfg(not(target_has_atomic = "ptr")))] -pub(crate) use self::interrupt::{AtomicI128, AtomicU128}; |