This is an archive of the discontinued LLVM Phabricator instance.

[flang] Implement atand intrinsic
ClosedPublic

Authored by DavidTruby on Feb 27 2023, 8:43 AM.

Details

Summary

This implements the atand intrinsic by performing a multiplication
by 180/pi to the result of a call to atan inline.

This is a commonly provided extension that is used by OpenRadioss.

Diff Detail

Event Timeline

DavidTruby created this revision.Feb 27 2023, 8:43 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
DavidTruby requested review of this revision.Feb 27 2023, 8:43 AM
DavidTruby added inline comments.
flang/lib/Optimizer/Builder/IntrinsicCall.cpp
47

I don't know why my editor keeps inserting these spurious header files.... I'll remove it before uploading the next patch revision

tblah added inline comments.Feb 27 2023, 8:57 AM
flang/test/Lower/Intrinsics/atand.f90
17

nit: please could you test that fastmath<contract> is added to this floating point arithmetic on the fast build

DavidTruby edited the summary of this revision. (Show Details)Feb 27 2023, 9:01 AM
DavidTruby added a reviewer: vzakhari.
vzakhari added inline comments.Feb 27 2023, 9:34 AM
flang/lib/Optimizer/Builder/IntrinsicCall.cpp
43

Please try the shared-libs build before merging. Something like LLVM Support dependency might be need in the CMakeLists.txt

2326

Please add a TODO for complex types.

flang/test/Lower/Intrinsics/atand.f90
16

Could you use llvm::APFloat::divide to constant fold this right away (https://llvm.org/doxygen/classllvm_1_1APFloat.html#a107d394b970c9f03a486a15cdd08f0df)?

Fold constant divide at compile time before MLIR

flang/test/Lower/Intrinsics/atand.f90
17

it seems to be added to the mulf in either case. Is this correct or should I have done something to avoid that?

tblah added inline comments.Feb 28 2023, 7:15 AM
flang/test/Lower/Intrinsics/atand.f90
17

I'm not entirely sure what the intended semantics of the bbc option are.

I don't suspect your changes would lead to adding fastmath attributes which should not have been there, I was worried that none would be added at all. This seems not to be the case so +1 from me.

vzakhari accepted this revision.Mar 6 2023, 8:49 AM

LGTM

This revision is now accepted and ready to land.Mar 6 2023, 8:49 AM
This revision was landed with ongoing or failed builds.Mar 8 2023, 5:56 AM
This revision was automatically updated to reflect the committed changes.