This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and element size.
ClosedPublic

Authored by fakepaper56 on Jan 12 2023, 2:33 AM.

Details

Summary

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.

Diff Detail

Event Timeline

fakepaper56 created this revision.Jan 12 2023, 2:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 2:33 AM
fakepaper56 requested review of this revision.Jan 12 2023, 2:33 AM
craig.topper retitled this revision from [RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDER and element size. to [RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and element size..Jan 12 2023, 11:11 AM
craig.topper accepted this revision.Jan 12 2023, 11:18 AM

LGTM with those comments fixed.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
3606

equaled -> equal

"which greater" -> "which is greater"

This revision is now accepted and ready to land.Jan 12 2023, 11:18 AM

Rebase and fix typos.

This revision was landed with ongoing or failed builds.Jan 12 2023, 5:51 PM
This revision was automatically updated to reflect the committed changes.