[x86] Undo a flawed transform I added to form UNPCK instructions when
authorChandler Carruth <chandlerc@gmail.com>
Mon, 15 Sep 2014 10:35:41 +0000 (10:35 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 15 Sep 2014 10:35:41 +0000 (10:35 +0000)
commit04402a6c139cafaf01eeb20bae5f4f9ec6d0fd49
treefcdae6a306ef8a3612244e7342882ed5ddf825db
parenta6cc351c5b576ffadaaf00fb5b5771a2ac153160
[x86] Undo a flawed transform I added to form UNPCK instructions when
AVX is available, and generally tidy up things surrounding UNPCK
formation.

Originally, I was thinking that the only advantage of PSHUFD over UNPCK
instruction variants was its free copy, and otherwise we should use the
shorter encoding UNPCK instructions. This isn't right though, there is
a larger advantage of being able to fold a load into the operand of
a PSHUFD. For UNPCK, the operand *must* be in a register so it can be
the second input.

This removes the UNPCK formation in the target-specific DAG combine for
v4i32 shuffles. It also lifts the v8 and v16 cases out of the
AVX-specific check as they are potentially replacing multiple
instructions with a single instruction and so should always be valuable.
The floating point checks are simplified accordingly.

This also adjusts the formation of PSHUFD instructions to attempt to
match the shuffle mask to one which would fit an UNPCK instruction
variant. This was originally motivated to allow it to match the UNPCK
instructions in the combiner, but clearly won't now.

Eventually, we should add a MachineCombiner pass that can form UNPCK
instructions post-RA when the operand is known to be in a register and
thus there is no loss.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217755 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx-basic.ll
test/CodeGen/X86/avx-sext.ll
test/CodeGen/X86/avx-splat.ll
test/CodeGen/X86/exedepsfix-broadcast.ll
test/CodeGen/X86/vector-shuffle-128-v8.ll
test/CodeGen/X86/vector-shuffle-256-v4.ll