[RISCV] Support fixed-length vector truncates
authorFraser Cormack <fraser@codeplay.com>
Mon, 22 Feb 2021 16:51:24 +0000 (16:51 +0000)
committerFraser Cormack <fraser@codeplay.com>
Thu, 25 Feb 2021 12:11:34 +0000 (12:11 +0000)
commit84413e1947427a917a3e55abfc1f66c42adc751b
treedf55c68fbeb08c22cfe8afac0ea2114d74458fc6
parent3bc5ed38750c6a6daff39ad524b75e40c8c09183
[RISCV] Support fixed-length vector truncates

This patch extends support for our custom-lowering of scalable-vector
truncates to include those of fixed-length vectors. It does this by
co-opting the custom RISCVISD::TRUNCATE_VECTOR node and adding mask and
VL operands. This avoids unnecessary duplication of patterns and
inflation of the ISel table.

Some truncates go through CONCAT_VECTORS which currently isn't
efficiently handled, as it goes through the stack. This can be improved
upon in the future.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97202
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-exttrunc.ll