Open Amanieu opened 2 years ago
Visited during the compiler team's P-high review. Based on the most recent discussion points, we believe this can relabeled P-medium as +forced-atomic
support has landed in LLVM for all relevant Tier 1 or Tier 2 targets and interoperability of passing pointers to atomic values between C and Rust in this context does not seem to be commonly used.
Some embedded targets (
thumbv6m
,riscv32i
) don't support general atomic operations (compare_exchange
,fetch_add
, etc) but do support atomicload
andstore
operations. We previously supported this onthumbv6m
(but notriscv32i
, see #98333) bycfg
ing out most of the methods onAtomic*
except forload
andstore
. However recent changes to LLVM (#99595) cause it to emit calls to libatomic forload
andstore
(it already does this for the other atomic operations).It seems that LLVM's support for lowering atomic loads and stores on ARM was an accident that is being reverted. However the reason for this revert is that the directly lowered load/store cannot interoperate correctly with the other atomic operations which are lowered to libcalls. This concern doesn't apply to Rust since we don't expose emulated (read: not lock free) atomics, so there is no interoperability concern (except maybe for FFI with C that uses atomics?).
I see 2 ways we can move forward: