| 1 |
# 64-bit atomic implementations on 32-bit architectures |
| 2 |
|
| 3 |
(See the [`atomic128` module](../atomic128) for 128-bit atomic implementations on 64-bit architectures.) |
| 4 |
|
| 5 |
## 64-bit atomic instructions |
| 6 |
|
| 7 |
Here is the table of targets that support 64-bit atomics and the instructions used: |
| 8 |
|
| 9 |
| target_arch | load | store | CAS | RMW | note | |
| 10 |
| ----------- | ---- | ----- | --- | --- | ---- | |
| 11 |
| x86 | cmpxchg8b or fild or movlps or movq | cmpxchg8b or fistp or movlps | cmpxchg8b | cmpxchg8b | provided by `core::sync::atomic` | |
| 12 |
| arm | ldrexd | ldrexd/strexd | ldrexd/strexd | ldrexd/strexd | provided by `core::sync::atomic` for Armv6+, otherwise provided by us for Linux/Android using kuser_cmpxchg64 (see [arm_linux.rs](arm_linux.rs) for more) | |
| 13 |
| riscv32 | amocas.d | amocas.d | amocas.d | amocas.d | Requires `zacas` target feature. Both compile-time and run-time detection are supported. <br> Requires Rust 1.59+ | |
| 14 |
| hexagon | memd | memd | memd_locked | memd_locked | Unimplemented | |
| 15 |
| sparc | ldx | stx | casx | casx | Unimplemented (unsupported in LLVM). Requires `v8plus` and `v9` target feature (Linux is v8plus+v9 by default) | |
| 16 |
| m68k | cas2 | cas2 | cas2 | cas2 | Unimplemented (unsupported in LLVM). Requires M68020 or later (Linux is M68020 by default) | |
| 17 |
| mips32r6 | llwp | llwp/scwp | llwp/scwp | llwp/scwp | Unimplemented (unsupported in LLVM). Requires Release 6 Paired LL/SC family of instructions | |
| 18 |
|
| 19 |
If `core::sync::atomic` provides 64-bit atomics, we use them. |
| 20 |
On compiler versions or platforms where these are not supported, the fallback implementation is used. |
| 21 |
|
| 22 |
## Run-time CPU feature detection |
| 23 |
|
| 24 |
See the [`detect` module's readme](../detect/README.md) for run-time CPU feature detection. |