[X86] Move integer hadd/hsub formation into a helper function shared by combineAdd...
authorCraig Topper <craig.topper@intel.com>
Thu, 16 Jul 2020 19:52:02 +0000 (12:52 -0700)
committerCraig Topper <craig.topper@intel.com>
Thu, 16 Jul 2020 20:27:27 +0000 (13:27 -0700)
commit5408024fa87e0b23b169fec07913bd4357acdbc4
treed6470227b62611c93ae81ec0a5ff4ee0dd06b22a
parentf78d9fceea736d431e9e3cbca291e3909e3aa46d
[X86] Move integer hadd/hsub formation into a helper function shared by combineAdd and combineSub.

There was a lot of duplicate code here for checking the VT and
subtarget. Moving it into a helper avoids that.

It also fixes a bug that combineAdd reused Op0/Op1 after a call
to isHorizontalBinOp may have changed it. The new helper function
has its own local version of Op0/Op1 that aren't shared by other
code.

Fixes PR46455.

Reviewed By: spatel, bkramer

Differential Revision: https://reviews.llvm.org/D83971
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pr46455.ll