[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
Mon Mar 2 06:16:54 PST 2020


ftynse added inline comments.


================
Comment at: mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir:48
+func @rsqrt_vector(%arg0 : vector<4xf32>) {
+  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1.000000e+00 : f32) : !llvm<"<4 x float>">
+  // CHECK: %[[SQRT:.*]] = "llvm.intr.sqrt"(%arg0) : (!llvm<"<4 x float>">) -> !llvm<"<4 x float>">
----------------
akuegel wrote:
> Does this look ok? I am not sure whether the operand type of constant is allowed to be different from the result type. But seems there is no assert that is triggered, so maybe it supports broadcasts?
I think you need something like `llvm.mlir.constant(dense<1.0> : vector<4xf32>) : !llvm<"<4 x float>">`. We have `SplatElementsAttr` to broadcast constants in a vector, which is printed like that.


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