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" , not(portable_atomic_no_asm)) |
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( |
32 | all( |
33 | target_os = "linux" , |
34 | any( |
35 | all( |
36 | target_env = "gnu" , |
37 | any(target_endian = "little" , not(target_feature = "crt-static" )), |
38 | ), |
39 | all( |
40 | any(target_env = "musl" , target_env = "ohos" , target_env = "uclibc" ), |
41 | not(target_feature = "crt-static" ), |
42 | ), |
43 | portable_atomic_outline_atomics, |
44 | ), |
45 | ), |
46 | target_os = "android" , |
47 | target_os = "freebsd" , |
48 | target_os = "openbsd" , |
49 | ), |
50 | not(any(miri, portable_atomic_sanitize_thread)), |
51 | ), |
52 | ), |
53 | ))] |
54 | // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. |
55 | #[cfg_attr ( |
56 | all(any(miri, portable_atomic_sanitize_thread), not(portable_atomic_pre_llvm_15)), |
57 | path = "intrinsics.rs" |
58 | )] |
59 | pub(super) mod powerpc64; |
60 | |
61 | // riscv64 |
62 | #[cfg (all( |
63 | target_arch = "riscv64" , |
64 | not(portable_atomic_no_asm), |
65 | any( |
66 | target_feature = "experimental-zacas" , |
67 | portable_atomic_target_feature = "experimental-zacas" , |
68 | all( |
69 | feature = "fallback" , |
70 | not(portable_atomic_no_outline_atomics), |
71 | any(test, portable_atomic_outline_atomics), // TODO(riscv): currently disabled by default |
72 | any(target_os = "linux" , target_os = "android" ), |
73 | not(any(miri, portable_atomic_sanitize_thread)), |
74 | ), |
75 | ), |
76 | ))] |
77 | // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. |
78 | #[cfg_attr (any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs" )] |
79 | pub(super) mod riscv64; |
80 | |
81 | // s390x |
82 | #[cfg (all(target_arch = "s390x" , not(portable_atomic_no_asm)))] |
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" )] |
85 | pub(super) mod s390x; |
86 | |
87 | // x86_64 |
88 | #[cfg (all( |
89 | target_arch = "x86_64" , |
90 | not(all(any(miri, portable_atomic_sanitize_thread), portable_atomic_no_cmpxchg16b_intrinsic)), |
91 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), |
92 | any( |
93 | target_feature = "cmpxchg16b" , |
94 | portable_atomic_target_feature = "cmpxchg16b" , |
95 | all( |
96 | feature = "fallback" , |
97 | not(portable_atomic_no_outline_atomics), |
98 | not(any(target_env = "sgx" , miri)), |
99 | ), |
100 | ), |
101 | ))] |
102 | // Use intrinsics.rs on Miri and Sanitizer that do not support inline assembly. |
103 | #[cfg_attr (any(miri, portable_atomic_sanitize_thread), path = "intrinsics.rs" )] |
104 | pub(super) mod x86_64; |
105 | |