This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Legalize G_SHUFFLE_VECTOR with smaller dest size
ClosedPublic

Authored by dzhidzhoev on Feb 23 2023, 12:51 PM.

Details

Summary

Legalize G_SHUFFLE_VECTOR having destination vector length smaller than
source vector length by reshaping destination vector.

arm64-vabs.ll and arm64-vcvt_f.ll tests used to fallback to DAGIsel before
this commit.

Diff Detail

Event Timeline

dzhidzhoev created this revision.Feb 23 2023, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 12:51 PM
dzhidzhoev requested review of this revision.Feb 23 2023, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 12:51 PM
paquette added inline comments.Feb 23 2023, 1:10 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4993

Add a TODO?

4999

Why 8 vs default value for SmallVector?

5000

don't need braces

Addressed @paquette comments.

dzhidzhoev marked an inline comment as not done.Feb 24 2023, 6:15 AM
dzhidzhoev added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4993

For the purpose of this function (making lengths of G_SHUFFLE_VECTOR instruction arguments equal), I think it should return Legalized if lengths are equal.

4999

This value is used in SelectionDAGBuilder::visitShuffleVector for the mask, that's why I used it here. Should I use the default value?

dzhidzhoev marked an inline comment as not done.Feb 24 2023, 6:15 AM
aemerson accepted this revision.Feb 24 2023, 11:09 PM
aemerson added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4993

no need for braces for the if here

4999

I actually think it's worth going up to 16 here, because it's quite common to have mask lengths of that length if you have 8 x 16b elements in a 128b vector.

This revision is now accepted and ready to land.Feb 24 2023, 11:09 PM
This revision was landed with ongoing or failed builds.Feb 27 2023, 2:47 PM
This revision was automatically updated to reflect the committed changes.