forked from OSchip/llvm-project
[X86] Add support for matching paddus patterns where one of the vectors is a constant.
InstCombine mucks these up a bit. So we need to do some additional pattern matching to fix it. There are a still a few special cases not handled, but this covers the general case. Differential Revision: https://reviews.llvm.org/D50952 llvm-svn: 340756
This commit is contained in:
parent
271ce76352
commit
fff90377fd
|
@ -33125,6 +33125,20 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
|
|||
(OpLHS == CondLHS || OpRHS == CondLHS))
|
||||
return SplitOpsAndApply(DAG, Subtarget, DL, VT, { OpLHS, OpRHS },
|
||||
ADDUSBuilder);
|
||||
|
||||
if (isa<BuildVectorSDNode>(OpRHS) && isa<BuildVectorSDNode>(CondRHS) &&
|
||||
CondLHS == OpLHS) {
|
||||
// If the RHS is a constant we have to reverse the const
|
||||
// canonicalization.
|
||||
// x > ~C ? x+C : ~0 --> addus x, C
|
||||
auto MatchADDUS = [](ConstantSDNode *Op, ConstantSDNode *Cond) {
|
||||
return Cond->getAPIntValue() == ~Op->getAPIntValue();
|
||||
};
|
||||
if (CC == ISD::SETULE &&
|
||||
ISD::matchBinaryPredicate(OpRHS, CondRHS, MatchADDUS))
|
||||
return SplitOpsAndApply(DAG, Subtarget, DL, VT, { OpLHS, OpRHS },
|
||||
ADDUSBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue