This is an archive of the discontinued LLVM Phabricator instance.

[LV][AArch64] Enable scalable vectorization of loops that contain FREM instructions
Needs ReviewPublic

Authored by jolanta.jensen on Aug 9 2023, 10:28 AM.

Details

Summary

This patch enables scalable vectorization of loops that contain FREM
instructions when suitable vector library is available.

Depends on D156439

Diff Detail

Event Timeline

jolanta.jensen created this revision.Aug 9 2023, 10:28 AM
jolanta.jensen requested review of this revision.Aug 9 2023, 10:28 AM
huntergr added inline comments.Aug 10 2023, 2:37 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7224–7238

I don't think we need to copy this part from the above -- it's very unlikely that we'll have a cheaper version of frem with an invariant second operand.

7247–7252

I think we want to check TargetTransformInfo for a cost instead of just returning invalid if there's no vector function available. While AArch64 doesn't have a hardware frem implementation, there may be another architecture which does and we don't want to prevent that from being used.

Gathering costs for a vector/scalarized frem instruction vs. a library call and returning the cheapest cost would be a good plan.

Addressing review comments.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7224–7238

Removed.

7247–7252

Isn't that check made on line 7233? The one calling TTI.getArthmeticInstrCost().

I gather them and return what is lower.