[X86] Refactor the logic to select horizontal adds/subs to a helper function.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 11 Jun 2014 07:57:50 +0000 (07:57 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 11 Jun 2014 07:57:50 +0000 (07:57 +0000)
commita069e641128d852b0fdd4e8e49b0cbc40f004aec
tree63679f9904297ab26c58315c609109c5f18833bf
parente65c40320b1e9cda26e7ea3c7f16c6f97a0f2be6
[X86] Refactor the logic to select horizontal adds/subs to a helper function.

This patch moves part of the logic implemented by the target specific
combine rules added at r210477 to a separate helper function.
This should make easier to add more rules for matching AVX/AVX2 horizontal
adds/subs.

This patch also fixes a problem caused by a wrong check performed on indices
of extract_vector_elt dag nodes in input to the scalar adds/subs.

New tests have been added to verify that we correctly check indices of
extract_vector_elt dag nodes when selecting a horizontal operation.

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