Skip to content

Commit c66777e

Browse files
committed
AMDGPU: Generalize atomicrmw handling in custom expansion
Use the utility function instead of assuming fadd. No change as-is, but will soon be used for other expansions.
1 parent 1919db9 commit c66777e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "llvm/Support/CommandLine.h"
4343
#include "llvm/Support/KnownBits.h"
4444
#include "llvm/Support/ModRef.h"
45+
#include "llvm/Transforms/Utils/LowerAtomic.h"
4546
#include <optional>
4647

4748
using namespace llvm;
@@ -16645,7 +16646,9 @@ void SITargetLowering::emitExpandAtomicRMW(AtomicRMWInst *AI) const {
1664516646
Addr, PointerType::get(Ctx, AMDGPUAS::PRIVATE_ADDRESS));
1664616647
Value *LoadedPrivate =
1664716648
Builder.CreateLoad(ValTy, CastToPrivate, "loaded.private");
16648-
Value *NewVal = Builder.CreateFAdd(LoadedPrivate, Val, "val.new");
16649+
16650+
Value *NewVal = buildAtomicRMWValue(Op, Builder, LoadedPrivate, Val);
16651+
1664916652
Builder.CreateStore(NewVal, CastToPrivate);
1665016653
Builder.CreateBr(PhiBB);
1665116654

0 commit comments

Comments
 (0)