FastMathFlags: Make it easier to unset individual ones.

This makes the various flags similar to current setAllowContract.

Differential Revision: https://reviews.llvm.org/D47323

llvm-svn: 333192
This commit is contained in:
Nicola Zaghen 2018-05-24 15:15:27 +00:00
parent 0c72316a21
commit 451f6c8680
1 changed files with 20 additions and 9 deletions

View File

@ -207,17 +207,28 @@ public:
bool isFast() const { return all(); }
/// Flag setters
void setAllowReassoc() { Flags |= AllowReassoc; }
void setNoNaNs() { Flags |= NoNaNs; }
void setNoInfs() { Flags |= NoInfs; }
void setNoSignedZeros() { Flags |= NoSignedZeros; }
void setAllowReciprocal() { Flags |= AllowReciprocal; }
// TODO: Change the other set* functions to take a parameter?
void setAllowContract(bool B) {
void setAllowReassoc(bool B = true) {
Flags = (Flags & ~AllowReassoc) | B * AllowReassoc;
}
void setNoNaNs(bool B = true) {
Flags = (Flags & ~NoNaNs) | B * NoNaNs;
}
void setNoInfs(bool B = true) {
Flags = (Flags & ~NoInfs) | B * NoInfs;
}
void setNoSignedZeros(bool B = true) {
Flags = (Flags & ~NoSignedZeros) | B * NoSignedZeros;
}
void setAllowReciprocal(bool B = true) {
Flags = (Flags & ~AllowReciprocal) | B * AllowReciprocal;
}
void setAllowContract(bool B = true) {
Flags = (Flags & ~AllowContract) | B * AllowContract;
}
void setApproxFunc() { Flags |= ApproxFunc; }
void setFast() { set(); }
void setApproxFunc(bool B = true) {
Flags = (Flags & ~ApproxFunc) | B * ApproxFunc;
}
void setFast(bool B = true) { B ? set() : clear(); }
void operator&=(const FastMathFlags &OtherFlags) {
Flags &= OtherFlags.Flags;