[clang] [llvm] [NVPTX] Auto-Upgrade llvm.nvvm.atomic.load.{inc,dec}.32 (PR #134111)
Akshay Deodhar via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 3 17:06:40 PDT 2025
================
@@ -2314,6 +2317,12 @@ static Value *upgradeNVVMIntrinsicCall(StringRef Name, CallBase *CI,
Value *Val = CI->getArgOperand(1);
Rep = Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, Ptr, Val, MaybeAlign(),
AtomicOrdering::SequentiallyConsistent);
+ } else if (Name.consume_front("atomic.load.") && Name.consume_back(".32")) {
+ Value *Ptr = CI->getArgOperand(0);
+ Value *Val = CI->getArgOperand(1);
+ auto Op = Name == "inc" ? AtomicRMWInst::UIncWrap : AtomicRMWInst::UDecWrap;
+ Rep = Builder.CreateAtomicRMW(Op, Ptr, Val, MaybeAlign(),
+ AtomicOrdering::SequentiallyConsistent);
----------------
akshayrdeodhar wrote:
But we are lowering cmpxchg with seq_cst correctly by using fence.sc and atom.acq_rel.cas. @gonzalobg - will this also break frontends?
https://github.com/llvm/llvm-project/pull/134111
More information about the llvm-commits
mailing list