[Mlir-commits] [mlir] [mlir][math] Add vector support for math-to-apfloat (PR #172715)
Maksim Levental
llvmlistbot at llvm.org
Thu Jan 15 18:35:37 PST 2026
================
@@ -107,16 +98,24 @@ struct IsOpToAPFloatConversion final : OpRewritePattern<OpTy> {
return fn;
Location loc = op.getLoc();
rewriter.setInsertionPoint(op);
- auto intWType = rewriter.getIntegerType(floatTy.getWidth());
- Value operandBits = arith::ExtUIOp::create(
- rewriter, loc, i64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, operand));
-
- // Call APFloat function.
- Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
- SmallVector<Value> params = {semValue, operandBits};
- rewriter.replaceOpWithNewOp<func::CallOp>(op, TypeRange(i1),
- SymbolRefAttr::get(*fn), params);
+ // Scalarize and convert to APFloat runtime calls.
+ Value repl = forEachScalarValue(
+ rewriter, loc, op.getOperand(), /*operand2=*/Value(), op.getType(),
+ [&](Value operand, Value, Type resultType) {
+ auto floatTy = dyn_cast<FloatType>(operand.getType());
----------------
makslevental wrote:
done
https://github.com/llvm/llvm-project/pull/172715
More information about the Mlir-commits
mailing list