[llvm-branch-commits] [flang] [flang] Implement `tanpi` (PR #149527)
Connector Switch via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jul 22 10:21:53 PDT 2025
================
@@ -8157,6 +8158,21 @@ mlir::Value IntrinsicLibrary::genTand(mlir::Type resultType,
return getRuntimeCallGenerator("tan", ftype)(builder, loc, {arg});
}
+// TANPI
+mlir::Value IntrinsicLibrary::genTanpi(mlir::Type resultType,
+ llvm::ArrayRef<mlir::Value> args) {
+ assert(args.size() == 1);
+ mlir::MLIRContext *context = builder.getContext();
+ mlir::FunctionType ftype =
+ mlir::FunctionType::get(context, {resultType}, {args[0].getType()});
+ llvm::APFloat pi = llvm::APFloat(llvm::numbers::pi);
+ mlir::Value dfactor =
+ builder.createRealConstant(loc, mlir::Float64Type::get(context), pi);
+ mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor);
----------------
c8ef wrote:
Based on our discussion in #149525, I believe this patch is ready to go, too?
My current plan is to first implement the missing trigonometric pi functions, and then address the constant pi problem. I'll open an issue to track this.
https://github.com/llvm/llvm-project/pull/149527
More information about the llvm-branch-commits
mailing list