1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Reapply "Add support for #pragma float_control" with improvements to

test cases
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

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

This reverts commit 85dc033caccaa6ab919d57f9759290be41240146, and makes
corrections to the test cases that failed on buildbots.
This commit is contained in:
Melanie Blower 2020-05-01 09:26:15 -07:00
parent b46eefe880
commit ffb5a5058c

View File

@ -244,6 +244,8 @@ public:
/// Get the flags to be applied to created floating point ops
FastMathFlags getFastMathFlags() const { return FMF; }
FastMathFlags &getFastMathFlags() { return FMF; }
/// Clear the fast-math flags.
void clearFastMathFlags() { FMF.clear(); }
@ -332,10 +334,16 @@ public:
IRBuilderBase &Builder;
FastMathFlags FMF;
MDNode *FPMathTag;
bool IsFPConstrained;
fp::ExceptionBehavior DefaultConstrainedExcept;
RoundingMode DefaultConstrainedRounding;
public:
FastMathFlagGuard(IRBuilderBase &B)
: Builder(B), FMF(B.FMF), FPMathTag(B.DefaultFPMathTag) {}
: Builder(B), FMF(B.FMF), FPMathTag(B.DefaultFPMathTag),
IsFPConstrained(B.IsFPConstrained),
DefaultConstrainedExcept(B.DefaultConstrainedExcept),
DefaultConstrainedRounding(B.DefaultConstrainedRounding) {}
FastMathFlagGuard(const FastMathFlagGuard &) = delete;
FastMathFlagGuard &operator=(const FastMathFlagGuard &) = delete;
@ -343,6 +351,9 @@ public:
~FastMathFlagGuard() {
Builder.FMF = FMF;
Builder.DefaultFPMathTag = FPMathTag;
Builder.IsFPConstrained = IsFPConstrained;
Builder.DefaultConstrainedExcept = DefaultConstrainedExcept;
Builder.DefaultConstrainedRounding = DefaultConstrainedRounding;
}
};