[PATCH] D149689: [X86] Lower used `(atomicrmw xor p, SignBit)` as `(atomicrmw add p, SignBit)`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 13:48:47 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: pengfei, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`(xor X, SignBit)` == `(add X, SignBit)`. For atomics whose result is
used, the `add` option is preferable because of the `xadd` instruction
which allows us to avoid either a CAS loop or a `btc; setcc; shl`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149689

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/atomic-bit-test.ll
  llvm/test/CodeGen/X86/atomic-xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149689.518851.patch
Type: text/x-patch
Size: 7870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/d09c2180/attachment.bin>


More information about the llvm-commits mailing list