This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Add hlfir.dot_product intrinsic
ClosedPublic

Authored by jacob-crawley on Jun 6 2023, 2:59 AM.

Details

Summary

Adds a new HLFIR operation for the DOT_PRODUCT intrinsic according to
the design set out in flang/docs/HighLevel.md. This patch includes all
the necessary changes to create a new HLFIR operation and lower it into
the fir runtime call.

Diff Detail

Event Timeline

jacob-crawley created this revision.Jun 6 2023, 2:59 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 6 2023, 2:59 AM
jacob-crawley requested review of this revision.Jun 6 2023, 2:59 AM
tblah added a comment.Jun 6 2023, 4:20 AM

Thanks for this. The code is very clean. Just some small nits.

flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
687

It would be better to check the rank before indexing into the array so that we don't crash when the rank is zero (I'm not sure if this can happen in practice)

flang/test/Lower/HLFIR/dot_product.f90
39

Do you mean "arguments aren't assumed shape"?

Thanks for the review.

Addressing nit comments

jacob-crawley marked 2 inline comments as done.Jun 6 2023, 4:47 AM
tblah accepted this revision.Jun 6 2023, 5:46 AM

Thanks. LGTM

This revision is now accepted and ready to land.Jun 6 2023, 5:46 AM
This revision was automatically updated to reflect the committed changes.