This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Lower VP_CTLZ_ZERO_UNDEF/VP_CTTZ_ZERO_UNDEF/VP_CTLZ by converting to FP and extracting the exponent.
ClosedPublic

Authored by liaolucy on Jul 12 2023, 8:59 PM.

Details

Summary

D111904, D141585 made RISC-V customized lower vector ISD::CTLZ_ZERO_UNDEF/CTTZ_ZERO_UNDEF/CTLZ
by converting to float and using the float result.

Perhaps VP_CTLZ_ZERO_UNDEF/VP_CTTZ_ZERO_UNDEF/VP_CTLZ could use the similar feature.

Diff Detail

Event Timeline

liaolucy created this revision.Jul 12 2023, 8:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 8:59 PM
liaolucy requested review of this revision.Jul 12 2023, 8:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 8:59 PM
craig.topper added inline comments.Jul 14 2023, 10:28 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4328–4331

We should skip creating the non-VP node this node if it's a VPOpcode

4373

Can we use DAG.getVPZExtOrTrunc

4381–4382

Don't create this new if its a VP opcode

craig.topper added inline comments.Jul 14 2023, 7:11 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4381–4382

That should have said "Don't create this node"

liaolucy updated this revision to Diff 541316.Jul 17 2023, 9:50 PM

1.skip creating the non-VP node this node if it's a VPOpcode
2.use DAG.getVPZExtOrTrunc
3.rebase
Thanks

This revision is now accepted and ready to land.Jul 17 2023, 11:20 PM
This revision was landed with ongoing or failed builds.Jul 18 2023, 12:26 AM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp