[clang] [llvm] [RISCV] Add riscv_atomic.h and Zawrs/Zalrsc builtins (PR #94578)
Jessica Clarke via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 20:15:18 PDT 2024
jrtc27 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.
It's not about knowledge, it's that they are basically impossible for the compiler to actually guarantee they'll work at all.
> If we don't provide these intrinsics, the user who wants to implement custom locks will use inline assemly instead.
Good, because other than using C11-style atomics (or Itanium-style __sync builtins), that's the right thing to do.
https://github.com/llvm/llvm-project/pull/94578
More information about the cfe-commits
mailing list