]> granicus.if.org Git - llvm/commit
[x86] lower extracted add/sub to horizontal vector math
authorSanjay Patel <spatel@rotateright.com>
Mon, 14 Jan 2019 18:44:02 +0000 (18:44 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 14 Jan 2019 18:44:02 +0000 (18:44 +0000)
commitc0b52ffd9cce081b5011011d9bf389ca259b152b
tree22aa5f452d687dd4fda0aeeefa7085be90ca2766
parentad1cf6ea639aebb3d2f682fb40bc0aaa3a75007a
[x86] lower extracted add/sub to horizontal vector math

add (extractelt (X, 0), extractelt (X, 1)) --> extractelt (hadd X, X), 0

This is the integer sibling to D56011.

There's an additional restriction to only to do this transform in the
case where we don't have extra extracts from the source vector. Without
that, we can fail to match larger horizontal patterns that are more
beneficial than this minimal case. An improvement to the more general
h-op lowering may allow us to remove the restriction here in a follow-up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351093 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/haddsub-undef.ll
test/CodeGen/X86/phaddsub-extract.ll
test/CodeGen/X86/phaddsub-undef.ll