[X86][AVX] Fold loads + splats into broadcast instructions
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Dec 2015 22:17:11 +0000 (22:17 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Dec 2015 22:17:11 +0000 (22:17 +0000)
commit323e00d9c77144af5becf9168149feada94ba3cc
treed909e6d194d7bedf5a90526295a8a4f0d3a2b3c6
parentd865c6b70770d44b1b5e9230299d1597cda6422f
[X86][AVX] Fold loads + splats into broadcast instructions

On AVX and AVX2, BROADCAST instructions can load a scalar into all elements of a target vector.

This patch improves the lowering of 'splat' shuffles of a loaded vector into a broadcast - currently the lowering only works for cases where we are splatting the zero'th element, which is now generalised to any element.

Fix for PR23022

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

llvm-svn: 255061
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx-splat.ll
llvm/test/CodeGen/X86/avx-vbroadcast.ll
llvm/test/CodeGen/X86/avx2-vbroadcast.ll
llvm/test/CodeGen/X86/vector-shuffle-256-v4.ll