[Mlir-commits] [mlir] [math] lower rsqrt to sqrt + fdiv (PR #91344)

Prashant Kumar llvmlistbot at llvm.org
Tue May 7 08:48:21 PDT 2024


================
@@ -615,6 +615,24 @@ static LogicalResult convertRoundEvenOp(math::RoundEvenOp op,
   return success();
 }
 
+// Convert `math.rsqrt` into `arith.divf` + `math.sqrt`
+static LogicalResult convertRsqrtOp(math::RsqrtOp op,
+                                    PatternRewriter &rewriter) {
+
+  auto operand = op.getOperand();
+  auto operandTy = operand.getType();
+  auto eTy = getElementTypeOrSelf(operandTy);
+  if (!isa<FloatType>(eTy))
----------------
pashu123 wrote:

I see, yes. I only saw the tests. Could you edit the tests and add the F16 or F64 ones, too?

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


More information about the Mlir-commits mailing list