[llvm] AMDGPU: Undo atomicrmw add/sub/xor 0 -> atomicrmw or canonicalization (PR #87533)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 6 12:29:26 PDT 2024


================
@@ -16027,6 +16027,19 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
       SSID == RMW->getContext().getOrInsertSyncScopeID("one-as");
 
   switch (RMW->getOperation()) {
+  case AtomicRMWInst::Sub:
+  case AtomicRMWInst::Or:
+  case AtomicRMWInst::Xor: {
+    // Atomic sub/or/xor do not work over PCI express, but atomic add
+    // does. InstCombine transforms these with 0 to or, so undo that.
----------------
arsenm wrote:

No, this is a codegen hook for the AtomicExpand pass. InstCombine does this transform and then we run the expand in codegen to undo it. Someone could also have written the code this way in the first place 

https://github.com/llvm/llvm-project/pull/87533


More information about the llvm-commits mailing list