[x86] Fix a crasher due to shuffles which cancel each other out and add
authorChandler Carruth <chandlerc@gmail.com>
Tue, 5 Aug 2014 18:45:49 +0000 (18:45 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 5 Aug 2014 18:45:49 +0000 (18:45 +0000)
commita746239be3092c7b27d7e9b3cc81bd612bf641d5
tree1014b3600dac09aec51489ccb0bd8e3bdcebf8eb
parent70db9d4d725647d682bbd4fba7fd0caf4d29b715
[x86] Fix a crasher due to shuffles which cancel each other out and add
a test case.

We also miscompile this test case which is showing a serious flaw in the
single-input v8i16 shuffle code. I've left the specific instruction
checks FIXME-ed out until I can address the bug in the single-input
code, but I wanted to separate out a significant functionality change to
produce correct code from a very simple and targeted crasher fix.

The miscompile problem stems from keeping track of inputs by value
rather than by index. As a consequence of doing this, we can't reliably
update those inputs because they might swap and we can't detect this
without copying the mask.

The blend code now uses indices for the input lists and this seems
strictly better. It also should make it easier to sort things and do
other cleanups. I think the time has come to simplify The Great Lambda
here.

llvm-svn: 214914
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-shuffle-128-v8.ll