[X86] Fix a bug in the lowering of BLENDI introduced in r209043.
authorQuentin Colombet <qcolombet@apple.com>
Wed, 21 May 2014 22:00:39 +0000 (22:00 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Wed, 21 May 2014 22:00:39 +0000 (22:00 +0000)
commitfd0096a42c6d21e922e99669b1752a03987ebc84
treeac0cf379547a9df9e459becef1b32e81f5368a91
parentd1b5bdaebdcdfc85854e6dac538bcc273b6a486a
[X86] Fix a bug in the lowering of BLENDI introduced in r209043.
ISD::VSELECT mask uses 1 to identify the first argument and 0 to identify the
second argument.
On the other hand, BLENDI uses 0 to identify the first argument and 1 to
identify the second argument.
Fix the generation of the blend mask to account for this difference.

The bug did not show up with r209043, because we were not checking for the
actual arguments of the blend instruction!
This commit also fixes the test cases.

Note: The same mask works for the BLENDr variant because the arguments are
swapped during instruction selection (see the BLENDXXrr patterns).

<rdar://problem/16975435>

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