This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support fixed vector extract element. Use VL=1 for scalable vector extract element.
ClosedPublic

Authored by craig.topper on Feb 23 2021, 11:46 AM.

Details

Summary

I've changed to use VL=1 for slidedown and shifts to avoid extra
element processing that we don't need.

The i64 fixed vector handling on i32 isn't great if the vector type
isn't legal due to an ordering issue in type legalization. If the
vector type isn't legal, we fall back to default legalization
which will bitcast the vector to vXi32 and use two independent extracts.
Doing better will require handling several different cases by
manually inserting insert_subvector/extract_subvector to adjust the type
to a legal vector before emitting custom nodes.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 23 2021, 11:46 AM
craig.topper requested review of this revision.Feb 23 2021, 11:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2021, 11:46 AM
Herald added a subscriber: MaskRay. · View Herald Transcript
frasercrmck accepted this revision.Feb 24 2021, 1:57 AM

Thanks, Craig. I'd taken a look at this lat week but the i64 legalization issue was frustrating and I knew we had to improve the subvector support for it to work anyway.

LGTM other than the typo.

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

Minor typo: it's

2874

Huh, what was Idx doing there? That's odd.

llvm/test/CodeGen/RISCV/rvv/extractelt-fp-rv32.ll
21

I suppose this in theory could also be done with a VL set to 1. I doubt it'd be any more performant, but it'd save a vsetvli in this situation?

This revision is now accepted and ready to land.Feb 24 2021, 1:57 AM
craig.topper added inline comments.Feb 24 2021, 10:10 AM
llvm/test/CodeGen/RISCV/rvv/extractelt-fp-rv32.ll
21

The way the vfmv.f.s pseudo is set up, there is no where to pass the VL. I think we can teach the RISCVCleanupVSETVLI pass to remove this though. I started on a patch for it yesterday. I'll try to finish it up today.

This revision was landed with ongoing or failed builds.Feb 24 2021, 10:17 AM
This revision was automatically updated to reflect the committed changes.