[X86] Teach how to combine horizontal binop even in the presence of undefs.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 19 Jun 2014 10:29:41 +0000 (10:29 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 19 Jun 2014 10:29:41 +0000 (10:29 +0000)
commitcfdf8052865b01e8b8d321640c3f51ff938cc3c4
tree65d2737c67d5032deb9efb9b6380d916fae819a7
parent83175090522ebd6513e45033c342200cd645f89c
[X86] Teach how to combine horizontal binop even in the presence of undefs.

Before this change, the backend was unable to fold a build_vector dag
node with UNDEF operands into a single horizontal add/sub.

This patch teaches how to combine a build_vector with UNDEF operands into a
horizontal add/sub when possible. The algorithm conservatively avoids to combine
a build_vector with only a single non-UNDEF operand.

Added test haddsub-undef.ll to verify that we correctly fold horizontal binop
even in the presence of UNDEFs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211265 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/haddsub-undef.ll [new file with mode: 0644]