This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Match shufflevector corresponding to slideup.
ClosedPublic

Authored by craig.topper on Feb 14 2022, 11:56 AM.

Details

Summary

This generalizes isElementRotate to work when there's only a single
slide needed. I've removed matchShuffleAsSlideDown which is now
redundant.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 14 2022, 11:56 AM
craig.topper requested review of this revision.Feb 14 2022, 11:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2022, 11:56 AM
khchen added inline comments.Feb 16 2022, 7:47 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2501–2513

nit: I feel it would be good to have a comment talk about what's number mean for L0 and Hi.

2568–2569

If I understand code correctly, the Lo and Hi could be either 0 or 1, why do we need to check >=0 for them?
same question for line 2649 and 2651.

2672

Why not move this line into 2650? is it because readability?

2691

nit: I feel a little bit confusing here because we have already mentioned this behavior above but using different words.

// We found a rotation. We need to slide V1 down by Rotation. Using
// (NumElts - Rotation) for VL. Then we need to slide V2 up by
// (NumElts - Rotation) using NumElts for VL.

If we are doing SLIDEDOWN+SLIDEUP (alias to rotation), reduce the VL (alias reduce VL into to "NumElts - Rotation") for the SLIDEDOWN.

In addition, I think 2654~2656 comment need to replace V1 and V2 with LoV and HiV?

craig.topper added inline comments.Feb 16 2022, 10:07 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2568–2569

They start as -1 and they won't always be overwritten to 0 or 1.

Try to address review comments.

khchen accepted this revision.Feb 16 2022, 5:57 PM

Thanks, it's very clear!
Reuse the isElementRotate is a really good catch and even find out the more optimization opportunity, Good job Craig!

This revision is now accepted and ready to land.Feb 16 2022, 5:57 PM
frasercrmck accepted this revision.Feb 17 2022, 7:18 AM

LGTM

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

extra word is here?