[PATCH] D130480: [ARM] Add target feature to force 32-bit atomics

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 06:23:55 PDT 2022


nikic created this revision.
nikic added reviewers: efriedma, john.brawn, dmgreen.
Herald added subscribers: JDevlieghere, hiraditya, kristof.beyls.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This adds a `+atomic-32` target feature, which instructs LLVM to assume that lock-free 32-bit atomics are available for this target, even if they usually wouldn't be.

If only atomic loads/stores are used, then this won't emit libcalls. If atomic CAS is used, then the user is responsible for providing any necessary `__sync` implementations (e.g. by masking interrupts for single-core privileged use cases).

See https://reviews.llvm.org/D120026#3674333 for context on this change. The tl;dr is that the thumbv6m target in Rust has historically made atomic load/store only available, which is incompatible with the change from D120026 <https://reviews.llvm.org/D120026>, which switched these to use libatomic.

This is an ARM target feature for now, but probably the ability to override setMaxAtomicSizeInBitsSupported() would also be useful in general...


https://reviews.llvm.org/D130480

Files:
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/test/CodeGen/ARM/thumbv6m-atomic32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130480.447301.patch
Type: text/x-patch
Size: 8025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/2874e35a/attachment.bin>


More information about the llvm-commits mailing list