This is an archive of the discontinued LLVM Phabricator instance.

[flang] Try to lower math intrinsics to math operations first.
ClosedPublic

Authored by vzakhari on Jul 19 2022, 3:48 PM.

Details

Summary

This commit changes how math intrinsics are lowered: we, first,
try to lower them into MLIR operations or libm calls via
mathOperations table and only then fallback to pgmath runtime calls.

The pgmath fallback is needed, because mathOperations does not
support all intrinsics that pgmath supports. The main purpose
of this change is to get rid of llvmIntrinsics table so that
we do not have to update both llvmIntrinsics and mathOperations
when adding new intrinsic support.

mathOperations lowering should phase out pgmath lowering, when
more operations are available (e.g. power operations being
added in D129809 and D129811; complex type operations from
Complex dialect).

Diff Detail

Event Timeline

vzakhari created this revision.Jul 19 2022, 3:48 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 19 2022, 3:48 PM
vzakhari requested review of this revision.Jul 19 2022, 3:48 PM
vzakhari updated this revision to Diff 445969.Jul 19 2022, 3:49 PM

clang-format

This revision is now accepted and ready to land.Jul 20 2022, 2:16 AM
mehdi_amini added inline comments.Sep 27 2023, 2:26 AM
flang/test/Lower/math-lowering.f90
1

Why is this is structured like this instead of actually splitting the files? This is really hard to debug as the FileCheck output will point to temporary files...

vzakhari added inline comments.Sep 27 2023, 10:47 AM
flang/test/Lower/math-lowering.f90
1

I can see that being inconvenient. I will split them into different files.

flang/test/Lower/dummy-procedure.f90