@@ -56448,10 +56448,8 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
5644856448// condition comes from the subtract node that produced -X. This matches the
5644956449// cmov expansion for absolute value. By swapping the operands we convert abs
5645056450// to nabs.
56451- static SDValue combineSubABS(SDNode *N, SelectionDAG &DAG) {
56452- SDValue N0 = N->getOperand(0);
56453- SDValue N1 = N->getOperand(1);
56454-
56451+ static SDValue combineSubABS(EVT VT, const SDLoc &DL, SDValue N0, SDValue N1,
56452+ SelectionDAG &DAG) {
5645556453 if (N1.getOpcode() != X86ISD::CMOV || !N1.hasOneUse())
5645656454 return SDValue();
5645756455
@@ -56463,8 +56461,6 @@ static SDValue combineSubABS(SDNode *N, SelectionDAG &DAG) {
5646356461 SDValue FalseOp = N1.getOperand(0);
5646456462 SDValue TrueOp = N1.getOperand(1);
5646556463 X86::CondCode CC = (X86::CondCode)N1.getConstantOperandVal(2);
56466- MVT VT = N->getSimpleValueType(0);
56467- SDLoc DL(N);
5646856464
5646956465 // ABS condition should come from a negate operation.
5647056466 if ((CC == X86::COND_S || CC == X86::COND_NS) &&
@@ -56557,6 +56553,7 @@ static SDValue combineX86CloadCstore(SDNode *N, SelectionDAG &DAG) {
5655756553static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
5655856554 TargetLowering::DAGCombinerInfo &DCI,
5655956555 const X86Subtarget &Subtarget) {
56556+ EVT VT = N->getValueType(0);
5656056557 SDValue Op0 = N->getOperand(0);
5656156558 SDValue Op1 = N->getOperand(1);
5656256559 SDLoc DL(N);
@@ -56579,15 +56576,14 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
5657956576 if (Op1.getOpcode() == ISD::XOR && IsNonOpaqueConstant(Op0) &&
5658056577 !isNullConstant(Op0) && IsNonOpaqueConstant(Op1.getOperand(1)) &&
5658156578 Op1->hasOneUse()) {
56582- EVT VT = Op0.getValueType();
5658356579 SDValue NewXor = DAG.getNode(ISD::XOR, SDLoc(Op1), VT, Op1.getOperand(0),
5658456580 DAG.getNOT(SDLoc(Op1), Op1.getOperand(1), VT));
5658556581 SDValue NewAdd =
5658656582 DAG.getNode(ISD::ADD, DL, VT, Op0, DAG.getConstant(1, DL, VT));
5658756583 return DAG.getNode(ISD::ADD, DL, VT, NewXor, NewAdd);
5658856584 }
5658956585
56590- if (SDValue V = combineSubABS(N , DAG))
56586+ if (SDValue V = combineSubABS(VT, DL, Op0, Op1 , DAG))
5659156587 return V;
5659256588
5659356589 // Try to synthesize horizontal subs from subs of shuffles.
@@ -56609,8 +56605,7 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
5660956605 assert(!Op1->hasAnyUseOfValue(1) && "Overflow bit in use");
5661056606 SDValue ADC = DAG.getNode(X86ISD::ADC, SDLoc(Op1), Op1->getVTList(), Op0,
5661156607 Op1.getOperand(1), Op1.getOperand(2));
56612- return DAG.getNode(ISD::SUB, DL, Op0.getValueType(), ADC.getValue(0),
56613- Op1.getOperand(0));
56608+ return DAG.getNode(ISD::SUB, DL, VT, ADC.getValue(0), Op1.getOperand(0));
5661456609 }
5661556610
5661656611 if (SDValue V = combineXorSubCTLZ(N, DL, DAG, Subtarget))
0 commit comments