[Mlir-commits] [mlir] [mlir][math] Add vector support for math-to-apfloat (PR #172715)

Jakub Kuderski llvmlistbot at llvm.org
Thu Jan 15 17:58:08 PST 2026


================
@@ -131,16 +130,16 @@ struct FmaOpToAPFloatConversion final : OpRewritePattern<math::FmaOp> {
 
   LogicalResult matchAndRewrite(math::FmaOp op,
                                 PatternRewriter &rewriter) const override {
+    if (failed(checkPreconditions(rewriter, op)))
+      return failure();
     // Cast operands to 64-bit integers.
-    auto floatTy = cast<FloatType>(op.getResult().getType());
-    if (!floatTy)
-      return rewriter.notifyMatchFailure(op,
-                                         "only scalar FloatTypes supported");
-    if (floatTy.getIntOrFloatBitWidth() > 64) {
-      return rewriter.notifyMatchFailure(op,
-                                         "bitwidth > 64 bits is not supported");
+    mlir::Type resType = op.getResult().getType();
+    auto floatTy = dyn_cast<FloatType>(resType);
+    if (!floatTy) {
+      auto vecTy1 = dyn_cast<VectorType>(resType);
+      assert(vecTy1 && "expected VectorType");
----------------
kuhar wrote:

Use `cast` -- it already asserts

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


More information about the Mlir-commits mailing list