@@ -397,7 +397,7 @@ struct SDNodeFlags {
397397 Exact = 1 << 2 ,
398398 Disjoint = 1 << 3 ,
399399 NonNeg = 1 << 4 ,
400- NoNaNs = 1 << 5 ,
400+ // 1 << 5 was used as NoNaNs
401401 NoInfs = 1 << 6 ,
402402 NoSignedZeros = 1 << 7 ,
403403 AllowReciprocal = 1 << 8 ,
@@ -416,19 +416,23 @@ struct SDNodeFlags {
416416 // Compare instructions which may carry the samesign flag.
417417 SameSign = 1 << 14 ,
418418
419+ NoSNaNs = 1 << 15 ,
420+ NoQNaNs = 1 << 16 ,
421+
419422 // NOTE: Please update LargestValue in LLVM_DECLARE_ENUM_AS_BITMASK below
420423 // the class definition when adding new flags.
421424
422425 PoisonGeneratingFlags = NoUnsignedWrap | NoSignedWrap | Exact | Disjoint |
423- NonNeg | NoNaNs | NoInfs | SameSign,
426+ NonNeg | NoSNaNs | NoQNaNs | NoInfs | SameSign,
424427 };
425428
426429 // / Default constructor turns off all optimization flags.
427430 SDNodeFlags (unsigned Flags = SDNodeFlags::None) : Flags(Flags) {}
428431
429432 // / Propagate the fast-math-flags from an IR FPMathOperator.
430433 void copyFMF (const FPMathOperator &FPMO) {
431- setNoNaNs (FPMO.hasNoNaNs ());
434+ setNoSNaNs (FPMO.hasNoNaNs ());
435+ setNoQNaNs (FPMO.hasNoNaNs ());
432436 setNoInfs (FPMO.hasNoInfs ());
433437 setNoSignedZeros (FPMO.hasNoSignedZeros ());
434438 setAllowReciprocal (FPMO.hasAllowReciprocal ());
@@ -444,7 +448,9 @@ struct SDNodeFlags {
444448 void setDisjoint (bool b) { setFlag<Disjoint>(b); }
445449 void setSameSign (bool b) { setFlag<SameSign>(b); }
446450 void setNonNeg (bool b) { setFlag<NonNeg>(b); }
447- void setNoNaNs (bool b) { setFlag<NoNaNs>(b); }
451+ void setNoNaNs (bool b) { setFlag<NoSNaNs>(b); setFlag<NoQNaNs>(b); }
452+ void setNoSNaNs (bool b) { setFlag<NoSNaNs>(b); }
453+ void setNoQNaNs (bool b) { setFlag<NoQNaNs>(b); }
448454 void setNoInfs (bool b) { setFlag<NoInfs>(b); }
449455 void setNoSignedZeros (bool b) { setFlag<NoSignedZeros>(b); }
450456 void setAllowReciprocal (bool b) { setFlag<AllowReciprocal>(b); }
@@ -461,7 +467,9 @@ struct SDNodeFlags {
461467 bool hasDisjoint () const { return Flags & Disjoint; }
462468 bool hasSameSign () const { return Flags & SameSign; }
463469 bool hasNonNeg () const { return Flags & NonNeg; }
464- bool hasNoNaNs () const { return Flags & NoNaNs; }
470+ bool hasNoNaNs () const { return (Flags & NoSNaNs) && (Flags & NoQNaNs); }
471+ bool hasNoSNaNs () const { return Flags & NoSNaNs; }
472+ bool hasNoQNaNs () const { return Flags & NoQNaNs; }
465473 bool hasNoInfs () const { return Flags & NoInfs; }
466474 bool hasNoSignedZeros () const { return Flags & NoSignedZeros; }
467475 bool hasAllowReciprocal () const { return Flags & AllowReciprocal; }
0 commit comments