[Mlir-commits] [mlir] Introduce `arith.scaling_extf` and `arith.scaling_truncf` (PR #141965)

Prashant Kumar llvmlistbot at llvm.org
Fri May 30 19:38:44 PDT 2025


================
@@ -23,6 +26,16 @@ namespace arith {
 
 using namespace mlir;
 
+static Value createFloatConst(Location loc, Type type, float value,
+                              PatternRewriter &rewriter) {
+  auto attr = rewriter.getFloatAttr(getElementTypeOrSelf(type), value);
+  if (auto shapedTy = dyn_cast<ShapedType>(type)) {
+    return rewriter.create<arith::ConstantOp>(
----------------
pashu123 wrote:

We can update the `attr` here: `attr = DenseElementsAttr::get(shapedTy, attr)`. It will return the right thing. (Both are fine to me).

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


More information about the Mlir-commits mailing list