[PATCH] D116161: [Clang] Add an overload for emitUnaryBuiltin.
Jun Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 22 06:58:30 PST 2021
junaire updated this revision to Diff 395864.
junaire added a comment.
Update the existing place that can use emitUnaryBuiltin.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116161/new/
https://reviews.llvm.org/D116161
Files:
clang/lib/CodeGen/CGBuiltin.cpp
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -541,6 +541,12 @@
return CGF.Builder.CreateCall(F, Src0);
}
+static Value *emitUnaryBuiltin(CodeGenFunction &CGF, const CallExpr *E,
+ unsigned IntrinsicID, llvm::StringRef Name) {
+ llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
+ return CGF.Builder.CreateUnaryIntrinsic(IntrinsicID, Src0, nullptr, Name);
+}
+
// Emit an intrinsic that has 2 operands of the same type as its result.
static Value *emitBinaryBuiltin(CodeGenFunction &CGF,
const CallExpr *E,
@@ -3185,11 +3191,11 @@
}
return llvm::Intrinsic::vector_reduce_fmax;
};
- Value *Op0 = EmitScalarExpr(E->getArg(0));
- Value *Result = Builder.CreateUnaryIntrinsic(
- GetIntrinsicID(E->getArg(0)->getType(), Op0->getType()), Op0, nullptr,
- "rdx.min");
- return RValue::get(Result);
+ return RValue::get(emitUnaryBuiltin(
+ *this, E,
+ GetIntrinsicID(E->getArg(0)->getType(),
+ EmitScalarExpr(E->getArg(0))->getType()),
+ "rdx.min"));
}
case Builtin::BI__builtin_reduce_min: {
@@ -3204,11 +3210,11 @@
}
return llvm::Intrinsic::vector_reduce_fmin;
};
- Value *Op0 = EmitScalarExpr(E->getArg(0));
- Value *Result = Builder.CreateUnaryIntrinsic(
- GetIntrinsicID(E->getArg(0)->getType(), Op0->getType()), Op0, nullptr,
- "rdx.min");
- return RValue::get(Result);
+ return RValue::get(emitUnaryBuiltin(
+ *this, E,
+ GetIntrinsicID(E->getArg(0)->getType(),
+ EmitScalarExpr(E->getArg(0))->getType()),
+ "rdx.min"));
}
case Builtin::BI__builtin_reduce_xor: {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116161.395864.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211222/68afeb5f/attachment.bin>
More information about the cfe-commits
mailing list