Mercurial > projects > ldc
changeset 1138:4c8bb03e4fbc
Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 24 Mar 2009 15:24:59 +0100 |
parents | 45d73f0a9b43 |
children | 946fad6c96a1 |
files | gen/tollvm.cpp |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/tollvm.cpp Tue Mar 24 14:34:16 2009 +0100 +++ b/gen/tollvm.cpp Tue Mar 24 15:24:59 2009 +0100 @@ -20,6 +20,7 @@ #include "gen/complex.h" #include "gen/llvmhelpers.h" #include "gen/linkage.h" +#include "gen/llvm-version.h" bool DtoIsPassedByRef(Type* type) { @@ -521,8 +522,16 @@ return LLConstantFP::get(llty, value); else if(llty == LLType::X86_FP80Ty) { uint64_t bits[] = {0, 0}; + #if LLVM_REV < 67562 + // Prior to r67562, the i80 APInt format expected by the APFloat + // constructor was different than the memory layout on the actual + // processor. bits[1] = *(uint16_t*)&value; bits[0] = *(uint64_t*)((uint16_t*)&value + 1); + #else + bits[0] = *(uint64_t*)&value; + bits[1] = *(uint16_t*)((uint64_t*)&value + 1); + #endif return LLConstantFP::get(APFloat(APInt(80, 2, bits))); } else { assert(0 && "Unknown floating point type encountered");