forked from OSchip/llvm-project
[mlir] Add `complex.atan2` operation.
Differential Revision: https://reviews.llvm.org/D126357
This commit is contained in:
parent
8a6698b523
commit
b3c5c22c13
|
@ -75,6 +75,24 @@ def AddOp : ComplexArithmeticOp<"add"> {
|
|||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Atan2
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def Atan2Op : ComplexArithmeticOp<"atan2"> {
|
||||
let summary = "complex 2-argument arctangent";
|
||||
let description = [{
|
||||
For complex numbers it is expressed using complex logarithm
|
||||
atan2(y, x) = -i * log((x + i * y) / sqrt(x**2 + y**2))
|
||||
|
||||
Example:
|
||||
|
||||
```mlir
|
||||
%a = complex.atan2 %b, %c : complex<f32>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConstantOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -77,5 +77,8 @@ func.func @ops(%f: f32) {
|
|||
// CHECK: complex.rsqrt %[[C]] : complex<f32>
|
||||
%rsqrt = complex.rsqrt %complex : complex<f32>
|
||||
|
||||
// CHECK: complex.atan2 %[[C]], %[[C]] : complex<f32>
|
||||
%atan2 = complex.atan2 %complex, %complex : complex<f32>
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue