@@ -11744,7 +11744,7 @@ static bool isLegalToCombineMinNumMaxNum(SelectionDAG &DAG, SDValue LHS,
1174411744
1174511745 const TargetOptions &Options = DAG.getTarget().Options;
1174611746
11747- return ( Flags.hasNoSignedZeros() || Options.NoSignedZerosFPMath ) &&
11747+ return Flags.hasNoSignedZeros() &&
1174811748 TLI.isProfitableToCombineMinNumMaxNum(VT) &&
1174911749 (Flags.hasNoNaNs() ||
1175011750 (DAG.isKnownNeverNaN(RHS) && DAG.isKnownNeverNaN(LHS)));
@@ -17235,7 +17235,7 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1723517235 // Always prefer FMAD to FMA for precision.
1723617236 unsigned PreferredFusedOpcode = HasFMAD ? ISD::FMAD : ISD::FMA;
1723717237 bool Aggressive = TLI.enableAggressiveFMAFusion(VT);
17238- bool NoSignedZero = Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros();
17238+ bool NoSignedZero = Flags.hasNoSignedZeros();
1723917239
1724017240 // Is the node an FMUL and contractable either due to global flags or
1724117241 // SDNodeFlags.
@@ -17654,7 +17654,7 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
1765417654 // N0 + -0.0 --> N0 (also allowed with +0.0 and fast-math)
1765517655 ConstantFPSDNode *N1C = isConstOrConstSplatFP(N1, true);
1765617656 if (N1C && N1C->isZero())
17657- if (N1C->isNegative() || Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros())
17657+ if (N1C->isNegative() || Flags.hasNoSignedZeros())
1765817658 return N0;
1765917659
1766017660 if (SDValue NewSel = foldBinOpIntoSelect(N))
@@ -17710,8 +17710,7 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
1771017710 // If 'unsafe math' or reassoc and nsz, fold lots of things.
1771117711 // TODO: break out portions of the transformations below for which Unsafe is
1771217712 // considered and which do not require both nsz and reassoc
17713- if ((Options.NoSignedZerosFPMath ||
17714- (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros())) &&
17713+ if (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros() &&
1771517714 AllowNewConst) {
1771617715 // fadd (fadd x, c1), c2 -> fadd x, c1 + c2
1771717716 if (N1CFP && N0.getOpcode() == ISD::FADD &&
@@ -17797,8 +17796,7 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
1779717796 }
1779817797 } // enable-unsafe-fp-math && AllowNewConst
1779917798
17800- if ((Options.NoSignedZerosFPMath ||
17801- (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros()))) {
17799+ if (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros()) {
1780217800 // Fold fadd(vecreduce(x), vecreduce(y)) -> vecreduce(fadd(x, y))
1780317801 if (SDValue SD = reassociateReduction(ISD::VECREDUCE_FADD, ISD::FADD, DL,
1780417802 VT, N0, N1, Flags))
@@ -17869,8 +17867,7 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) {
1786917867
1787017868 // (fsub A, 0) -> A
1787117869 if (N1CFP && N1CFP->isZero()) {
17872- if (!N1CFP->isNegative() || Options.NoSignedZerosFPMath ||
17873- Flags.hasNoSignedZeros()) {
17870+ if (!N1CFP->isNegative() || Flags.hasNoSignedZeros()) {
1787417871 return N0;
1787517872 }
1787617873 }
@@ -17883,8 +17880,7 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) {
1788317880
1788417881 // (fsub -0.0, N1) -> -N1
1788517882 if (N0CFP && N0CFP->isZero()) {
17886- if (N0CFP->isNegative() ||
17887- (Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros())) {
17883+ if (N0CFP->isNegative() || Flags.hasNoSignedZeros()) {
1788817884 // We cannot replace an FSUB(+-0.0,X) with FNEG(X) when denormals are
1788917885 // flushed to zero, unless all users treat denorms as zero (DAZ).
1789017886 // FIXME: This transform will change the sign of a NaN and the behavior
@@ -17900,8 +17896,7 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) {
1790017896 }
1790117897 }
1790217898
17903- if ((Options.NoSignedZerosFPMath ||
17904- (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros())) &&
17899+ if (Flags.hasAllowReassociation() && Flags.hasNoSignedZeros() &&
1790517900 N1.getOpcode() == ISD::FADD) {
1790617901 // X - (X + Y) -> -Y
1790717902 if (N0 == N1->getOperand(0))
@@ -18220,7 +18215,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1822018215 // TODO: Finally migrate away from global TargetOptions.
1822118216 if ((Options.NoNaNsFPMath && Options.NoInfsFPMath) ||
1822218217 (N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs())) {
18223- if (Options.NoSignedZerosFPMath || N->getFlags().hasNoSignedZeros() ||
18218+ if (N->getFlags().hasNoSignedZeros() ||
1822418219 (N2CFP && !N2CFP->isExactlyValue(-0.0))) {
1822518220 if (N0CFP && N0CFP->isZero())
1822618221 return N2;
@@ -18525,8 +18520,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
1852518520 }
1852618521
1852718522 // Fold X/Sqrt(X) -> Sqrt(X)
18528- if ((Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros()) &&
18529- Flags.hasAllowReassociation())
18523+ if (Flags.hasNoSignedZeros() && Flags.hasAllowReassociation())
1853018524 if (N1.getOpcode() == ISD::FSQRT && N0 == N1.getOperand(0))
1853118525 return N1;
1853218526
@@ -18753,8 +18747,7 @@ static SDValue foldFPToIntToFP(SDNode *N, const SDLoc &DL, SelectionDAG &DAG,
1875318747 // FIXME: We should be able to use node-level FMF here.
1875418748 // TODO: If strict math, should we use FABS (+ range check for signed cast)?
1875518749 EVT VT = N->getValueType(0);
18756- if (!TLI.isOperationLegal(ISD::FTRUNC, VT) ||
18757- !DAG.getTarget().Options.NoSignedZerosFPMath)
18750+ if (!TLI.isOperationLegal(ISD::FTRUNC, VT))
1875818751 return SDValue();
1875918752
1876018753 // fptosi/fptoui round towards zero, so converting from FP to integer and
@@ -19195,9 +19188,8 @@ SDValue DAGCombiner::visitFNEG(SDNode *N) {
1919519188 // FIXME: This is duplicated in getNegatibleCost, but getNegatibleCost doesn't
1919619189 // know it was called from a context with a nsz flag if the input fsub does
1919719190 // not.
19198- if (N0.getOpcode() == ISD::FSUB &&
19199- (DAG.getTarget().Options.NoSignedZerosFPMath ||
19200- N->getFlags().hasNoSignedZeros()) && N0.hasOneUse()) {
19191+ if (N0.getOpcode() == ISD::FSUB && (N->getFlags().hasNoSignedZeros()) &&
19192+ N0.hasOneUse()) {
1920119193 return DAG.getNode(ISD::FSUB, SDLoc(N), VT, N0.getOperand(1),
1920219194 N0.getOperand(0));
1920319195 }
0 commit comments