[PATCH] D47323: FastMathFlags: Make it easier to unset individual ones.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 24 08:19:40 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333192: FastMathFlags: Make it easier to unset individual ones. (authored by nzaghen, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47323?vs=148400&id=148418#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47323
Files:
llvm/trunk/include/llvm/IR/Operator.h
Index: llvm/trunk/include/llvm/IR/Operator.h
===================================================================
--- llvm/trunk/include/llvm/IR/Operator.h
+++ llvm/trunk/include/llvm/IR/Operator.h
@@ -207,17 +207,28 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47323.148418.patch
Type: text/x-patch
Size: 1595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180524/50a923ee/attachment.bin>
More information about the llvm-commits
mailing list