Skip to content

Commit

Permalink
[mlir] Add Expm1 tp ComplexOps.td.
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D126206
  • Loading branch information
pifon2a committed May 23, 2022
1 parent 9293539 commit f3eeefe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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
//===----------------------------------------------------------------------===//
Expand Down
3 changes: 3 additions & 0 deletions mlir/test/Dialect/Complex/ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit f3eeefe

Please sign in to comment.