[PATCH] D146933: [RISCV] Slightly weaken expanded seq_cst atomic op to match reference mapping in in the spec

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 23:27:00 PDT 2023


asb created this revision.
asb added reviewers: reames, craig.topper.
Herald added subscribers: jobnoorman, luke, wingo, pmatos, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
asb requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Table A.6 in the RISC-V ISA Manual indicates that sequentially consistent atomic ops that have a matching instruction should be mapped to `amo<op>.{w|d}.aqrl`. But sequentially consistent operations that are mapped to lr/sc should produce `loop: lr.{w|d}.aqrl; <op>; sc.{w|d}.rl; bnez loop`. Previously, LLVM produced an `sc.{w|d}.aqrl` which was stronger than necessary. This patch adjusts the relevant logic so that a `sc.{w|d}.rl` is produced.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146933

Files:
  llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
  llvm/test/CodeGen/RISCV/atomic-cmpxchg-branch-on-result.ll
  llvm/test/CodeGen/RISCV/atomic-cmpxchg-flag.ll
  llvm/test/CodeGen/RISCV/atomic-cmpxchg.ll
  llvm/test/CodeGen/RISCV/atomic-rmw.ll
  llvm/test/CodeGen/RISCV/atomicrmw-uinc-udec-wrap.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146933.508489.patch
Type: text/x-patch
Size: 27024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/802e39bd/attachment.bin>


More information about the llvm-commits mailing list