OSDN Git Service

[SelectionDAG] Generate vector_shuffle nodes for undersized result vector sizes
authorMichael Kuperstein <mkuper@google.com>
Thu, 1 Sep 2016 21:32:09 +0000 (21:32 +0000)
committerMichael Kuperstein <mkuper@google.com>
Thu, 1 Sep 2016 21:32:09 +0000 (21:32 +0000)
commit5cf52dab7bfc175b98e16d113dc1d2c9126154c1
tree59329bb7372bdfd199d7b3f606c361095918aa4d
parentd5f9cd91f56a2b634a839e5f1737d3bc00f1f781
[SelectionDAG] Generate vector_shuffle nodes for undersized result vector sizes

Prior to this, we could generate a vector_shuffle from an IR shuffle when the
size of the result was exactly the sum of the sizes of the input vectors.
If the output vector was narrower - e.g. a <12 x i8> being formed by a shuffle
with two <8 x i8> inputs - we would lower the shuffle to a sequence of extracts
and inserts.

Instead, we can form a larger vector_shuffle, and then extract a subvector
of the right size - e.g. shuffle the two <8 x i8> inputs into a <16 x i8>
and then extract a <12 x i8>.

This also includes a target-specific X86 combine that in the presence of
AVX2 combines:
(vector_shuffle <mask> (concat_vectors t1, undef)
                       (concat_vectors t2, undef))
into:
(vector_shuffle <mask> (concat_vectors t1, t2), undef)
in cases where this allows us to form VPERMD/VPERMQ.

(This is not a separate commit, as that pattern does not appear without
the DAGBuilder change.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280418 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/oddshuffles.ll