[clang] [Clang] Add support for fp when using min_fetch/max_fetch atomics (PR #160330)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 6 09:25:24 PDT 2025
================
@@ -507,6 +507,17 @@ static llvm::Value *EmitPostAtomicMinMax(CGBuilderTy &Builder,
bool IsSigned,
llvm::Value *OldVal,
llvm::Value *RHS) {
+ const bool IsFP = OldVal->getType()->isFloatingPointTy();
+
+ if (IsFP) {
+ llvm::Intrinsic::ID IID = (Op == AtomicExpr::AO__atomic_max_fetch ||
+ Op == AtomicExpr::AO__scoped_atomic_max_fetch)
+ ? llvm::Intrinsic::maxnum
+ : llvm::Intrinsic::minnum;
+
+ return Builder.CreateBinaryIntrinsic(IID, OldVal, RHS, nullptr, "newval");
----------------
efriedma-quic wrote:
```suggestion
return Builder.CreateBinaryIntrinsic(IID, OldVal, RHS, FMFSource(), "newval");
```
nullptr technically works, but it unclear what the type of the value is supposed to be.
https://github.com/llvm/llvm-project/pull/160330
More information about the cfe-commits
mailing list