This is an archive of the discontinued LLVM Phabricator instance.

[mlir][complex] complex.arg op to calculate the angle of complex number
ClosedPublic

Authored by Lewuathe on Jun 24 2022, 7:11 AM.

Details

Summary

Add complex.arg op which calculates the angle of complex number. The op name is inspired by the function carg in libm.

See: https://sourceware.org/newlib/libm.html#carg

Diff Detail

Event Timeline

Lewuathe created this revision.Jun 24 2022, 7:11 AM
Lewuathe requested review of this revision.Jun 24 2022, 7:11 AM
Lewuathe edited the summary of this revision. (Show Details)Jun 24 2022, 7:11 AM
Lewuathe updated this revision to Diff 439743.Jun 24 2022, 7:13 AM

Add new line.

pifon2a added inline comments.Jun 24 2022, 7:18 AM
mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
1061

nit: sort the patterns

mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir
703

bikeshedding: let's call it complex.angle. I find complex.arg a bit confusing, even though carg exists in libm.

https://www.geeksforgeeks.org/numpy-angle-in-python/#:~:text=angle()%20function%20is%20used,1(x%2Fy).

Lewuathe updated this revision to Diff 440015.Jun 25 2022, 5:42 PM

Rename complex.arg to complex.angle

This revision was not accepted when it landed; it landed in state Needs Review.Jun 27 2022, 7:46 AM
This revision was automatically updated to reflect the committed changes.