[Mlir-commits] [mlir] [mlir][math] Add FP software implementation lowering pass: math-to-apfloat (PR #171221)

Matthias Springer llvmlistbot at llvm.org
Thu Dec 11 01:13:30 PST 2025


================
@@ -32,11 +32,15 @@ namespace {
 template <typename SourceOp, typename TargetOp>
 using ConvertFastMath = arith::AttrConvertFastMathToLLVM<SourceOp, TargetOp>;
 
-template <typename SourceOp, typename TargetOp>
+template <typename SourceOp, typename TargetOp,
+          bool FailOnUnsupportedFP = false>
 using ConvertFMFMathToLLVMPattern =
-    VectorConvertToLLVMPattern<SourceOp, TargetOp, ConvertFastMath>;
+    VectorConvertToLLVMPattern<SourceOp, TargetOp, ConvertFastMath,
+                               FailOnUnsupportedFP>;
 
-using AbsFOpLowering = ConvertFMFMathToLLVMPattern<math::AbsFOp, LLVM::FAbsOp>;
+using AbsFOpLowering =
+    ConvertFMFMathToLLVMPattern<math::AbsFOp, LLVM::FAbsOp,
+                                /*FailOnUnsupportedFP=*/true>;
 using CeilOpLowering = ConvertFMFMathToLLVMPattern<math::CeilOp, LLVM::FCeilOp>;
----------------
matthias-springer wrote:

Since you're adding `FailOnUnsupportedFP`: Most ops in here (if not all) should have `/*FailOnUnsupportedFP=*/true`. It would be good to also have a test case for this (for a few ops, not necessarily all...), similar to `func.func @unsupported_fp_type` in `arith-to-llvm.mlir`.

https://github.com/llvm/llvm-project/pull/171221


More information about the Mlir-commits mailing list