summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-23 21:16:53 +0000
committerDale Johannesen <dalej@apple.com>2009-03-23 21:16:53 +0000
commit93eefa004308c8b3e1202cc3f9342526a3a378bd (patch)
treecda2caf113edd506150c199d404f1be45195d048 /llvm/lib/Bitcode/Writer
parent2441a7df96359e47f70814729f64c3bff664492f (diff)
downloadbcm5719-llvm-93eefa004308c8b3e1202cc3f9342526a3a378bd.tar.gz
bcm5719-llvm-93eefa004308c8b3e1202cc3f9342526a3a378bd.zip
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. llvm-svn: 67562
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 1055564be21..d4d3443ee05 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -559,10 +559,11 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
Record.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
} else if (Ty == Type::X86_FP80Ty) {
// api needed to prevent premature destruction
+ // bits are not in the same order as a normal i80 APInt, compensate.
APInt api = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
- Record.push_back(p[0]);
- Record.push_back((uint16_t)p[1]);
+ Record.push_back((p[1] << 48) | (p[0] >> 16));
+ Record.push_back(p[0] & 0xffffLL);
} else if (Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {
APInt api = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
OpenPOWER on IntegriCloud