aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/TargetInfo.h6
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index ca8ac8c6a0..cd71759440 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -36,6 +36,8 @@ protected:
// values are specified by the TargetInfo constructor.
bool CharIsSigned;
unsigned WCharWidth, WCharAlign;
+ unsigned DoubleWidth, DoubleAlign;
+
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
// TargetInfo Constructor. Default initializes all fields.
@@ -103,8 +105,8 @@ public:
const llvm::fltSemantics *getFloatFormat() const { return FloatFormat; }
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
- unsigned getDoubleWidth() const { return 64; } // FIXME
- unsigned getDoubleAlign() const { return 32; } // FIXME
+ unsigned getDoubleWidth() const { return DoubleWidth; }
+ unsigned getDoubleAlign() const { return DoubleAlign; }
const llvm::fltSemantics *getDoubleFormat() const { return DoubleFormat; }
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index d594cbc735..2fcdb1530f 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -215,7 +215,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
static_cast<unsigned>(Context.getTypeSize(T)));
case BuiltinType::Float: return llvm::Type::FloatTy;
- case BuiltinType::Double: return llvm::Type::DoubleTy;
+ case BuiltinType::Double:
+ return (Context.Target.getDoubleFormat() == &llvm::APFloat::IEEEdouble) ?
+ llvm::Type::DoubleTy : llvm::Type::FloatTy;
case BuiltinType::LongDouble:
// FIXME: mapping long double onto double.
return llvm::Type::DoubleTy;