[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)
commit029bc0f70a472dc9e8a158a01375673a362f69b0
tree3e114fd23d59c1d4af6e78f773b94a82d1a10c77
parent5fb71e111619c7169b884c7e1139d37662dd324e
[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

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