[RISCV][InsertVSETVLI] Treat vmv.v.i as-if it were vmv.s.x when VL=1, and inactive...
authorPhilip Reames <preames@rivosinc.com>
Thu, 15 Jun 2023 21:00:57 +0000 (14:00 -0700)
committerPhilip Reames <listmail@philipreames.com>
Thu, 15 Jun 2023 21:10:04 +0000 (14:10 -0700)
commitfc9b26440d4441a0b3bcb9202debe259b57f4692
treeec25ccfb8057c5c5657d3c8b65b1844c67236dda
parent4e9526b9eac5d1b1d8f8e99e37109353ef8787e6
[RISCV][InsertVSETVLI] Treat vmv.v.i as-if it were vmv.s.x when VL=1, and inactive lanes are undefined

A vmv.v.i/x splats the immediate to all active lanes. For the active lanes, this is the same as vmv.s.x which inserts one scalar into the low lane. If we can ignore all the inactive lanes (because they are known undefined), then the two are semantically equivalent. We already reason about compatible VL/VTYPE combinations for vmv.s.x, apply the same logic to vmv.v.i.

Unlike a vmv.s.x, we do need to be careful not to increase LMUL. A splat instruction is probably linear in LMUL, so restrict this to LMUL1.

Differential Revision: https://reviews.llvm.org/D152845
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-int-vp.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-int.ll