[X86] Lower VSELECT into SHRUNKBLEND when we shrink the bits used into the
authorQuentin Colombet <qcolombet@apple.com>
Thu, 6 Nov 2014 02:25:03 +0000 (02:25 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 6 Nov 2014 02:25:03 +0000 (02:25 +0000)
commitd465eced34ef00f8babc90f6c8b58af59b20d508
tree7b3130c967923b6ac0c1fda3c008244731034a9a
parent4ebcbd0af758f772d1caeaba0d0b5eb68e7e9280
[X86] Lower VSELECT into SHRUNKBLEND when we shrink the bits used into the
condition to match a blend.
This prevents optimizations that work on VSELECT to perform invalid
transformations. Indeed, the optimized condition does not match the vector
boolean content that is expected and bad things may happen.

This patch yields the exact same code on the whole test-suite + specs (-O3 and
-O3 -march=core-avx2), it improves one test case (vector-blend.ll) and fixes a
bug reduced in vselect-avx.ll.

<rdar://problem/18819506>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221429 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
test/CodeGen/X86/vector-blend.ll
test/CodeGen/X86/vselect-avx.ll