[clang] [llvm] [RISCV] Add riscv_atomic.h and Zawrs/Zalrsc builtins (PR #94578)

Pengcheng Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 20:10:46 PDT 2024


wangpc-pp wrote:

> lr/sc builtins are extremely fragile: there's no reasonable way for the compiler to guarantee that the sc is placed in such a way that it will eventually succeed.

I think the user should have enough knowledges about lr/sc to make the logic reasonable. If we don't provide these intrinsics, the user who wants to implement custom locks will use inline assemly instead.

>  (The equivalent intrinsics do exist on ARM, but ARM has significantly stronger guarantees here. Even then, it's not completely reliable.)

I don't know much about there intrinsics on ARM, what are the `stronger guarantees`?

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


More information about the cfe-commits mailing list