[RISCV] Manually emit the best shift for VSCALE lowering to improve codegen.
authorCraig Topper <craig.topper@sifive.com>
Sat, 17 Jul 2021 07:24:48 +0000 (00:24 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sat, 17 Jul 2021 07:52:07 +0000 (00:52 -0700)
commit173332d175614561770469d237f8c5ba6378a0e7
treeefdf8b101ec65b18f9f0ec5b4cdbb9a4e49462f4
parent1f1369e4769945e3d975bc4d7c7a9db30ed47b04
[RISCV] Manually emit the best shift for VSCALE lowering to improve codegen.

We assume VLENB is a multiple of 8 and previously relied on shift
pairs being optimized to an AND+SHL/SHR and computeKnownBits
removing the AND. This doesn't happen if (vlenb >> 3) gets CSEd
to have multiple uses. This patch manually emits the best shift
to workaround this.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/calling-conv-fastcc.ll
llvm/test/CodeGen/RISCV/rvv/insert-subvector.ll
llvm/test/CodeGen/RISCV/rvv/mgather-sdnode.ll
llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i32.ll
llvm/test/CodeGen/RISCV/rvv/rvv-vscale.i64.ll
llvm/test/CodeGen/RISCV/rvv/stepvector.ll
llvm/test/CodeGen/RISCV/rvv/vselect-fp-rv32.ll
llvm/test/CodeGen/RISCV/rvv/vselect-fp-rv64.ll