This is an archive of the discontinued LLVM Phabricator instance.

[MIPS GlobalISel] Select MSA vector generic and builtin add
ClosedPublic

Authored by Petar.Avramovic on Oct 15 2019, 6:27 AM.

Details

Summary

Select vector G_ADD for MIPS32 with MSA. We have to set bank
for vector operands to fprb and selectImpl will do the rest.
builtin_msa_addv_<format> will be transformed into G_ADD
in legalizeIntrinsic and selected in the same way.
builtin_msa_addvi_<format> will be directly selected into
ADDVI_<format> in legalizeIntrinsic. MIR tests for it have
unnecessary additional copies. Capture current state of tests
with run-pass=legalizer with a test in test/CodeGen/MIR/Mips.

Diff Detail

Event Timeline

Fix flags in tests.

atanasyan added inline comments.Oct 16 2019, 6:52 AM
lib/Target/Mips/MipsLegalizerInfo.cpp
44 ↗(On Diff #225180)

Are there any advantages of passing the T as a template parameter instead of a regular function argument with more mnemonic name?

48 ↗(On Diff #225180)

It can be written a bit shorter:

if (Val == Query.Types[T])
  return true;
55 ↗(On Diff #225180)

Do you use this class anywhere?

Petar.Avramovic marked 2 inline comments as done.Oct 16 2019, 7:05 AM
Petar.Avramovic added inline comments.
lib/Target/Mips/MipsLegalizerInfo.cpp
44 ↗(On Diff #225180)

Not that I am aware of. Then change it to:
bool CheckTyN(unsigned N, const LegalityQuery &Query, std::initializer_list<LLT> SupportedValues) ?

55 ↗(On Diff #225180)

Missed that, it was meant to be used later for scalarize, will remove it for now.

atanasyan accepted this revision.Oct 16 2019, 8:45 AM

LGTM

lib/Target/Mips/MipsLegalizerInfo.cpp
44 ↗(On Diff #225180)

Then change it to: bool CheckTyN(unsigned N, const LegalityQuery &Query, std::initializer_list<LLT> SupportedValues) ?

Yes.

This revision is now accepted and ready to land.Oct 16 2019, 8:45 AM

Addressed review comments.

Petar.Avramovic marked 2 inline comments as done.Oct 16 2019, 9:28 AM

Will wait for conclusion of D68946 before commit, to see what to do with mir tests for legalizer.

This revision was automatically updated to reflect the committed changes.