From 1b25cb2416c46a6cebf2a6c52235e9fe46a10d11 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Mon, 23 Mar 2009 21:16:53 +0000 Subject: 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 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 1055564be2..d4d3443ee0 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/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(); -- cgit v1.2.3-18-g5258