Remove use of atomic_load_unordered
and undefined behaviour from arm_linux.rs
by beetrees · Pull Request #790 · rust-lang/compiler-builtins (original) (raw)
atomic_load_unordered
is in the process of being removed (#788), so replace it with a relaxed atomic load. Additionally, avoid doing an out-of-bounds Rust read (#559) on 1 and 2 byte atomics by using inline ASM.
The only changes to the resulting optimised assembly on the latest Rust nightly (rustc 1.87.0-nightly (665025243 2025-03-11)
) are a few minor changes to instruction scheduling in the 1 and 2 byte atomic RMW functions.
cc @RalfJung - I've tried to summarise the approach of using inline ASM in the SAFETY
comments, but would definitely appreciate someone checking they make sense.