let summary = "computes exponential of a complex number";
let description = [{
The `exp` op takes a single complex number and computes the exponential of
- it, i.e. `exp(x)` or `e^(x)`, where `x` is the input tensor.
+ it, i.e. `exp(x)` or `e^(x)`, where `x` is the input value.
`e` denotes Euler's number and is approximately equal to 2.718281.
Example:
}
//===----------------------------------------------------------------------===//
+// LogOp
+//===----------------------------------------------------------------------===//
+
+def LogOp : ComplexUnaryOp<"log", [SameOperandsAndResultType]> {
+ let summary = "computes natural logarithm of a complex number";
+ let description = [{
+ The `log` op takes a single complex number and computes the natural
+ logarithm of it, i.e. `log(x)` or `log_e(x)`, where `x` is the input value.
+ `e` denotes Euler's number and is approximately equal to 2.718281.
+
+ Example:
+
+ ```mlir
+ %a = complex.log %b : complex<f32>
+ ```
+ }];
+
+ let results = (outs Complex<AnyFloat>:$result);
+}
+
+//===----------------------------------------------------------------------===//
// MulOp
//===----------------------------------------------------------------------===//
// CHECK: complex.eq %[[C]], %[[C]] : complex<f32>
%eq = complex.eq %complex, %complex : complex<f32>
- // CHECK: complex.neq %[[C]], %[[C]] : complex<f32>
- %neq = complex.neq %complex, %complex : complex<f32>
+ // CHECK: complex.exp %[[C]] : complex<f32>
+ %exp = complex.exp %complex : complex<f32>
+
+ // CHECK: complex.log %[[C]] : complex<f32>
+ %log = complex.log %complex : complex<f32>
// CHECK: complex.mul %[[C]], %[[C]] : complex<f32>
%prod = complex.mul %complex, %complex : complex<f32>
+ // CHECK: complex.neg %[[C]] : complex<f32>
+ %neg = complex.neg %complex : complex<f32>
+
+ // CHECK: complex.neq %[[C]], %[[C]] : complex<f32>
+ %neq = complex.neq %complex, %complex : complex<f32>
+
+ // CHECK: complex.sign %[[C]] : complex<f32>
+ %sign = complex.sign %complex : complex<f32>
+
// CHECK: complex.sub %[[C]], %[[C]] : complex<f32>
%diff = complex.sub %complex, %complex : complex<f32>
return