@@ -36836,12 +36836,23 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
36836
36836
break;
36837
36837
}
36838
36838
case X86ISD::PSADBW: {
36839
+ SDValue LHS = Op.getOperand(0);
36840
+ SDValue RHS = Op.getOperand(1);
36839
36841
assert(VT.getScalarType() == MVT::i64 &&
36840
- Op.getOperand(0).getValueType().getScalarType() == MVT::i8 &&
36842
+ LHS.getValueType() == RHS.getValueType() &&
36843
+ LHS.getValueType().getScalarType() == MVT::i8 &&
36841
36844
"Unexpected PSADBW types");
36842
36845
36843
- // PSADBW - fills low 16 bits and zeros upper 48 bits of each i64 result.
36844
- Known.Zero.setBitsFrom(16);
36846
+ KnownBits Known2;
36847
+ unsigned NumSrcElts = LHS.getValueType().getVectorNumElements();
36848
+ APInt DemandedSrcElts = APIntOps::ScaleBitMask(DemandedElts, NumSrcElts);
36849
+ Known = DAG.computeKnownBits(RHS, DemandedSrcElts, Depth + 1);
36850
+ Known2 = DAG.computeKnownBits(LHS, DemandedSrcElts, Depth + 1);
36851
+ Known = KnownBits::absdiff(Known, Known2).zext(16);
36852
+ Known = KnownBits::computeForAddSub(true, true, Known, Known);
36853
+ Known = KnownBits::computeForAddSub(true, true, Known, Known);
36854
+ Known = KnownBits::computeForAddSub(true, true, Known, Known);
36855
+ Known = Known.zext(64);
36845
36856
break;
36846
36857
}
36847
36858
case X86ISD::PCMPGT:
@@ -54853,6 +54864,7 @@ static SDValue combineSub(SDNode *N, SelectionDAG &DAG,
54853
54864
}
54854
54865
54855
54866
static SDValue combineVectorCompare(SDNode *N, SelectionDAG &DAG,
54867
+ TargetLowering::DAGCombinerInfo &DCI,
54856
54868
const X86Subtarget &Subtarget) {
54857
54869
MVT VT = N->getSimpleValueType(0);
54858
54870
SDLoc DL(N);
@@ -54864,6 +54876,11 @@ static SDValue combineVectorCompare(SDNode *N, SelectionDAG &DAG,
54864
54876
return DAG.getConstant(0, DL, VT);
54865
54877
}
54866
54878
54879
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
54880
+ if (TLI.SimplifyDemandedBits(
54881
+ SDValue(N, 0), APInt::getAllOnes(VT.getScalarSizeInBits()), DCI))
54882
+ return SDValue(N, 0);
54883
+
54867
54884
return SDValue();
54868
54885
}
54869
54886
@@ -56587,7 +56604,7 @@ SDValue X86TargetLowering::PerformDAGCombine(SDNode *N,
56587
56604
case ISD::MGATHER:
56588
56605
case ISD::MSCATTER: return combineGatherScatter(N, DAG, DCI);
56589
56606
case X86ISD::PCMPEQ:
56590
- case X86ISD::PCMPGT: return combineVectorCompare(N, DAG, Subtarget);
56607
+ case X86ISD::PCMPGT: return combineVectorCompare(N, DAG, DCI, Subtarget);
56591
56608
case X86ISD::PMULDQ:
56592
56609
case X86ISD::PMULUDQ: return combinePMULDQ(N, DAG, DCI, Subtarget);
56593
56610
case X86ISD::VPMADDUBSW:
0 commit comments