#[cfg(not(any(
all(
portable_atomic_no_atomic_load_store,
not(all(target_arch = "bpf", not(feature = "critical-section"))),
),
target_arch = "avr",
target_arch = "msp430",
)))]
#[cfg_attr(
portable_atomic_no_cfg_target_has_atomic,
cfg(not(all(
any(
target_arch = "riscv32",
target_arch = "riscv64",
feature = "critical-section",
portable_atomic_unsafe_assume_single_core,
),
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",
portable_atomic_unsafe_assume_single_core,
),
not(target_has_atomic = "ptr"),
)))
)]
mod core_atomic;
#[cfg(target_arch = "msp430")]
pub(crate) mod msp430;
#[cfg(any(test, not(feature = "critical-section")))]
#[cfg_attr(
portable_atomic_no_cfg_target_has_atomic,
cfg(any(
all(test, not(any(miri, portable_atomic_sanitize_thread))),
portable_atomic_no_atomic_cas,
))
)]
#[cfg_attr(
not(portable_atomic_no_cfg_target_has_atomic),
cfg(any(
all(test, not(any(miri, portable_atomic_sanitize_thread))),
not(target_has_atomic = "ptr"),
))
)]
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
mod riscv;
#[cfg(all(
any(target_arch = "x86", target_arch = "x86_64"),
not(any(miri, portable_atomic_sanitize_thread)),
any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
))]
mod x86;
#[cfg(any(target_arch = "arm", target_arch = "riscv32"))]
mod atomic64;
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "s390x",
target_arch = "x86_64",
))]
mod atomic128;
#[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(
target_arch = "aarch64",
any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
),
all(target_arch = "arm64ec", portable_atomic_unstable_asm_experimental_arch),
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(
target_arch = "riscv64",
not(portable_atomic_no_asm),
any(
target_feature = "experimental-zacas",
portable_atomic_target_feature = "experimental-zacas",
),
),
all(
target_arch = "powerpc64",
portable_atomic_unstable_asm_experimental_arch,
any(
target_feature = "quadword-atomics",
portable_atomic_target_feature = "quadword-atomics",
),
),
all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch),
))
))]
mod fallback;
#[cfg(any(
all(test, target_os = "none"),
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(any(test, portable_atomic_no_atomic_cas)))]
#[cfg_attr(
not(portable_atomic_no_cfg_target_has_atomic),
cfg(any(test, not(target_has_atomic = "ptr")))
)]
#[cfg(any(
target_arch = "arm",
target_arch = "avr",
target_arch = "msp430",
target_arch = "riscv32",
target_arch = "riscv64",
target_arch = "xtensa",
feature = "critical-section",
))]
mod interrupt;
#[cfg(feature = "float")]
#[allow(clippy::float_arithmetic)]
pub(crate) mod float;
#[cfg(not(any(
portable_atomic_no_atomic_load_store,
target_arch = "avr",
target_arch = "msp430",
)))]
#[cfg_attr(
portable_atomic_no_cfg_target_has_atomic,
cfg(not(all(
any(
target_arch = "riscv32",
target_arch = "riscv64",
feature = "critical-section",
portable_atomic_unsafe_assume_single_core,
),
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",
portable_atomic_unsafe_assume_single_core,
),
not(target_has_atomic = "ptr"),
)))
)]
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};
}
#[cfg(all(
target_arch = "bpf",
portable_atomic_no_atomic_load_store,
not(feature = "critical-section"),
))]
pub(crate) use self::core_atomic::{AtomicI64, AtomicIsize, AtomicPtr, AtomicU64, AtomicUsize};
#[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"))]
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};
}
#[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")))]
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};
}
#[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(any(
all(
target_arch = "arm",
not(any(miri, portable_atomic_sanitize_thread)),
any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
any(target_os = "linux", target_os = "android"),
not(any(target_feature = "v6", portable_atomic_target_feature = "v6")),
not(portable_atomic_no_outline_atomics),
),
all(
target_arch = "riscv32",
not(any(miri, portable_atomic_sanitize_thread)),
not(portable_atomic_no_asm),
not(portable_atomic_pre_llvm_19),
any(
target_feature = "experimental-zacas",
portable_atomic_target_feature = "experimental-zacas",
all(
feature = "fallback",
not(portable_atomic_no_outline_atomics),
any(test, portable_atomic_outline_atomics), any(target_os = "linux", target_os = "android"),
),
),
),
)))]
#[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(
target_arch = "aarch64",
any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
),
all(target_arch = "arm64ec", portable_atomic_unstable_asm_experimental_arch),
all(
target_arch = "x86_64",
not(all(
any(miri, portable_atomic_sanitize_thread),
portable_atomic_no_cmpxchg16b_intrinsic,
)),
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_outline_atomics),
not(any(target_env = "sgx", miri)),
),
),
),
all(
target_arch = "riscv64",
not(portable_atomic_no_asm),
not(portable_atomic_pre_llvm_19),
any(
target_feature = "experimental-zacas",
portable_atomic_target_feature = "experimental-zacas",
all(
feature = "fallback",
not(portable_atomic_no_outline_atomics),
any(test, portable_atomic_outline_atomics), any(target_os = "linux", target_os = "android"),
not(any(miri, portable_atomic_sanitize_thread)),
),
),
),
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, 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",
all(target_os = "openbsd", portable_atomic_outline_atomics),
),
not(any(miri, portable_atomic_sanitize_thread)),
),
),
),
all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch),
)))]
pub(crate) use self::fallback::{AtomicI128, AtomicU128};
}
#[cfg(feature = "fallback")]
#[cfg(all(
target_arch = "arm",
not(any(miri, portable_atomic_sanitize_thread)),
any(not(portable_atomic_no_asm), portable_atomic_unstable_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::atomic64::arm_linux::{AtomicI64, AtomicU64};
#[cfg(all(
target_arch = "riscv32",
not(any(miri, portable_atomic_sanitize_thread)),
not(portable_atomic_no_asm),
not(portable_atomic_pre_llvm_19),
any(
target_feature = "experimental-zacas",
portable_atomic_target_feature = "experimental-zacas",
all(
feature = "fallback",
not(portable_atomic_no_outline_atomics),
any(test, portable_atomic_outline_atomics), any(target_os = "linux", target_os = "android"),
),
),
))]
pub(crate) use self::atomic64::riscv32::{AtomicI64, AtomicU64};
#[cfg(any(
all(target_arch = "aarch64", any(not(portable_atomic_no_asm), portable_atomic_unstable_asm)),
all(target_arch = "arm64ec", portable_atomic_unstable_asm_experimental_arch)
))]
pub(crate) use self::atomic128::aarch64::{AtomicI128, AtomicU128};
#[cfg(all(
target_arch = "x86_64",
not(all(any(miri, portable_atomic_sanitize_thread), portable_atomic_no_cmpxchg16b_intrinsic)),
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_outline_atomics),
not(any(target_env = "sgx", miri)),
),
),
))]
pub(crate) use self::atomic128::x86_64::{AtomicI128, AtomicU128};
#[cfg(all(
target_arch = "riscv64",
not(portable_atomic_no_asm),
not(portable_atomic_pre_llvm_19),
any(
target_feature = "experimental-zacas",
portable_atomic_target_feature = "experimental-zacas",
all(
feature = "fallback",
not(portable_atomic_no_outline_atomics),
any(test, portable_atomic_outline_atomics), any(target_os = "linux", target_os = "android"),
not(any(miri, portable_atomic_sanitize_thread)),
),
),
))]
pub(crate) use self::atomic128::riscv64::{AtomicI128, AtomicU128};
#[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, 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",
all(target_os = "openbsd", portable_atomic_outline_atomics),
),
not(any(miri, portable_atomic_sanitize_thread)),
),
),
))]
pub(crate) use self::atomic128::powerpc64::{AtomicI128, AtomicU128};
#[cfg(all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch))]
pub(crate) use self::atomic128::s390x::{AtomicI128, AtomicU128};