@@ -50888,20 +50888,11 @@ static SDValue combineFaddCFmul(SDNode *N, SelectionDAG &DAG,
50888
50888
return DAG.getTarget().Options.NoSignedZerosFPMath ||
50889
50889
Flags.hasNoSignedZeros();
50890
50890
};
50891
- auto IsVectorAllNegativeZero = [](const SDNode *N) {
50892
- if (N->getOpcode() != X86ISD::VBROADCAST_LOAD)
50893
- return false;
50894
- assert(N->getSimpleValueType(0).getScalarType() == MVT::f32 &&
50895
- "Unexpected vector type!");
50896
- if (ConstantPoolSDNode *CP =
50897
- dyn_cast<ConstantPoolSDNode>(N->getOperand(1)->getOperand(0))) {
50898
- APInt AI = APInt(32, 0x80008000, true);
50899
- if (const auto *CI = dyn_cast<ConstantInt>(CP->getConstVal()))
50900
- return CI->getValue() == AI;
50901
- if (const auto *CF = dyn_cast<ConstantFP>(CP->getConstVal()))
50902
- return CF->getValue() == APFloat(APFloat::IEEEsingle(), AI);
50903
- }
50904
- return false;
50891
+ auto IsVectorAllNegativeZero = [&DAG](SDValue Op) {
50892
+ APInt AI = APInt(32, 0x80008000, true);
50893
+ KnownBits Bits = DAG.computeKnownBits(Op);
50894
+ return Bits.getBitWidth() == 32 && Bits.isConstant() &&
50895
+ Bits.getConstant() == AI;
50905
50896
};
50906
50897
50907
50898
if (N->getOpcode() != ISD::FADD || !Subtarget.hasFP16() ||
@@ -50933,7 +50924,7 @@ static SDValue combineFaddCFmul(SDNode *N, SelectionDAG &DAG,
50933
50924
if ((Opcode == X86ISD::VFMADDC || Opcode == X86ISD::VFCMADDC) &&
50934
50925
((ISD::isBuildVectorAllZeros(Op0->getOperand(2).getNode()) &&
50935
50926
HasNoSignedZero(Op0->getFlags())) ||
50936
- IsVectorAllNegativeZero(Op0->getOperand(2).getNode() ))) {
50927
+ IsVectorAllNegativeZero(Op0->getOperand(2)))) {
50937
50928
MulOp0 = Op0.getOperand(0);
50938
50929
MulOp1 = Op0.getOperand(1);
50939
50930
IsConj = Opcode == X86ISD::VFCMADDC;
0 commit comments