This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Lower VECTOR_SHUFFLE to VSLIDEDOWN_VL.
ClosedPublic

Authored by HanKuanChen on Oct 17 2022, 11:54 PM.

Diff Detail

Event Timeline

HanKuanChen created this revision.Oct 17 2022, 11:54 PM
HanKuanChen requested review of this revision.Oct 17 2022, 11:54 PM
craig.topper added inline comments.Oct 18 2022, 12:05 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2905

I think you need to check that Mask[0] is >= 0.

craig.topper added inline comments.Oct 18 2022, 12:07 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2905

I think you need to check that Mask[0] is >= 0.

I guess more precisely, it would need to be > 0 or it would definitely not be a slidedown.

craig.topper added inline comments.Oct 18 2022, 12:14 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2901

I don’t think it’s enough to be contiguous. The first index must be 0. If it’s not you won’t extract the correct subvector at the end.

Apply Craig's comments.

  1. Mask should not starts with -1.
  2. Index of V1 EXTRACT_SUBVECTOR should be 0.
This revision is now accepted and ready to land.Oct 18 2022, 8:55 AM
This revision was landed with ongoing or failed builds.Oct 18 2022, 8:58 AM
This revision was automatically updated to reflect the committed changes.
craig.topper added inline comments.Oct 18 2022, 8:58 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2907

Checking Mask[0] < 0 would allow a faster exit for cases that obviously won't match slidedown.