diff --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td --- a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td +++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td @@ -387,6 +387,25 @@ let hasFolder = 1; } +//===----------------------------------------------------------------------===// +// RsqrtOp +//===----------------------------------------------------------------------===// + +def RsqrtOp : ComplexUnaryOp<"rsqrt", [SameOperandsAndResultType]> { + let summary = "complex reciprocal of square root"; + let description = [{ + The `rsqrt` operation computes reciprocal of square root. + + Example: + + ```mlir + %a = complex.rsqrt %b : complex + ``` + }]; + + let results = (outs Complex:$result); +} + //===----------------------------------------------------------------------===// // SignOp //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/Complex/ops.mlir b/mlir/test/Dialect/Complex/ops.mlir --- a/mlir/test/Dialect/Complex/ops.mlir +++ b/mlir/test/Dialect/Complex/ops.mlir @@ -61,5 +61,18 @@ // CHECK: complex.sub %[[C]], %[[C]] : complex %diff = complex.sub %complex, %complex : complex + + // CHECK: complex.tanh %[[C]] : complex + %tanh = complex.tanh %complex : complex + + // CHECK: complex.pow %[[C]], %[[C]] : complex + %pow = complex.pow %complex, %complex : complex + + // CHECK: complex.sqrt %[[C]] : complex + %sqrt = complex.sqrt %complex : complex + + // CHECK: complex.rsqrt %[[C]] : complex + %rsqrt = complex.rsqrt %complex : complex + return }