[X86][SSE] Fold scalar horizontal add/sub for non-0/1 element extractions
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 1 May 2019 17:13:35 +0000 (17:13 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 1 May 2019 17:13:35 +0000 (17:13 +0000)
commit9f04d97cd71a4248e3d064d6d194699e688d1358
tree496a313f5bfb2e3492817b744721fc8bca109244
parentfa78ad57edfd2fec2882c0ca1dbd7eec34051844
[X86][SSE] Fold scalar horizontal add/sub for non-0/1 element extractions

We already perform horizontal add/sub if we extract from elements 0 and 1, this patch extends it to non-0/1 element extraction indices (as long as they are from the lowest 128-bit vector).

Differential Revision: https://reviews.llvm.org/D61263

llvm-svn: 359707
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/haddsub.ll
llvm/test/CodeGen/X86/phaddsub-extract.ll