This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Sink to umull if we know tops bits are zero.
ClosedPublic

Authored by dmgreen on Jan 9 2023, 4:14 AM.

Details

Summary

This is an extension to the code for sinking splats to multiplies, where if we can detect that the top bits are known-zero we can treat the instruction like a zext. The existing code was also adjusted in the process to make it more precise about only sink if both operands are zext or sext.

Diff Detail

Event Timeline

dmgreen created this revision.Jan 9 2023, 4:14 AM
dmgreen requested review of this revision.Jan 9 2023, 4:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 4:14 AM
samtebbs added inline comments.Jan 9 2023, 5:27 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14089

Would an early return within the loop in the case of NumSExts > 2 && NumZExts > 2 make sense?

dmgreen added inline comments.Jan 9 2023, 5:34 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14089

I'm working under the assumption that a mul can only have 2 operands. The loop is just checking both of them.

samtebbs accepted this revision.Jan 9 2023, 5:39 AM
samtebbs added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14089

I see, cool. Semantically an early return and not is the same thing when assuming 2 operands so LGTM.

This revision is now accepted and ready to land.Jan 9 2023, 5:39 AM
This revision was landed with ongoing or failed builds.Jan 16 2023, 2:44 AM
This revision was automatically updated to reflect the committed changes.