portable_atomic/imp/atomic128/
mod.rs

1// SPDX-License-Identifier: Apache-2.0 OR MIT
2
3/*
4128-bit atomic implementations on 64-bit architectures
5
6See README.md for details.
7*/
8
9// AArch64
10#[cfg(any(
11    all(
12        target_arch = "aarch64",
13        not(all(
14            any(miri, portable_atomic_sanitize_thread),
15            not(portable_atomic_atomic_intrinsics),
16        )),
17        any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
18    ),
19    all(
20        target_arch = "arm64ec",
21        not(all(
22            any(miri, portable_atomic_sanitize_thread),
23            not(portable_atomic_atomic_intrinsics),
24        )),
25        not(portable_atomic_no_asm),
26    ),
27))]
28// Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly.
29#[cfg_attr(any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs")]
30pub(super) mod aarch64;
31
32// powerpc64
33#[cfg(all(
34    target_arch = "powerpc64",
35    not(all(
36        any(miri, portable_atomic_sanitize_thread),
37        not(portable_atomic_atomic_intrinsics),
38    )),
39    portable_atomic_unstable_asm_experimental_arch,
40    any(
41        target_feature = "quadword-atomics",
42        portable_atomic_target_feature = "quadword-atomics",
43        all(
44            feature = "fallback",
45            not(portable_atomic_no_outline_atomics),
46            any(
47                all(
48                    target_os = "linux",
49                    any(
50                        all(
51                            target_env = "gnu",
52                            any(target_endian = "little", not(target_feature = "crt-static")),
53                        ),
54                        all(
55                            target_env = "musl",
56                            any(not(target_feature = "crt-static"), feature = "std"),
57                        ),
58                        target_env = "ohos",
59                        all(target_env = "uclibc", not(target_feature = "crt-static")),
60                        portable_atomic_outline_atomics,
61                    ),
62                ),
63                target_os = "android",
64                all(
65                    target_os = "freebsd",
66                    any(
67                        target_endian = "little",
68                        not(target_feature = "crt-static"),
69                        portable_atomic_outline_atomics,
70                    ),
71                ),
72                target_os = "openbsd",
73                all(
74                    target_os = "aix",
75                    not(portable_atomic_pre_llvm_20),
76                    any(test, portable_atomic_outline_atomics), // TODO(aix): currently disabled by default
77                ),
78            ),
79            not(any(miri, portable_atomic_sanitize_thread)),
80        ),
81    ),
82))]
83// Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly.
84#[cfg_attr(any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs")]
85pub(super) mod powerpc64;
86
87// riscv64
88#[cfg(all(
89    target_arch = "riscv64",
90    not(any(miri, portable_atomic_sanitize_thread)),
91    any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
92    any(
93        target_feature = "zacas",
94        portable_atomic_target_feature = "zacas",
95        all(
96            feature = "fallback",
97            not(portable_atomic_no_outline_atomics),
98            any(target_os = "linux", target_os = "android"),
99        ),
100    ),
101))]
102pub(super) mod riscv64;
103
104// s390x
105#[cfg(all(
106    target_arch = "s390x",
107    not(all(any(miri, portable_atomic_sanitize_thread), not(portable_atomic_atomic_intrinsics))),
108    not(portable_atomic_no_asm),
109))]
110// Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly.
111#[cfg_attr(any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs")]
112pub(super) mod s390x;
113
114// x86_64
115#[cfg(all(
116    target_arch = "x86_64",
117    not(all(any(miri, portable_atomic_sanitize_thread), portable_atomic_no_cmpxchg16b_intrinsic)),
118    any(not(portable_atomic_no_asm), portable_atomic_unstable_asm),
119    any(
120        target_feature = "cmpxchg16b",
121        portable_atomic_target_feature = "cmpxchg16b",
122        all(
123            feature = "fallback",
124            not(portable_atomic_no_outline_atomics),
125            not(any(target_env = "sgx", miri)),
126        ),
127    ),
128))]
129// Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly.
130#[cfg_attr(any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs")]
131pub(super) mod x86_64;