[PATCH] D117743: [RISCV] Optimize vector_shuffles that are interleaving the lowest elements of two vectors.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 20 09:01:08 PST 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2347
+
+ // Ensure we consistenly use the source for this polarity.
+ int Src = Mask[i] / Size;
----------------
consistenly -> consistently
source -> "same source"
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2348
+ // Ensure we consistenly use the source for this polarity.
+ int Src = Mask[i] / Size;
+ if (Srcs[Pol] < 0)
----------------
rogfer01 wrote:
> I admit was very confused by this because I assumed the `Mask` of the `SDNode` would be the operand of the IR more or less verbatim (e.g. `0, 2, 1, 3`), but apparently it seems it is adjusted by the length of the mask itself (i.e. the elements of the second source are offset by the length of the concatenated vector, not sure if my interpretation is correct after reading the SelectionDAG code though).
IR allows the the sources and mask to have different lengths. SelectionDAG does not. There's a piece of code in SelectionDAGBuilder that tries a few heuristics for matching the lengths. I think it can fall back to a build_vector in the worst case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117743/new/
https://reviews.llvm.org/D117743
More information about the llvm-commits
mailing list