[SelectionDAG] Handle promotion + widening in getCopyToPartsVector
authorSander de Smalen <sander.desmalen@arm.com>
Thu, 16 Sep 2021 15:03:52 +0000 (16:03 +0100)
committerSander de Smalen <sander.desmalen@arm.com>
Fri, 1 Oct 2021 07:19:47 +0000 (08:19 +0100)
commitb62e6f19d71359f2c901c834764191355ad06420
tree9288e9b4d5cbd722570c2d09d024ac50954221e8
parenta149b103ca1ff964c4ed52c6dfac8984631aba11
[SelectionDAG] Handle promotion + widening in getCopyToPartsVector

Some vectors require both widening and promotion for their legalization.
This case is not yet handled in getCopyToPartsVector and falls back
on scalarizing by default. BBecause scalable vectors can't easily be
scalarised, we need to implement this in two separate stages:
1. Widen the vector.
2. Promote the vector.

As part of this patch, PromoteIntRes_CONCAT_VECTORS also needed to be
made scalable aware. Instead of falling back on scalarizing the vector
(fixed-width only), each sub-part of the CONCAT vector is promoted,
and the operation is performed on the type with the widest element type,
finally truncating the result to the promoted result type.

Differential Revision: https://reviews.llvm.org/D110646
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/AArch64/sve-extract-scalable-vector.ll