[PATCH] D24683: [DAGCombine] Generalize build_vector -> vector_shuffle combine for more than 2 inputs

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 13:26:41 PDT 2016


mkuper created this revision.
mkuper added reviewers: andreadb, RKSimon, hfinkel, delena, spatel, bogner.
mkuper added subscribers: llvm-commits, DavidKreitzer, Farhana.
Herald added a subscriber: nemanjai.

This generalizes the build_vector -> vector_shuffle combine to support any number of inputs.
The idea is to create a binary tree of shuffles, where the first layer performs pairwise shuffles of the input vectors placing each input element into the correct lane, and the rest of the tree blends these shuffles together.

This doesn't try to be smart and create any sort of "optimal" shuffles - the assumption is that even a "poor" shuffle sequence is better than extracting and inserting the elements one by one.
Also, currently, this fires unconditionally. I'm not sure whether we really want that, or it should depend on the specifics of the input vector use - the edge case is a matrix transpose, where every output vector uses exactly one element from each input.

https://reviews.llvm.org/D24683

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/PowerPC/pr27078.ll
  test/CodeGen/X86/oddshuffles.ll
  test/CodeGen/X86/vector-trunc-math.ll
  test/CodeGen/X86/vector-trunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24683.71694.patch
Type: text/x-patch
Size: 116946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160916/ab5f4b54/attachment-0001.bin>


More information about the llvm-commits mailing list