This is an archive of the discontinued LLVM Phabricator instance.

Start replacing vector_extract/vector_insert with extractelt/insertelt
ClosedPublic

Authored by arsenm on Oct 5 2015, 9:03 AM.

Details

Summary

These are redundant pairs of nodes defined for
INSERT_VECTOR_ELEMENT/EXTRACT_VECTOR_ELEMENT.
insertelement/extractelement are slightly closer to the corresponding
C++ node name, and has stricter type checking so prefer it.

Update targets to only use these nodes where it is trivial to do so.
AArch64, ARM, and Mips all have various type errors on simple replacement,
so they will need work to fix.

Example from AArch64:

def : Pat<(sext_inreg (vector_extract (v16i8 V128:$Rn), VectorIndexB:$idx), i8),

(i32 (SMOVvi8to32 V128:$Rn, VectorIndexB:$idx))>;

Which is trying to do sext_inreg i8, i8.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 36522.Oct 5 2015, 9:03 AM
arsenm retitled this revision from to Start replacing vector_extract/vector_insert with extractelt/insertelt.
arsenm updated this object.
arsenm added a subscriber: llvm-commits.
hfinkel accepted this revision.Dec 9 2015, 8:50 PM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

Please add a comment to include/llvm/Target/TargetSelectionDAG.td above the definitions of vector_extract and vector_insert stating that the use of extractelt and insertelt is preferred when applicable.

Otherwise, LGTM.

This revision is now accepted and ready to land.Dec 9 2015, 8:50 PM
arsenm closed this revision.Dec 11 2015, 11:23 AM

r255359