[RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and...
authorYeting Kuo <yeting.kuo@sifive.com>
Thu, 12 Jan 2023 10:14:24 +0000 (18:14 +0800)
committerYeting Kuo <yeting.kuo@sifive.com>
Fri, 13 Jan 2023 01:51:36 +0000 (09:51 +0800)
commit0bab2ecd468918dfcfbc285e0b5675dd20c2cdf2
treeffc26705051def92994d7af19acac329513b4d25
parenteb2db81eba2dc420d273158397dd09639961d2f7
[RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and element size.

D111904 made RISC-V customized lower ISD::CTLZ_ZERO_UNDEF by converting to float
and using the float result. The expected value of CTLZ with zero input is the
element size of input type. Since the result of above method with zero input
must be greater than the element size, for ISD::CTLZ, we could use the minimum
of element size and the result of CTLZ_ZERO_UNDER with same input.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141585
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/ctlz-sdnode.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll