This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Implement partial support for G_SHUFFLE_VECTOR
ClosedPublic

Authored by aemerson on Feb 20 2019, 11:28 AM.

Details

Summary

This change makes some basic type combinations for G_SHUFFLE_VECTOR legal, and implements them with a very pessimistic TBL2 instruction in the selector.

For TBL2, support is also needed to generate constant pool entries and load from them in order to materialize the mask register.

Currently supports <2 x s64> and <4 x s32> result types.

Diff Detail

Event Timeline

aemerson created this revision.Feb 20 2019, 11:28 AM
aemerson updated this revision to Diff 187633.Feb 20 2019, 11:29 AM

Remove commented out line.

paquette added inline comments.Feb 20 2019, 11:59 AM
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
1935

unsigned i = 1, e = MaskDef->getNumOperands(); i < e; ++i?

1939–1941

don't need braces

1940

MRI.getVRegDef isn't guaranteed to return a value. Could this possibly be null here?

1995–1996

Should we die here then? Or add some debug output to make it easier to grep logs for if it happens?

aemerson marked 2 inline comments as done.Feb 20 2019, 1:56 PM
aemerson added inline comments.
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
1995–1996

I'd rather not us die here for now, until we're really sure that all "scalar" shuffles are handled before selection.

aemerson updated this revision to Diff 187671.Feb 20 2019, 1:57 PM

Addressed review comments. Also add an extra legalization check for source vector types being the same as the dest, this broke a lit test I missed.

aemerson marked 3 inline comments as done.Feb 20 2019, 1:58 PM
aemerson marked an inline comment as done.Feb 20 2019, 2:01 PM
aemerson added inline comments.
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
1940

We assume that getVRegDef always gives us a def if the MIR is valid, so I made this an assert. If we don't have a def then there's no way to recover and something's gone badly wrong.

This revision is now accepted and ready to land.Feb 20 2019, 2:05 PM
This revision was automatically updated to reflect the committed changes.