From 479b97ca871baa1f154bcbb7b1ec8e3f450ae81a Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Tue, 24 Mar 2009 15:24:59 +0100 Subject: [PATCH 1/2] 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) --- gen/tollvm.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index c9397ec8..dc20e35d 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -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 @@ llvm::ConstantFP* DtoConstFP(Type* t, long double value) 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"); From 187e3c926e8c7c2bba0e2902cb4b405d52686367 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Tue, 24 Mar 2009 18:22:29 +0100 Subject: [PATCH 2/2] Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 452087fb..4938eeda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,10 +15,12 @@ if(NOT PKG_CONFIG_FOUND) else(NOT PKG_CONFIG_FOUND) pkg_search_module(LIBCONFIGPP libconfig++) if(NOT LIBCONFIGPP_FOUND) - message(FATAL_ERROR "libconfig++ not found") + set(LIBCONFIG_CXXFLAGS "" CACHE STRING "libconfig++ compiler flags") + set(LIBCONFIG_LDFLAGS "" CACHE STRING "libconfig++ linker flags") + else(NOT LIBCONFIGPP_FOUND) + set(LIBCONFIG_CXXFLAGS ${LIBCONFIGPP_CFLAGS} CACHE STRING "libconfig++ compiler flags") + set(LIBCONFIG_LDFLAGS ${LIBCONFIGPP_LDFLAGS} CACHE STRING "libconfig++ linker flags") endif(NOT LIBCONFIGPP_FOUND) - set(LIBCONFIG_CXXFLAGS ${LIBCONFIGPP_CFLAGS} CACHE STRING "libconfig++ compiler flags") - set(LIBCONFIG_LDFLAGS ${LIBCONFIGPP_LDFLAGS} CACHE STRING "libconfig++ linker flags") endif(NOT PKG_CONFIG_FOUND)