[RISCV] Lower RVV vector SELECTs to VSELECTs
authorFraser Cormack <fraser@codeplay.com>
Wed, 23 Jun 2021 09:11:13 +0000 (10:11 +0100)
committerFraser Cormack <fraser@codeplay.com>
Thu, 24 Jun 2021 09:12:51 +0000 (10:12 +0100)
commita4729f7f88097f9f1afb9a7294ee035888e7f687
tree332bd7e22a0e586e1a10895fa221eb65675631de
parentc2fd2b5194eee8a0935739c862efb8f98a0bcd4b
[RISCV] Lower RVV vector SELECTs to VSELECTs

This patch optimizes the code generation of vector-type SELECTs (LLVM
select instructions with scalar conditions) by custom-lowering to
VSELECTs (LLVM select instructions with vector conditions) by splatting
the condition to a vector. This avoids the default expansion path which
would either introduce control flow or fully scalarize.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D104772
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-select-fp.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-select-int.ll
llvm/test/CodeGen/RISCV/rvv/select-fp.ll
llvm/test/CodeGen/RISCV/rvv/select-int.ll