[PATCH] D159272: [LoongArch] Improve codegen for atomic ops

hev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 04:59:27 PDT 2023


hev created this revision.
hev added reviewers: SixWeining, xen0n.
Herald added a subscriber: hiraditya.
Herald added a project: All.
hev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This PR improves memory barriers generated by atomic operations.

Memory barrier semantics of LL/SC:
LL: <memory-barrier> + <load-exclusive>
SC: <store-conditional> + <memory-barrier>

Changes:

1. Remove unnecessary memory barriers before LL and between LL/SC.
2. Fix acquire semantics. (If the SC instruction is not executed, then acquire semantics cannot be guaranteed. So, acquire barrier need to be generated when memory ordering has acquire.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159272

Files:
  llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
  llvm/test/CodeGen/LoongArch/atomicrmw-uinc-udec-wrap.ll
  llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll
  llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw-fp.ll
  llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw-minmax.ll
  llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw.ll
  llvm/unittests/Target/LoongArch/InstSizes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159272.554987.patch
Type: text/x-patch
Size: 43670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/2da3c0d5/attachment-0001.bin>


More information about the llvm-commits mailing list