diff options
author | Craig Topper <craig.topper@intel.com> | 2018-03-15 20:30:54 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-03-15 20:30:54 +0000 |
commit | c3983c34cdf1655572aff3f12cfb77e629813dd4 (patch) | |
tree | 2272e604ebbb2daab012ef3d9594c7e35af73ab0 /llvm/lib | |
parent | 46502fa2efc29ca0bf64354a17701f677130a1a3 (diff) | |
download | bcm5719-llvm-c3983c34cdf1655572aff3f12cfb77e629813dd4.tar.gz bcm5719-llvm-c3983c34cdf1655572aff3f12cfb77e629813dd4.zip |
[X86] Make sure we use FSUB instruction as the reference for operand order in isAddSubOrSubAdd when recognizing subadd
The FADD part of the addsub/subadd pattern can have its operands commuted, but when checking for fsubadd we were using the fadd as reference and commuting the fsub node.
llvm-svn: 327660
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 8c681cd4de0..fb871266546 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -30494,10 +30494,18 @@ static bool isAddSubOrSubAdd(SDNode *N, const X86Subtarget &Subtarget, // Ensure that both operations have the same operands. Note that we can // commute the FADD operands. - SDValue LHS = V1->getOperand(0), RHS = V1->getOperand(1); - if ((V2->getOperand(0) != LHS || V2->getOperand(1) != RHS) && - (V2->getOperand(0) != RHS || V2->getOperand(1) != LHS)) - return false; + SDValue LHS, RHS; + if (ExpectedOpcode == ISD::FSUB) { + LHS = V1->getOperand(0); RHS = V1->getOperand(1); + if ((V2->getOperand(0) != LHS || V2->getOperand(1) != RHS) && + (V2->getOperand(0) != RHS || V2->getOperand(1) != LHS)) + return false; + } else { + LHS = V2->getOperand(0); RHS = V2->getOperand(1); + if ((V1->getOperand(0) != LHS || V1->getOperand(1) != RHS) && + (V1->getOperand(0) != RHS || V1->getOperand(1) != LHS)) + return false; + } // We're looking for blends between FADD and FSUB nodes. We insist on these // nodes being lined up in a specific expected pattern. |