about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2022-06-21 12:31:42 +0200
committerSimon Sapin <simon.sapin@exyr.org>2022-06-21 12:31:42 +0200
commit20bd0c377163f384ae66943674ed2e397dd1c73a (patch)
tree89c7d2a6247411337973251c0800dee07672864e /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parentabace0a1f17986d89aedf610819deab2b4afee56 (diff)
downloadrust-20bd0c377163f384ae66943674ed2e397dd1c73a.tar.gz
rust-20bd0c377163f384ae66943674ed2e397dd1c73a.zip
Re-enable atomic loads and stores for all RISC-V targets
This roughly reverts PR https://github.com/rust-lang/rust/pull/66548

Atomic "CAS" are still disabled for targets without the
*“A” Standard Extension for Atomic Instructions*.
However this extension only adds instructions for operations more complex
than simple loads and stores, which are always atomic when aligned.

In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/)
section 2.6 *Load and Store Instructions* of
chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine):

> Even when misaligned loads and stores complete successfully,
> these accesses might run extremely slowly depending on the implementation
> (e.g., when implemented via an invisible trap). Further-more, whereas
> **naturally aligned loads and stores are guaranteed to execute atomically**,
> misaligned loads and stores might not, and hence require
> additional synchronization to ensure atomicity.

Unfortunately PR https://github.com/rust-lang/rust/pull/66548 did not provide
much details on the bug that motivated it, but
https://github.com/rust-lang/rust/issues/66240 and
https://github.com/rust-lang/rust/issues/85736 appear related
and happen with targets that do have the A extension.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions