================
@@ -1272,7 +1272,18 @@ mlir::Value genMathOp(fir::FirOpBuilder &builder,
mlir::Location loc,
LLVM_DEBUG(llvm::dbgs() << "Generating '" << mathLibFuncName
<< "' operation with type ";
mathLibFuncType.dump(); llvm::dbgs() << "\n");
- result = T::create(builder, loc, args);
+ if constexpr (std::is_same_v<T, mlir::complex::PowOp>) {
+ auto resultType = mathLibFuncType.getResult(0);
+ result = T::create(builder, loc, resultType, args);
+ } else if constexpr (std::is_same_v<T, mlir::complex::PowiOp>) {
+ auto resultType = mathLibFuncType.getResult(0);
+ auto fmfAttr = mlir::arith::FastMathFlagsAttr::get(
+ builder.getContext(), builder.getFastMathFlags());
+ result = builder.create<mlir::complex::PowiOp>(loc, resultType, args[0],
+ args[1], fmfAttr);
+ } else {
----------------
vzakhari wrote:
Do we really need all this code? I believe just a simple `T::create(buider,
loc, args)` should work, because of the type constraints in the operations
definitions.
https://github.com/llvm/llvm-project/pull/158722
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits