This is an archive of the discontinued LLVM Phabricator instance.

[GIsel][AArch64] extend legalization of G_INSERT_VECTOR_ELT
ClosedPublic

Authored by tschuett on Jul 14 2023, 1:49 AM.

Diff Detail

Event Timeline

tschuett created this revision.Jul 14 2023, 1:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:49 AM
tschuett requested review of this revision.Jul 14 2023, 1:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:49 AM
Allen added inline comments.Jul 14 2023, 6:26 PM
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
705–707

Thanks for helping to fix, would it make sense to add some other types, such as v2s8 ?
https://gcc.godbolt.org/z/azrjv64E8

I would like to only do the minimal fix for your PR. Yes, there are more legal vectors.

Allen added a comment.Jul 16 2023, 7:15 PM

ok, thanks.
I'm not familiar with this module, It is better to confirm it with the other expert.

As we will not have any tablegen patterns for v2s16 types, it may be better to legalize it to a v4s16 instead by clamping the number of elements.

tschuett updated this revision to Diff 540921.Jul 17 2023, 2:42 AM

widen v2s16 -> v4s16

aemerson accepted this revision.Jul 20 2023, 12:48 AM

You can just add the test case to the existing one in AArch64/GlobalISel/legalize-insert-vector-elt.mir

llvm/test/CodeGen/AArch64/GlobalISel/pr-63826.mir
18–19 ↗(On Diff #540934)

I prefer to use real values instead of undef for these in case some legalizer combine tries to be smart and elides them in future. For aarch64 you can just use copies from the fpr registers:

%1:_(s16) = COPY $h0
%2:_(s16) = COPY $h1
This revision is now accepted and ready to land.Jul 20 2023, 12:48 AM
tschuett updated this revision to Diff 542351.Jul 20 2023, 1:05 AM

move pr to legalize-insert-vector-elt.mir

tschuett updated this revision to Diff 542353.Jul 20 2023, 1:07 AM

fix syntax error

This revision was landed with ongoing or failed builds.Jul 20 2023, 4:40 AM
This revision was automatically updated to reflect the committed changes.