This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use v(f)slide1down for shuffle+insert idiom
ClosedPublic

Authored by reames on May 30 2023, 11:54 AM.

Details

Summary

This is a follow up to D151468 which added the vslide1down case as a sub-case of vslide1down matching. This generalizes that code into generic mask matching - specifically to point out the sub-vector insert restriction in the original patch. Since the matching logic is basically the same, go ahead and support vslide1up at the same time.

Diff Detail

Event Timeline

reames created this revision.May 30 2023, 11:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2023, 11:54 AM
reames requested review of this revision.May 30 2023, 11:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2023, 11:54 AM
craig.topper added inline comments.May 30 2023, 3:38 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
3762

I think VECTOR_SHUFFLE nodes already required the VTs to match.

3790

I don't think we need a line break here? Unless clang-format did it?

3808

Is the VL we would have gotten from getDefaultVLOps if you hadn't just taken .first?

luke added a comment.May 31 2023, 2:54 AM

Other than Craig's comments LGTM

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
3772–3773

Out of curiosity, what happens if we remove the restriction that it must be a splat and extract out the scalar like vslide1down v2, (extract_vector_elt v1, idx)?

3781

Nit, extra space

3788

Nit, other places in RISCVISelLowering.cpp spell it VSlidedown

This revision was not accepted when it landed; it landed in state Needs Review.May 31 2023, 7:54 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.