[PATCH] D137980: [ARM] Pretend atomics are always lock-free for small widths.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 11:02:23 PST 2022


efriedma added a comment.

So gcc has two different behaviors on ARM:

- On linux, prefers `__sync` calls, and generates inline code for load/store.
- On baremetal, gcc chooses what sort of atomic call to generate based on how the source code is written: if the user writes `__sync`, you get `__sync`, and if the user writes `__atomic`, the user gets `__atomic`.  But it generates inline code for load/store, so it's assuming the __atomic implementation is lock-free.

We'd have to hack clang IR generation to generate different IR for the two constructs.  I'm not sure what the underlying logic is, or if it's worth trying to emulate.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137980/new/

https://reviews.llvm.org/D137980



More information about the llvm-commits mailing list