[PATCH] D134783: [PowerPC] Fix a number of inefficiencies and issues with atomic code gen

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 19:27:22 PDT 2022


nemanjai created this revision.
nemanjai added a reviewer: PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: All.
nemanjai requested review of this revision.
Herald added a project: LLVM.

There are a few issues with the code we generate for atomic operations and the way we generate it:

- Hard coded `CR0` for compares
- Order of operands for compares not conducive to emitting compare-immediate or for CSE of compares
- Missing `MachineMemOperand` for `st[bhwd]cx` intrinsics
- A missing intrinsic property for the same
- Unnecessary blocks with store conditional instructions to clear reservation (which ends up hindering performance)
- Move from CR instructions just to compare the result of a store conditional with zero (even though it is a record-form)

This patch aims to resolve all of those issues.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134783

Files:
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/lib/Target/PowerPC/PPCInstr64Bit.td
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll
  llvm/test/CodeGen/PowerPC/all-atomics.ll
  llvm/test/CodeGen/PowerPC/atomic-1.ll
  llvm/test/CodeGen/PowerPC/atomic-2.ll
  llvm/test/CodeGen/PowerPC/atomic-float.ll
  llvm/test/CodeGen/PowerPC/atomic-minmax.ll
  llvm/test/CodeGen/PowerPC/atomics-regression.ll
  llvm/test/CodeGen/PowerPC/atomics.ll
  llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-check-ldarx-opt.ll
  llvm/test/CodeGen/PowerPC/loop-comment.ll
  llvm/test/CodeGen/PowerPC/pr30451.ll
  llvm/test/CodeGen/PowerPC/sign-ext-atomics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134783.463398.patch
Type: text/x-patch
Size: 209156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220928/20c927f1/attachment-0001.bin>


More information about the llvm-commits mailing list