[RISCV] Support EXTRACT_SUBVECTOR on vector masks
authorFraser Cormack <fraser@codeplay.com>
Thu, 25 Feb 2021 08:15:25 +0000 (08:15 +0000)
committerFraser Cormack <fraser@codeplay.com>
Mon, 1 Mar 2021 11:20:09 +0000 (11:20 +0000)
commitbd4d4216881d2ddba170808a8cd2f7b75cbc8de9
tree2d634af1c7e53afd7d3d0821c6026d788b3553f3
parent1b04bdc2f3ffaa7a0e1e3dbdc3a0cd08f0b9a4ce
[RISCV] Support EXTRACT_SUBVECTOR on vector masks

This patch adds support for extracting subvectors from vector masks.
This can be either extracting a scalable vector from another, or a fixed-length
vector from a fixed-length or scalable vector.

Since RVV lacks a way to slide vector masks down on an element-wise
basis and we don't know the true length of the vector registers, in many
cases we must resort to using equivalently-sized i8 vectors to perform
the operation. When this is not possible we fall back and extend to a
suitable i8 vector.

Support was also added for fixed-length truncation to mask types.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97475
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/extract-subvector.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract-subvector.ll