[clang] [llvm] [RISCV] Add experimental support of Zaamo and Zalrsc (PR #77424)

Alex Bradbury via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 06:33:35 PST 2024


asb wrote:

Thanks James, that matches what I'd understood. Just one comment on this though:

> If Zaamo is present, but neither Zalrsc nor Zacas are present, I think there's no way to implement a cmpxchg operation. This means lock-free atomics cannot be supported, so it should `setMaxAtomicSizeInBitsSupported(0)`.

Especially given that Zaamo is [documented](https://github.com/riscv/riscv-zaamo-zalrsc/blob/main/zaamo-zalrsc.adoc) as targeting embedded systems, emitting __sync calls for the non-AMO atomics (as would be done with +forced-atomics, presumably they'd be implemented by turning off interrupts) seems defensible doesn't it? Or is there a correctness issue with that I'm missing?

https://github.com/llvm/llvm-project/pull/77424


More information about the cfe-commits mailing list