convertToSignExtendedInteger should return opInvalidOp instead of asserting if sematics of float does not allow arithmetics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60042 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index a65e55a..128fee4 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -117,6 +117,11 @@
&& "Compile-time arithmetic does not support these semantics");
}
+ static inline bool
+ isArithmeticOk(const llvm::fltSemantics &semantics) {
+ return semantics.arithmeticOK;
+ }
+
/* Return the value of a decimal exponent of the form
[+-]ddddddd.
@@ -1787,7 +1792,8 @@
const integerPart *src;
unsigned int dstPartsCount, truncatedBits;
- assertArithmeticOK(*semantics);
+ if (!isArithmeticOk(*semantics))
+ return opInvalidOp;
*isExact = false;