This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add lowering for vp.fptosi and vp.sitofp.
ClosedPublic

Authored by craig.topper on Mar 25 2022, 3:20 PM.

Details

Summary

This as an alternative version of D120641. Starting from the code here
https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi/-/raw/EPI/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
but with some modifications to how the interim types are calculated,
and adding support for f16.

Still need to add fptosi for mask vectors.

Lots of masked isel patterns added so we can pass the mask through
the type changes.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 25 2022, 3:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 3:20 PM
craig.topper requested review of this revision.Mar 25 2022, 3:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 3:20 PM

Fix typo in comment

craig.topper added inline comments.Mar 25 2022, 3:29 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
6175

Source repo had a separate else for DstTypeSize == SrcTypeSize. I merged them since the only difference was that else didn't check the pre-widening conditions. But the pre-widening conditions won't match for the single-width case so we can share the code.

arcbbb added inline comments.Mar 26 2022, 10:13 AM
llvm/test/CodeGen/RISCV/rvv/vfptosi-vp.ll
27

%m is not used here

craig.topper added inline comments.Mar 26 2022, 11:00 AM
llvm/test/CodeGen/RISCV/rvv/vfptosi-vp.ll
27

Oops. Thanks. I moved to a ConstantExpr and forgot to delete it.

Remove dead instructions from tests

arcbbb accepted this revision.Mar 27 2022, 8:54 AM

LGTM

This revision is now accepted and ready to land.Mar 27 2022, 8:54 AM
frasercrmck accepted this revision.Mar 28 2022, 1:53 AM

LGTM otherwise

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

I feel like the Ops[0], Ops[1] style isn't very common for us. Could we perhaps just use SDValue Src, Mask, VL?

6181

Just to double-check - it's not possible for this to end up in an illegal integer type, is it? We can never have f64 legal but i64 not - I guess that'd be Zve32d which doesn't exist.

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fptosi-vp.ll
3

Is there a reason we're not testing RV32 anymore?

Add rv32 tests.
Use Src, Mask, VL
Rename some variables.

This revision was landed with ongoing or failed builds.Mar 28 2022, 11:09 AM
This revision was automatically updated to reflect the committed changes.