This is an archive of the discontinued LLVM Phabricator instance.

[VP][RISCV] Add vp.rint and RISC-V support.
ClosedPublic

Authored by fakepaper56 on Oct 24 2022, 10:38 PM.

Details

Summary

FRINT uses dynamic rounding mode instead of static rounding mode. The patch
rename VFCVT_X_F_VL to VFCVT_RM_X_F_VL for static rounding mode uses and added
new ISDNode VFCVT_X_F_VL directly selected to PseudoVFCVT_X_F_V.

Diff Detail

Event Timeline

fakepaper56 created this revision.Oct 24 2022, 10:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 10:38 PM
fakepaper56 requested review of this revision.Oct 24 2022, 10:38 PM

Rename lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND to lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND_FRINT.

Please update the cost model in RISCVTargetTransformInfo.cpp and add test to llvm/test/Analysis/CostModel/RISCV/fround.ll

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1988–1990

VP_RINT -> VP_FRINT

2007–2008

Can we use Op->isVPOpcode()?

Address Craig's comment.

fakepaper56 marked 2 inline comments as done.Oct 26 2022, 12:52 AM
craig.topper added inline comments.Oct 26 2022, 8:48 AM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
518

Why is LT.first added? Shouldn't it be multiplied? stepvector is special because if LT.first > 1, it's a single vid.v and LT.first-1 adds.

fakepaper56 added inline comments.Oct 26 2022, 3:19 PM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
518

Yes, you are right. And also I think it is terrible mistake and I will reflect on my careless code.

Use mutiplication of LT.first.

fakepaper56 marked an inline comment as done.Oct 26 2022, 4:16 PM

Rebase and use original name lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND to follow lowerFTRUNC_FCEIL_FFLOOR_FROUND.

Add TLI->isOperationCustom(ISD::VP_FRINT, LT.second) to make sure that legalized types of vp.rint have target customized lowering.

This revision is now accepted and ready to land.Oct 31 2022, 11:27 AM
This revision was landed with ongoing or failed builds.Oct 31 2022, 11:53 PM
This revision was automatically updated to reflect the committed changes.