This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Generate smull/umull instead of sve v2i64 mul
ClosedPublic

Authored by dmgreen on Apr 13 2023, 9:34 AM.

Details

Summary

A neon smull/umull should be preferred over a sve v2i64 mul with two extends. It will be both less instructions and a lower cost multiply instruction.

Diff Detail

Event Timeline

dmgreen created this revision.Apr 13 2023, 9:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 9:34 AM
dmgreen requested review of this revision.Apr 13 2023, 9:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 9:34 AM
Matt added a subscriber: Matt.Apr 13 2023, 12:42 PM
paulwalker-arm accepted this revision.Apr 14 2023, 2:51 AM

One possible simplification but otherwise looks good.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4580

Can this be just hasSVE(). useSVEForFixedLengthVectorVT() is used to detect when bigger than 128-bit vectors are support and then sometime extended to allow NEON sized vectors. In this instance you don't care about that and have done all the type checking yourself and so you only need to check for the presence of SVE.

llvm/test/CodeGen/AArch64/sve-mull.ll
4–6

I guess you've pre-committed these tests but I think it would have been better to add a -mattr=+sve RUN line to aarch64-smull.ll and thus ensure other related patterns are not degraded when SVE is enabled.

This revision is now accepted and ready to land.Apr 14 2023, 2:51 AM
This revision was landed with ongoing or failed builds.Apr 26 2023, 2:12 PM
This revision was automatically updated to reflect the committed changes.