[x86] Teach the new vector shuffle lowering how to lower 128-bit
authorChandler Carruth <chandlerc@gmail.com>
Sun, 5 Oct 2014 11:41:36 +0000 (11:41 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 5 Oct 2014 11:41:36 +0000 (11:41 +0000)
commita644b090deabb4500a3f6c8610435a35aac0136a
treebdf2753caa69c57ec44806d1084aa6ac2199d57d
parent529fcbed326096b01bd27cff964fbd1aeec27be5
[x86] Teach the new vector shuffle lowering how to lower 128-bit
shuffles using AVX and AVX2 instructions. This fixes PR21138, one of the
few remaining regressions impacting benchmarks from the new vector
shuffle lowering.

You may note that it "regresses" many of the vperm2x128 test cases --
these were actually "improved" by the naive lowering that the new
shuffle lowering previously did. This regression gave me fits. I had
this patch ready-to-go about an hour after flipping the switch but
wasn't sure how to have the best of both worlds here and thought the
correct solution might be a completely different approach to lowering
these vector shuffles.

I'm now convinced this is the correct lowering and the missed
optimizations shown in vperm2x128 are actually due to missing
target-independent DAG combines. I've even written most of the needed
DAG combine and will submit it shortly, but this part is ready and
should help some real-world benchmarks out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219079 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx-vperm2x128.ll
test/CodeGen/X86/avx512-build-vector.ll
test/CodeGen/X86/vector-shuffle-256-v4.ll
test/CodeGen/X86/vector-shuffle-512-v8.ll