[PATCH] D123911: [VectorCombine] Fold shuffle select pattern

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 02:33:45 PDT 2022


samtebbs added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1259
+/// architectures with no obvious "select" shuffle, this can reduce the total
+/// number of operations of the target reports them as cheaper.
+bool VectorCombine::foldSelectShuffle(Instruction &I) {
----------------
nit of -> if


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1300-1302
+  // For each of the output shuffles, we try to sort the first vector elements
+  // to the beginning, and the second array elements to the end to allow us to
+  // only use half of each of the binops. We compute the ReconstructMask mask
----------------
I'm not exactly sure what is meant by "we try to sort the first vector elements to the beginning, and the second array elements to the end". Does it mean sorting e.g. `shuffle <9, 4, 11, 12, 3>` to `shuffle<3, 4, 9, 11, 12>`?

How does that then allow us to only use half of the binops? The number of binary operations in the output seems to remain the same. This is just for my own understanding, not because I think it's wrong.


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

https://reviews.llvm.org/D123911



More information about the llvm-commits mailing list