This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][AArch64] Gardening: Factor out vector inserts
ClosedPublic

Authored by paquette on Mar 13 2019, 1:41 PM.

Details

Summary

Factor out the vector insert code in selectBuildVector into a new function, emitLaneInsert.

Replace part of it with emitScalarToVector, since it was an equivalent code sequence.

This will make implementing G_INSERT_VECTOR_ELT easier, since we can share the code.

Diff Detail

Event Timeline

paquette created this revision.Mar 13 2019, 1:41 PM
aemerson added inline comments.Mar 13 2019, 2:04 PM
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
78

We can find MRI from the MIRBuilder, so we can remove this parameter.

2358–2359

Can we pull this into emitLaneInsert()? Opc isn't used anywhere else and emit functions should ideally be able to figure this out themselves. The regbank and eltsize should also be derivable from the operand.

paquette updated this revision to Diff 190512.Mar 13 2019, 2:33 PM
paquette marked 2 inline comments as done.

Addressed review comments

aemerson accepted this revision.Mar 13 2019, 3:18 PM
This revision is now accepted and ready to land.Mar 13 2019, 3:18 PM
paquette updated this revision to Diff 190530.Mar 13 2019, 4:10 PM

Improve naming in emitLaneInsert, add some comments, and add an optional destination register.

Also make it figure out the element size in the function so that we don't have to pass that along.

This revision was automatically updated to reflect the committed changes.