diff --git a/README.md b/README.md index b76ffb2e..c8f2a85b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ portable-atomic = { version = "1.3", default-features = false, features = ["requ ## 128-bit atomics support -Native 128-bit atomic operations are available on x86_64 (Rust 1.59+), AArch64 (Rust 1.59+), powerpc64 (nightly only), and s390x (nightly only), otherwise the fallback implementation is used. +Native 128-bit atomic operations are available on x86_64 (Rust 1.59+), AArch64 (Rust 1.59+), riscv64 (Rust 1.82+), powerpc64 (nightly only), and s390x (nightly only), otherwise the fallback implementation is used. On x86_64, even if `cmpxchg16b` is not available at compile-time (note: `cmpxchg16b` target feature is enabled by default only on Apple and Windows (except Windows 7) targets), run-time detection checks whether `cmpxchg16b` is available. If `cmpxchg16b` is not available at either compile-time or run-time detection, the fallback implementation is used. See also [`portable_atomic_no_outline_atomics`](#optional-cfg-no-outline-atomics) cfg. diff --git a/src/imp/atomic128/README.md b/src/imp/atomic128/README.md index 6b087eae..c1e5070b 100644 --- a/src/imp/atomic128/README.md +++ b/src/imp/atomic128/README.md @@ -20,7 +20,7 @@ See [aarch64.rs](aarch64.rs) module-level comments for more details on the instr ## Comparison with core::intrinsics::atomic_\* (core::sync::atomic::Atomic{I,U}128) -This directory has target-specific implementations with inline assembly ([aarch64.rs](aarch64.rs), [x86_64.rs](x86_64.rs), [powerpc64.rs](powerpc64.rs), [riscv64.rs](riscv64.rs), [s390x.rs](s390x.rs)) and an implementation without inline assembly ([intrinsics.rs](intrinsics.rs)). The latter currently always needs nightly compilers and is only used for Miri and ThreadSanitizer, which do not support inline assembly. +This directory has target-specific implementations with inline assembly [x86_64.rs](x86_64.rs), ([aarch64.rs](aarch64.rs), [riscv64.rs](riscv64.rs), [powerpc64.rs](powerpc64.rs), [s390x.rs](s390x.rs)) and an implementation without inline assembly ([intrinsics.rs](intrinsics.rs)). The latter currently always needs nightly compilers and is only used for Miri and ThreadSanitizer, which do not support inline assembly. Implementations with inline assembly generate assemblies almost equivalent to the `core::intrinsics::atomic_*` (used in `core::sync::atomic::Atomic{I,U}128`) for many operations, but some operations may or may not generate more efficient code. For example: diff --git a/src/imp/atomic64/README.md b/src/imp/atomic64/README.md index 32318f1e..ecaba4a9 100644 --- a/src/imp/atomic64/README.md +++ b/src/imp/atomic64/README.md @@ -9,7 +9,7 @@ Here is the table of targets that support 64-bit atomics and the instructions us | target_arch | load | store | CAS | RMW | note | | ----------- | ---- | ----- | --- | --- | ---- | | x86 | cmpxchg8b or fild or movlps or movq | cmpxchg8b or fistp or movlps | cmpxchg8b | cmpxchg8b | provided by `core::sync::atomic` | -| 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 for more) | +| 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) | | riscv32 | amocas.d | amocas.d | amocas.d | amocas.d | Experimental. Requires experimental-zacas target feature. Currently compile-time detection only due to LLVM marking it as experimental.
Requires 1.82+ (LLVM 19+) | If `core::sync::atomic` provides 64-bit atomics, we use them. diff --git a/src/imp/riscv.rs b/src/imp/riscv.rs index 8664d14e..7235ddca 100644 --- a/src/imp/riscv.rs +++ b/src/imp/riscv.rs @@ -11,8 +11,6 @@ Also, optionally provides RMW implementation when force-amo or Zaamo target feat Refs: - RISC-V Instruction Set Manual https://github.com/riscv/riscv-isa-manual/tree/riscv-isa-release-8b9dc50-2024-08-30 - "Mappings from C/C++ primitives to RISC-V primitives." table in Code Porting and Mapping Guidelines - https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-8b9dc50-2024-08-30/src/mm-eplan.adoc#code-porting-and-mapping-guidelines "Zaamo" Extension for Atomic Memory Operations https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-8b9dc50-2024-08-30/src/a-st-ext.adoc#zaamo-extension-for-atomic-memory-operations "Zabha" Extension for Byte and Halfword Atomic Memory Operations