Skip to content

Commit de75517

Browse files
committed
IRBuilder: Add FMFSource parameter to CreateMaxNum/CreateMinNum
In llvm#112852, we claimed that llvm.minnum and llvm.maxnum should treat +0.0>-0.0, while libc doesn't require fmin(3)/fmax(3) for it. Let's add FMFSource parameter to CreateMaxNum and CreateMinNum, so that it can be used by CodeGenFunction::EmitBuiltinExpr of Clang.
1 parent 88ff607 commit de75517

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,23 +1005,25 @@ class IRBuilderBase {
10051005
const Twine &Name = "");
10061006

10071007
/// Create call to the minnum intrinsic.
1008-
Value *CreateMinNum(Value *LHS, Value *RHS, const Twine &Name = "") {
1008+
Value *CreateMinNum(Value *LHS, Value *RHS, const Twine &Name = "",
1009+
FMFSource FMFSource = {}) {
10091010
if (IsFPConstrained) {
10101011
return CreateConstrainedFPUnroundedBinOp(
1011-
Intrinsic::experimental_constrained_minnum, LHS, RHS, nullptr, Name);
1012+
Intrinsic::experimental_constrained_minnum, LHS, RHS, FMFSource, Name);
10121013
}
10131014

1014-
return CreateBinaryIntrinsic(Intrinsic::minnum, LHS, RHS, nullptr, Name);
1015+
return CreateBinaryIntrinsic(Intrinsic::minnum, LHS, RHS, FMFSource, Name);
10151016
}
10161017

10171018
/// Create call to the maxnum intrinsic.
1018-
Value *CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name = "") {
1019+
Value *CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name = "",
1020+
FMFSource FMFSource = {}) {
10191021
if (IsFPConstrained) {
10201022
return CreateConstrainedFPUnroundedBinOp(
1021-
Intrinsic::experimental_constrained_maxnum, LHS, RHS, nullptr, Name);
1023+
Intrinsic::experimental_constrained_maxnum, LHS, RHS, FMFSource, Name);
10221024
}
10231025

1024-
return CreateBinaryIntrinsic(Intrinsic::maxnum, LHS, RHS, nullptr, Name);
1026+
return CreateBinaryIntrinsic(Intrinsic::maxnum, LHS, RHS, FMFSource, Name);
10251027
}
10261028

10271029
/// Create call to the minimum intrinsic.

0 commit comments

Comments
 (0)