[x86] Fix the new vector shuffle lowering's use of VSELECT for AVX2
authorChandler Carruth <chandlerc@gmail.com>
Sun, 28 Sep 2014 23:23:55 +0000 (23:23 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 28 Sep 2014 23:23:55 +0000 (23:23 +0000)
commit4f4280469cf68e6d4eb3ba4382b532fd0fe78b64
tree8fc6ce8a83c60f100a27aad5c16ff1727ba955c5
parent0df40b4969c660f9e22f24e4bcf423d99bf13966
[x86] Fix the new vector shuffle lowering's use of VSELECT for AVX2
lowerings.

This was hopelessly broken. First, the x86 backend wants '-1' to be the
element value representing true in a boolean vector, and second the
operand order for VSELECT is backwards from the actual x86 instructions.
To make matters worse, the backend is just using '-1' as the true value
to get the high bit to be set. It doesn't actually symbolically map the
'-1' to anything. But on x86 this isn't quite how it works: there *only*
the high bit is relevant. As a consequence weird non-'-1' values like
0x80 actually "work" once you flip the operands to be backwards.

Anyways, thanks to Hal for helping me sort out what these *should* be.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218582 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vector-shuffle-256-v16.ll
test/CodeGen/X86/vector-shuffle-256-v32.ll