[llvm] [AtomicExpand] Implement SUB → ADD(-x) and FSUB → FADD(-x) (PR #221425)

Akshay Deodhar via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 18:04:17 PDT 2026


================
@@ -7877,9 +7886,12 @@ AtomicOrdering NVPTXTargetLowering::atomicOperationOrderAfterFenceSplit(
           STI.getMinCmpXchgSizeInBits())
     return AtomicOrdering::Acquire;
   else if (auto *RI = dyn_cast<AtomicRMWInst>(I);
-           RI && RI->getOrdering() == AtomicOrdering::SequentiallyConsistent &&
-           shouldExpandAtomicRMWInIR(RI) == AtomicExpansionKind::None)
-    return AtomicOrdering::Acquire;
+           RI && RI->getOrdering() == AtomicOrdering::SequentiallyConsistent) {
+    AtomicExpansionKind ExpansionKind = shouldExpandAtomicRMWInIR(RI);
+    if (ExpansionKind == AtomicExpansionKind::None ||
----------------
akshayrdeodhar wrote:

At some point, if we add elementwise support, that'll also use AtomicExpansionKind::Expand, and this might become invalid, and we'll need a more specific condition. Do we want to introduce some helper function that says "inPlaceExpansion" or something, and use that check here?

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


More information about the llvm-commits mailing list