[Mlir-commits] [llvm] [mlir] Add usub_cond and usub_sat operations to atomicrmw (PR #105568)

Jay Foad llvmlistbot at llvm.org
Thu Aug 22 03:17:21 PDT 2024


================
@@ -95,6 +95,17 @@ Value *llvm::buildAtomicRMWValue(AtomicRMWInst::BinOp Op,
     Value *Or = Builder.CreateOr(CmpEq0, CmpOldGtVal);
     return Builder.CreateSelect(Or, Val, Dec, "new");
   }
+  case AtomicRMWInst::USubCond: {
+    Value *Cmp = Builder.CreateICmpUGE(Loaded, Val);
+    Value *Sub = Builder.CreateSub(Loaded, Val);
+    return Builder.CreateSelect(Cmp, Sub, Val, "new");
----------------
jayfoad wrote:

Shouldn't this be:
```suggestion
    return Builder.CreateSelect(Cmp, Sub, Loaded, "new");
```
?

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


More information about the Mlir-commits mailing list