[mlir] Add Expm1 tp ComplexOps.td.

Differential Revision: https://reviews.llvm.org/D126206
This commit is contained in:
Alexander Belyaev 2022-05-23 16:29:02 +02:00
parent 9293539064
commit f3eeefe449
2 changed files with 28 additions and 0 deletions
mlir
include/mlir/Dialect/Complex/IR
test/Dialect/Complex

View File

@ -222,6 +222,31 @@ def ExpOp : ComplexUnaryOp<"exp", [SameOperandsAndResultType]> {
let results = (outs Complex<AnyFloat>:$result);
}
//===----------------------------------------------------------------------===//
// Expm1Op
//===----------------------------------------------------------------------===//
def Expm1Op : ComplexUnaryOp<"expm1", [SameOperandsAndResultType]> {
let summary = "computes exponential of a complex number minus 1";
let description = [{
Syntax:
```
operation ::= ssa-id `=` `complex.expm1` ssa-use `:` type
```
complex.expm1(x) := complex.exp(x) - 1
Example:
```mlir
%a = complex.expm1 %b : complex<f32>
```
}];
let results = (outs Complex<AnyFloat>:$result);
}
//===----------------------------------------------------------------------===//
// ImOp
//===----------------------------------------------------------------------===//

View File

@ -38,6 +38,9 @@ func.func @ops(%f: f32) {
// CHECK: complex.exp %[[C]] : complex<f32>
%exp = complex.exp %complex : complex<f32>
// CHECK: complex.expm1 %[[C]] : complex<f32>
%expm1 = complex.expm1 %complex : complex<f32>
// CHECK: complex.log %[[C]] : complex<f32>
%log = complex.log %complex : complex<f32>