[RISCV] Lower insert subvector shuffles as vslideups
authorLuke Lau <luke@igalia.com>
Fri, 24 Mar 2023 12:03:41 +0000 (12:03 +0000)
committerLuke Lau <luke@igalia.com>
Fri, 24 Mar 2023 17:30:31 +0000 (17:30 +0000)
commit6e9c24edf052756e1f14d6080bf5af7fb75f17e7
treecba5752134e13725e2a65709c00f6cab3cb7af5d
parent33be83415c9b5e9a874fcbddee8e64ecf464c203
[RISCV] Lower insert subvector shuffles as vslideups

A shuffle with an insert subvector mask is functionally equivalent to:
(insert_subvector v0, (extract_subvector v1, len), index)
We can emulate by doing a vslideup on v1 into the right index, and
carefully selecting VL so that we don't overwrite any more destination
elements than what we have to.
This avoids the need for a select with a mask.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shufflevector-vnsrl.ll
llvm/test/CodeGen/RISCV/rvv/vector-deinterleave-fixed.ll