This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Add support for inserting elements into scalable vectors
ClosedPublic

Authored by david-arm on Apr 28 2020, 3:55 AM.

Details

Summary

This patch tries to ensure that we do something sensible when
generating code for the ISD::INSERT_VECTOR_ELT DAG node when operating
on scalable vectors. Previously we always returned 'undef' when
inserting an element into an out-of-bounds lane index, whereas now
we only do this for fixed length vectors. For scalable vectors it
is assumed that the backend will do the right thing in the same way
that we have to deal with variable lane indices.

In this patch I have permitted a few basic combinations for scalable
vector types where it makes sense, but in general avoided most cases
for now as they currently require the use of BUILD_VECTOR nodes.

This patch includes tests for all scalable vector types when inserting
into lane 0, but I've only included one or two vector types for other
cases such as variable lane inserts.

Diff Detail

Event Timeline

david-arm created this revision.Apr 28 2020, 3:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2020, 3:55 AM
c-rhodes added inline comments.Apr 28 2020, 8:26 AM
llvm/test/CodeGen/AArch64/sve-insert-element.ll
7

I think it would be better to be a little stricter in the predicate regexs throughout the test and use: p[0-9]+. The same applies to Z regs as well in a few places.

david-arm marked an inline comment as done.Apr 29 2020, 12:42 AM
david-arm added inline comments.
llvm/test/CodeGen/AArch64/sve-insert-element.ll
7

OK sure. The reason I didn't match them more precisely was because I'd assumed we had other more basic tests that captured such cases and I thought with these tests the main thing I wanted to check was that we did something sensible for the code paths changed in this patch. Are you specifically concerned about the two different predicate ranges, 0-7 vs 0-15 inclusive?

david-arm updated this revision to Diff 260858.Apr 29 2020, 2:18 AM
c-rhodes added inline comments.Apr 29 2020, 3:10 AM
llvm/test/CodeGen/AArch64/sve-insert-element.ll
7

Are you specifically concerned about the two different predicate ranges, 0-7 vs 0-15 inclusive?

In this particular case I meant p[0-7], sorry for the confusion.

This revision is now accepted and ready to land.Apr 30 2020, 1:52 AM
This revision was automatically updated to reflect the committed changes.