Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}. A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67562 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index d7f0d82..2ee6a27 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -2603,10 +2603,9 @@
}
uint64_t words[2];
- words[0] = ((uint64_t)(sign & 1) << 63) |
- ((myexponent & 0x7fffLL) << 48) |
- ((mysignificand >>16) & 0xffffffffffffLL);
- words[1] = mysignificand & 0xffff;
+ words[0] = mysignificand;
+ words[1] = ((uint64_t)(sign & 1) << 15) |
+ (myexponent & 0x7fffLL);
return APInt(80, 2, words);
}
@@ -2764,14 +2763,13 @@
assert(api.getBitWidth()==80);
uint64_t i1 = api.getRawData()[0];
uint64_t i2 = api.getRawData()[1];
- uint64_t myexponent = (i1 >> 48) & 0x7fff;
- uint64_t mysignificand = ((i1 << 16) & 0xffffffffffff0000ULL) |
- (i2 & 0xffff);
+ uint64_t myexponent = (i2 & 0x7fff);
+ uint64_t mysignificand = i1;
initialize(&APFloat::x87DoubleExtended);
assert(partCount()==2);
- sign = static_cast<unsigned int>(i1>>63);
+ sign = static_cast<unsigned int>(i2>>15);
if (myexponent==0 && mysignificand==0) {
// exponent, significand meaningless
category = fcZero;