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