[X86][AVX] Only shuffle the lower half of vectors if the upper half is undefined
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 23 Dec 2015 13:10:07 +0000 (13:10 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 23 Dec 2015 13:10:07 +0000 (13:10 +0000)
commit023935c3d9c184928758078a4b510d672981c98c
tree4c10cab5737b31e5d6f1eabcb5b0d45b1f406bec
parent07a42297a747039907af7e2500f6f91918c98a08
[X86][AVX] Only shuffle the lower half of vectors if the upper half is undefined

First step towards making better use of AVX's implicit zeroing of the upper half of a 256-bit vector by instructions that only act on the lower 128-bit vector - discussed on D14151.

As well as the fact that 128-bit shuffle instructions are generally more capable, this can be performant for older CPUs with 128-bit ALUs (e.g. Jaguar, Sandy Bridge) that must treat 256-bit vectors as multiple micro-ops.

Moved the similar subvector extraction shuffle combines from PerformShuffleCombine256 to lowerVectorShuffle as well.

Note: I've avoided combining shuffles that reference elements from the upper halves of the input vectors - this may be reviewed in future work as well (AVX1 would probably always gain, but AVX2 does have some cross-lane shuffle instructions).

Differential Revision: http://reviews.llvm.org/D15477

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256332 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx-splat.ll
test/CodeGen/X86/vector-shuffle-256-v16.ll
test/CodeGen/X86/vector-shuffle-256-v32.ll
test/CodeGen/X86/vector-shuffle-256-v4.ll
test/CodeGen/X86/vector-shuffle-256-v8.ll
test/CodeGen/X86/vector-zext.ll