[RISCV][InsertVSETVLI] Support constant VLs larger than immediate encoding
authorPhilip Reames <preames@rivosinc.com>
Wed, 24 May 2023 17:31:54 +0000 (10:31 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 24 May 2023 17:37:59 +0000 (10:37 -0700)
commit7639a39dd25e5035f594430f5bf1bf8e39722aa8
tree0ce248f439092ff99757ccab9b9b1b9215514bf0
parent6455242570f6df06f5ec99821effc1cc9e29fa35
[RISCV][InsertVSETVLI] Support constant VLs larger than immediate encoding

The immediate field on the vsetivli is fairly limited. For larger vectors, we end up having to materialize a constant in a register. We hadn't plumbed the infrastructure to treat such materialized constants as constants for purpose of vsetvli elimination.

I only bothered to handle LI. We could extend this to LUI sequences, but well, 2048 elements is probably enough for all practical fixed length vector codegen. :)

The test delta does point out a related problem. At LMUL8, we see increased register allocation pressure, and we should probably either a) address register allocation remat, or b) be less aggressive about eliminating vsetvlis at high lmul. Note that high LMUL code is not generated much by default.

Differential Revision: https://reviews.llvm.org/D151212
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-interleave.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-interleave.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-interleaved-access.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vand-vp.ll
llvm/test/CodeGen/RISCV/rvv/shuffle-reverse.ll