[PATCH] D75352: Add rsqrt op to Standard dialect and lower it to LLVM dialect.

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 07:17:34 PST 2020


ftynse requested changes to this revision.
ftynse added a comment.
This revision now requires changes to proceed.

Mostly good, let's make sure it works for other types than f32.



================
Comment at: mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp:1686
+        loc, typeConverter.convertType(operandType),
+        rewriter.getF32FloatAttr(1.0));
+    auto sqrt = rewriter.create<LLVM::SqrtOp>(loc, transformed.operand());
----------------
This may not necessarily work if the operand type is not float. Maybe you could dispatch to different attributes based on type?


================
Comment at: mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir:23
+// CHECK-SAME: !llvm.float
+func @rsqrt(%arg0 : f32) {
+  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1.000000e+00 : f32) : !llvm.float
----------------
Could we also have a test for f64/double?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75352/new/

https://reviews.llvm.org/D75352





More information about the llvm-commits mailing list