aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/IR/FPEnv.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/IR/FPEnv.h')
-rw-r--r--llvm/include/llvm/IR/FPEnv.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/FPEnv.h b/llvm/include/llvm/IR/FPEnv.h
index f00cb735932f..621540000b5c 100644
--- a/llvm/include/llvm/IR/FPEnv.h
+++ b/llvm/include/llvm/IR/FPEnv.h
@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_IR_FLOATINGPOINT_H
-#define LLVM_IR_FLOATINGPOINT_H
+#ifndef LLVM_IR_FPENV_H
+#define LLVM_IR_FPENV_H
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/Optional.h"
@@ -52,5 +52,11 @@ Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef);
/// For any ExceptionBehavior enumerator, returns a string valid as
/// input in constrained intrinsic exception behavior metadata.
Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior);
+
+/// Returns true if the exception handling behavior and rounding mode
+/// match what is used in the default floating point environment.
+inline bool isDefaultFPEnvironment(fp::ExceptionBehavior EB, RoundingMode RM) {
+ return EB == fp::ebIgnore && RM == RoundingMode::NearestTiesToEven;
+}
}
#endif