|
@@ -704,8 +704,8 @@ static char isNegatibleForFree(SDValue Op, bool LegalOperations,
|
|
|
TLI.isFPImmLegal(neg(cast<ConstantFPSDNode>(Op)->getValueAPF()), VT);
|
|
|
}
|
|
|
case ISD::FADD:
|
|
|
- // FIXME: determine better conditions for this xform.
|
|
|
- if (!Options->UnsafeFPMath) return 0;
|
|
|
+ if (!Options->UnsafeFPMath && !Flags.hasNoSignedZeros())
|
|
|
+ return 0;
|
|
|
|
|
|
// After operation legalization, it might not be legal to create new FSUBs.
|
|
|
if (LegalOperations && !TLI.isOperationLegalOrCustom(ISD::FSUB, VT))
|
|
@@ -766,8 +766,7 @@ static SDValue GetNegatedExpression(SDValue Op, SelectionDAG &DAG,
|
|
|
return DAG.getConstantFP(V, SDLoc(Op), Op.getValueType());
|
|
|
}
|
|
|
case ISD::FADD:
|
|
|
- // FIXME: determine better conditions for this xform.
|
|
|
- assert(Options.UnsafeFPMath);
|
|
|
+ assert(Options.UnsafeFPMath || Flags.hasNoSignedZeros());
|
|
|
|
|
|
// fold (fneg (fadd A, B)) -> (fsub (fneg A), B)
|
|
|
if (isNegatibleForFree(Op.getOperand(0), LegalOperations,
|