# HG changeset patch # User Tomas Lindquist Olsen # Date 1237915367 -3600 # Node ID 946fad6c96a1af0868faea8961ec38cff0282b5f # Parent d82cc6e5bb6537e8f4bc59848a3949c041e47b1a# Parent 4c8bb03e4fbc571b29bd7a3f1747c08f9e3307b6 merge diff -r d82cc6e5bb65 -r 946fad6c96a1 gen/tollvm.cpp --- a/gen/tollvm.cpp Tue Mar 24 18:22:29 2009 +0100 +++ b/gen/tollvm.cpp Tue Mar 24 18:22:47 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");