[mlir] Add RSqrt tp ComplexOps.td.

Differential Revision: https://reviews.llvm.org/D126202
This commit is contained in:
Alexander Belyaev 2022-05-23 16:10:20 +02:00
parent 2ac5ebedea
commit a3a85fe59f
2 changed files with 32 additions and 0 deletions

View File

@ -387,6 +387,25 @@ def ReOp : ComplexUnaryOp<"re",
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<f32>
```
}];
let results = (outs Complex<AnyFloat>:$result);
}
//===----------------------------------------------------------------------===//
// SignOp
//===----------------------------------------------------------------------===//

View File

@ -61,5 +61,18 @@ func.func @ops(%f: f32) {
// CHECK: complex.sub %[[C]], %[[C]] : complex<f32>
%diff = complex.sub %complex, %complex : complex<f32>
// CHECK: complex.tanh %[[C]] : complex<f32>
%tanh = complex.tanh %complex : complex<f32>
// CHECK: complex.pow %[[C]], %[[C]] : complex<f32>
%pow = complex.pow %complex, %complex : complex<f32>
// CHECK: complex.sqrt %[[C]] : complex<f32>
%sqrt = complex.sqrt %complex : complex<f32>
// CHECK: complex.rsqrt %[[C]] : complex<f32>
%rsqrt = complex.rsqrt %complex : complex<f32>
return
}