This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] PromoteIntRes_EXTRACT_SUBVECTOR for scalable vectors.
ClosedPublic

Authored by sdesmalen on Sep 6 2021, 4:00 AM.

Details

Summary

This patch implements legalization of EXTRACT_SUBVECTOR for the case
where the result needs promoting, and the input type is either legal
or requires splitting.

The idea is that the operation is broken down into simpler steps,
by first extracting a smaller subvector until the input vector
becomes legal or requires promotion.

Diff Detail

Event Timeline

sdesmalen created this revision.Sep 6 2021, 4:00 AM
sdesmalen requested review of this revision.Sep 6 2021, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2021, 4:00 AM

Hey Sander,
That is a nice patch.

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
4795

It would not be best if NElts and IdxVal be the same type?
Both should be unsigned or uint64_t.

In the same topic, why getZExtValue the index?

4798

Should this be:

DAG.getConstant((IdxVal, dl, ...

Because:
(IdxVal / NElts) * NElts =. IdxVal?

craig.topper added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
4798

Unless this trying to align IdxVal to a multiple of NElts <= IdxVal. In which case it might be clearer as alignDown(IdxVal, NElts)

sdesmalen updated this revision to Diff 371270.Sep 8 2021, 12:52 AM

Use alignDown instead of (IdxVal / NElts) * NElts.

sdesmalen marked 3 inline comments as done.Sep 8 2021, 12:55 AM
sdesmalen added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
4795

That shouldn't really matter. IdxVal must be uint64_t because of the value returned by getZExtValue().
Any uses of NElts will be promoted to the widest type, which in case of IdxVal will be a 64-bit unsigned value type.

4798

Nice suggestion, thanks!

CarolineConcatto accepted this revision.Sep 9 2021, 6:15 AM

Thank you Sander!

This revision is now accepted and ready to land.Sep 9 2021, 6:15 AM
This revision was landed with ongoing or failed builds.Sep 10 2021, 5:30 AM
This revision was automatically updated to reflect the committed changes.
sdesmalen marked 2 inline comments as done.