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

Corentin Ferry llvmlistbot at llvm.org
Wed May 8 00:01:17 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))
----------------
cferry-AMD wrote:

Sure -- @srcarroll, you're right, F16 and F64 are indeed supported, let me add tests for them.

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


More information about the Mlir-commits mailing list