[SelectionDAG] Make WidenVecRes_EXTRACT_SUBVECTOR work for scalable vectors.
authorSander de Smalen <sander.desmalen@arm.com>
Wed, 29 Sep 2021 10:33:40 +0000 (11:33 +0100)
committerSander de Smalen <sander.desmalen@arm.com>
Wed, 29 Sep 2021 10:33:45 +0000 (11:33 +0100)
commit6709b193ea254edf3670a60e1efb3223f199c662
treec1085565cc9329cb332b874dadb02cef29580704
parent87bcbd61b5e60ed1f465cc276029be9f667162ba
[SelectionDAG] Make WidenVecRes_EXTRACT_SUBVECTOR work for scalable vectors.

The legalizer handles this by breaking up an EXTRACT_SUBVECTOR into
smaller parts, and combines those together, padding the result with
UNDEF vectors, e.g.

  nxv6i64 extract_subvector(nxv12i64, 6)
  <->
  nxv8i64 concat(
    nxv2i64 extract_subvector(nxv16i64, 6)
    nxv2i64 extract_subvector(nxv16i64, 8)
    nxv2i64 extract_subvector(nxv16i64, 10)
    nxv2i64 undef)

Reviewed By: frasercrmck, david-arm

Differential Revision: https://reviews.llvm.org/D110253
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/test/CodeGen/AArch64/sve-extract-scalable-vector.ll
llvm/test/CodeGen/RISCV/rvv/extract-subvector.ll