Lower certain build_vectors to insertps instructions
authorFilipe Cabecinhas <me@filcab.net>
Thu, 8 May 2014 00:25:16 +0000 (00:25 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Thu, 8 May 2014 00:25:16 +0000 (00:25 +0000)
commitb19c087aa7efac4bd11f0d49a5c37b09e1c4708e
tree06d3494325d9b3ccf258d9c5c2130364fa605ce3
parent52298507e816d928bc2dd4610cc317539bfae958
Lower certain build_vectors to insertps instructions

Summary:
Vectors built with zeros and elements in the same order as another
(source) vector are optimized to be built using a single insertps
instruction.
Also optimize when we move one element in a vector to a different place
in that vector while zeroing out some of the other elements.

Further optimizations are possible, described in TODO comments.
I will be implementing at least some of them in the near future.

Added some tests for different cases where this optimization triggers.

Reviewers: nadav, delena, craig.topper

Subscribers: llvm-commits

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

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