@@ -56448,10 +56448,8 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
56448
56448
// condition comes from the subtract node that produced -X. This matches the
56449
56449
// cmov expansion for absolute value. By swapping the operands we convert abs
56450
56450
// 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) {
56455
56453
if (N1.getOpcode() != X86ISD::CMOV || !N1.hasOneUse())
56456
56454
return SDValue();
56457
56455
@@ -56463,8 +56461,6 @@ static SDValue combineSubABS(SDNode *N, SelectionDAG &DAG) {
56463
56461
SDValue FalseOp = N1.getOperand(0);
56464
56462
SDValue TrueOp = N1.getOperand(1);
56465
56463
X86::CondCode CC = (X86::CondCode)N1.getConstantOperandVal(2);
56466
- MVT VT = N->getSimpleValueType(0);
56467
- SDLoc DL(N);
56468
56464
56469
56465
// ABS condition should come from a negate operation.
56470
56466
if ((CC == X86::COND_S || CC == X86::COND_NS) &&
@@ -56557,6 +56553,7 @@ static SDValue combineX86CloadCstore(SDNode *N, SelectionDAG &DAG) {
56557
56553
static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
56558
56554
TargetLowering::DAGCombinerInfo &DCI,
56559
56555
const X86Subtarget &Subtarget) {
56556
+ EVT VT = N->getValueType(0);
56560
56557
SDValue Op0 = N->getOperand(0);
56561
56558
SDValue Op1 = N->getOperand(1);
56562
56559
SDLoc DL(N);
@@ -56579,15 +56576,14 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
56579
56576
if (Op1.getOpcode() == ISD::XOR && IsNonOpaqueConstant(Op0) &&
56580
56577
!isNullConstant(Op0) && IsNonOpaqueConstant(Op1.getOperand(1)) &&
56581
56578
Op1->hasOneUse()) {
56582
- EVT VT = Op0.getValueType();
56583
56579
SDValue NewXor = DAG.getNode(ISD::XOR, SDLoc(Op1), VT, Op1.getOperand(0),
56584
56580
DAG.getNOT(SDLoc(Op1), Op1.getOperand(1), VT));
56585
56581
SDValue NewAdd =
56586
56582
DAG.getNode(ISD::ADD, DL, VT, Op0, DAG.getConstant(1, DL, VT));
56587
56583
return DAG.getNode(ISD::ADD, DL, VT, NewXor, NewAdd);
56588
56584
}
56589
56585
56590
- if (SDValue V = combineSubABS(N , DAG))
56586
+ if (SDValue V = combineSubABS(VT, DL, Op0, Op1 , DAG))
56591
56587
return V;
56592
56588
56593
56589
// Try to synthesize horizontal subs from subs of shuffles.
@@ -56609,8 +56605,7 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
56609
56605
assert(!Op1->hasAnyUseOfValue(1) && "Overflow bit in use");
56610
56606
SDValue ADC = DAG.getNode(X86ISD::ADC, SDLoc(Op1), Op1->getVTList(), Op0,
56611
56607
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));
56614
56609
}
56615
56610
56616
56611
if (SDValue V = combineXorSubCTLZ(N, DL, DAG, Subtarget))
0 commit comments