summaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
diff options
context:
space:
mode:
authorMatthias Springer <me@m-sp.org>2025-11-04 23:45:35 +0000
committerMatthias Springer <me@m-sp.org>2025-11-05 12:29:25 +0000
commitf3d28c4ffd949c6b2807d165b20184ead6445da9 (patch)
treed6c65ac461b9cf36c8d8be0c9012a63904ba3898 /mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
parent6c640b86e6e03298385231cb7e77d2f3524bc643 (diff)
Prototype: APFloat CPU runnerusers/matthias-springer/apfloat_runner
Diffstat (limited to 'mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp')
-rw-r--r--mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 69a317ecd101..260c028ffd9c 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1654,6 +1654,20 @@ private:
return failure();
}
}
+ } else if (auto floatTy = dyn_cast<FloatType>(printType)) {
+ // Print other floating-point types using the APFloat runtime library.
+ int32_t sem =
+ llvm::APFloatBase::SemanticsToEnum(floatTy.getFloatSemantics());
+ Value semValue = rewriter.create<LLVM::ConstantOp>(
+ loc, rewriter.getI32Type(),
+ rewriter.getIntegerAttr(rewriter.getI32Type(), sem));
+ Value floatBits =
+ rewriter.create<LLVM::ZExtOp>(loc, rewriter.getI64Type(), value);
+ printer =
+ LLVM::lookupOrCreateApFloatPrintFn(rewriter, parent, symbolTables);
+ emitCall(rewriter, loc, printer.value(),
+ ValueRange({semValue, floatBits}));
+ return success();
} else {
return failure();
}