aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/APFloatTest.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2020-09-30 13:55:01 -0700
committerCraig Topper <craig.topper@intel.com>2020-09-30 16:07:15 -0700
commitb23916504a1a9f29c7519ed83813774eecce1789 (patch)
treebc9370203c178cb91dc52efefb72b26cdd3ea42c /llvm/unittests/ADT/APFloatTest.cpp
parent66d2e3f495948412602db4507359b4612639e523 (diff)
downloadllvm-b23916504a1a9f29c7519ed83813774eecce1789.zip
llvm-b23916504a1a9f29c7519ed83813774eecce1789.tar.gz
llvm-b23916504a1a9f29c7519ed83813774eecce1789.tar.bz2
Patch IEEEFloat::isSignificandAllZeros and IEEEFloat::isSignificandAllOnes (bug 34579)
Patch IEEEFloat::isSignificandAllZeros and IEEEFloat::isSignificandAllOnes to behave correctly in the case that the size of the significand is a multiple of the width of the integerParts making up the significand. The patch to IEEEFloat::isSignificandAllOnes fixes bug 34579, and the patch to IEEE:Float:isSignificandAllZeros fixes the unit test "APFloatTest.x87Next" I added here. I have included both in this diff since the changes are very similar. Patch by Andrew Briand
Diffstat (limited to 'llvm/unittests/ADT/APFloatTest.cpp')
-rw-r--r--llvm/unittests/ADT/APFloatTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp
index 4cd027d..475ad83 100644
--- a/llvm/unittests/ADT/APFloatTest.cpp
+++ b/llvm/unittests/ADT/APFloatTest.cpp
@@ -4696,4 +4696,15 @@ TEST(APFloatTest, PPCDoubleDoubleFrexp) {
EXPECT_EQ(0x3fe8000000000000ull, Result.bitcastToAPInt().getRawData()[0]);
EXPECT_EQ(0x3c98000000000000ull, Result.bitcastToAPInt().getRawData()[1]);
}
+
+TEST(APFloatTest, x87Largest) {
+ APFloat MaxX87Val = APFloat::getLargest(APFloat::x87DoubleExtended());
+ EXPECT_TRUE(MaxX87Val.isLargest());
+}
+
+TEST(APFloatTest, x87Next) {
+ APFloat F(APFloat::x87DoubleExtended(), "-1.0");
+ F.next(false);
+ EXPECT_TRUE(ilogb(F) == -1);
+}
}