This is an archive of the discontinued LLVM Phabricator instance.

[MIPS GlobalISel] Select MSA insert_vector_elt with immediate index
AcceptedPublic

Authored by Petar.Avramovic on Nov 1 2019, 6:32 AM.

Details

Reviewers
atanasyan
petarj
Summary

Select G_INSERT_VECTOR_ELT when insert index is defined with G_CONSTANT,
and can be folded like an immediate, for MIPS32 with MSA.

Diff Detail

Event Timeline

Petar.Avramovic created this revision.Nov 1 2019, 6:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2019, 6:32 AM

When I apply this match to the master branch I get a couple of failed tests:

  • CodeGen/Mips/GlobalISel/legalizer/insert_vector_elt_imm_index.mir
  • CodeGen/Mips/GlobalISel/llvm-ir/insert_vector_elt_imm_index.ll
LLVM ERROR: unable to legalize instruction: %8:_(<16 x s32>) = G_INSERT_VECTOR_ELT %6:_, %7:_(s32), %5:_(s32) (in function: insert_i8)

Are there any other patches need to be applied first?

D69513 goes first, following what SDAG does
%8:_(<16 x s8>) = G_INSERT_VECTOR_ELT %6:_, %7:_(s8), %5:_(s32)
should change only insert elt scalar type, and leave vector scalar type as is
%8:_(<16 x s8>) = G_INSERT_VECTOR_ELT %6:_, %7:_(s32), %5:_(s32) (in function: insert_i8)
insert instruction is selected based on vector type, inserted scalar is always i32 (i32 or i64 for mips64)

This revision is now accepted and ready to land.Nov 5 2019, 12:32 AM