[RISCV] Support extraction of misaligned subvectors
authorFraser Cormack <fraser@codeplay.com>
Thu, 18 Feb 2021 12:48:14 +0000 (12:48 +0000)
committerFraser Cormack <fraser@codeplay.com>
Sat, 20 Feb 2021 15:43:54 +0000 (15:43 +0000)
commit3e1317fd323bf92c6adaf67598697049b08bb373
treec45666fffdf1fe69e126ab50f4cd047e192dfc39
parent9aa20caee6b47ac601602c674749fb6c1d2179cf
[RISCV] Support extraction of misaligned subvectors

This patch extends the support for RVV EXTRACT_SUBVECTOR to cover those
which don't align to a vector register boundary. It accomplishes this by
extracting the nearest register-sized subvector (a subregister
operation), then sliding the vector down with VSLIDEDOWN and extracting
the subvector from the first position (a COPY operation).

Since this procedure involves the use of VSCALE and multiplication, the
handling of such operations is done during lowering to simplify the
implementation and make use of DAG combining. This necessitated moving
some helper functions from RISCVISelDAGToDAG to RISCVTargetLowering.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D96959
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/test/CodeGen/RISCV/rvv/extract-subvector.ll