Page MenuHomePhabricator

[RISCV] Enable SPLAT_VECTOR for fixed vXi64 types on RV32.

Authored by craig.topper on Mon, Apr 19, 3:54 PM.



This replaces D98479.

This allows type legalization to form SPLAT_VECTOR_PARTS so we don't
lose the splattedness when the scalar type is split.

I'm handling SPLAT_VECTOR_PARTS for fixed vectors separately so
we can continue using non-VL nodes for scalable vectors.

I limited to RV32+vXi64 because DAGCombiner::visitBUILD_VECTOR likes
to form SPLAT_VECTOR before seeing if it can replace the BUILD_VECTOR
with other operations. Especially interesting is a splat BUILD_VECTOR of
the extract_vector_elt which can become a splat shuffle, but won't if
we form SPLAT_VECTOR first. We either need to reorder visitBUILD_VECTOR
or add visitSPLAT_VECTOR.

Diff Detail

Event Timeline

craig.topper created this revision.Mon, Apr 19, 3:54 PM
craig.topper requested review of this revision.Mon, Apr 19, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Apr 19, 3:54 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
craig.topper added inline comments.Mon, Apr 19, 3:57 PM

This is a regression.

56 ↗(On Diff #338660)

grr the script deleted the checks.

Fix missing check lines.

craig.topper added inline comments.Mon, Apr 19, 4:08 PM
56 ↗(On Diff #338661)

This is caused by SPLAT_VECTOR being formed before splat VECTOR_SHUFFLE as noted in the description.

Harbormaster completed remote builds in B99581: Diff 338661.
frasercrmck added inline comments.Tue, Apr 20, 9:11 AM

I'm wondering if you could fold this optimization into splatPartsI64WithVL

Sink constant handling into splatPartsI64WithVL

This is starting to look good. I think it'd be good to have all vectors treated similarly but it isn't time for that yet. Maybe something like visitSplatLike in the DAGCombiner could serve as a generic splat optimization path and avoid us diverging too much like we currently have with BUILD_VECTOR/SPLAT_VECTOR.

Is your plan to address the regressions in this patch or later on? Do you have a feeling of how much work it'd be?

Push SPLAT_VECTOR formation to late in visitBUILD_VECTOR which recovers some of the regressions and doesn't effect any other target lit tests.

craig.topper added inline comments.Wed, Apr 21, 10:23 AM

Andrew Waterman's advice at least for us was to use stores and a strided load with x0 stride to splat SEW=64 on RV32. This is analogous to the sequence for loading a double precision value from integer data on RV32. Should we use that instead of being clever with shifts/ors?

craig.topper added inline comments.Wed, Apr 21, 3:39 PM

I've implemented the strided store in splatSplitI64WithVL here

frasercrmck accepted this revision.Thu, Apr 29, 4:35 AM

LGTM. There are a couple of areas that need formatting according to clang-tidy.

This revision is now accepted and ready to land.Thu, Apr 29, 4:35 AM
This revision was landed with ongoing or failed builds.Thu, Apr 29, 8:23 AM
This revision was automatically updated to reflect the committed changes.