This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Manually split vector operands to VECREDUCE when handling vXi64 vectors on RV32.
ClosedPublic

Authored by craig.topper on Mar 9 2021, 2:32 PM.

Details

Summary

The type legalizer will visit the result before the operands. To
avoid creating an illegal target specific node or falling back to
scalarization, we need to manually split vector operands.

This still doesn't handle the case of non-power of 2 operands
which need to be widened. I'm not sure the type legalizer is
ready for it. I think we would need to insert an
INSERT_SUBVECTOR with the power of 2 type we want, with an undef
first operand, and the non-power of 2 orignal operand as the vector
to insert. Then fill in the neutral elements into the elements the
padded elements. Alternatively we INSERT_SUBVECTOR into a neutral vector.
From there we carry on splitting if needed to get to a legal type
then do the target specific code.

The problem with this is the type legalizer doesn't know how to
widen an insert_subvector yet. We would need to add that including
the handling for a non-undef first vector.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 9 2021, 2:32 PM
craig.topper requested review of this revision.Mar 9 2021, 2:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2021, 2:32 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
This revision is now accepted and ready to land.Mar 10 2021, 3:41 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp