[PATCH] D137704: [RISCV] Make lowerVECTOR_SHUFFLEAsVNSRL support more vnsrl shuffle pattern.

Han-Kuan Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 22:26:41 PST 2022


HanKuanChen added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2761
+    return false;
+  int Difference = Mask[1] - Mask[0];
+  if (Difference <= Mask[0])
----------------
craig.topper wrote:
> What if Mask[0] is -1 and Mask[1] is 1. The different will be 2. I don't think these checks block that.
> 
> I guess maybe it's handled by the std::any_of later?
> 
> I'd feel better if we checked Mask[0] and Mask[1] are >= 0 before the subtract.
> What if Mask[0] is -1 and Mask[1] is 1. The different will be 2. I don't think these checks block that.
> 
> I guess maybe it's handled by the std::any_of later?
> 
> I'd feel better if we checked Mask[0] and Mask[1] are >= 0 before the subtract.

How about we move `find(Mask, -1)` and `std::any_of` to front?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137704/new/

https://reviews.llvm.org/D137704



More information about the llvm-commits mailing list