From 7890a01263d986820bc009922d9eaccc10e11510 Mon Sep 17 00:00:00 2001 From: Yaron Keren Date: Wed, 19 Aug 2015 17:02:32 +0000 Subject: [PATCH] According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes. See https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html llvm-svn: 245459 --- clang/lib/Basic/Targets.cpp | 3 ++- clang/test/CodeGen/mingw-long-double-size.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGen/mingw-long-double-size.c diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 081b4caafd27..4143b8748ea6 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3785,7 +3785,8 @@ class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo { public: MinGWX86_32TargetInfo(const llvm::Triple &Triple) : WindowsX86_32TargetInfo(Triple) { - LongDoubleWidth = LongDoubleAlign = 128; + LongDoubleWidth = 96; + LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; } void getTargetDefines(const LangOptions &Opts, diff --git a/clang/test/CodeGen/mingw-long-double-size.c b/clang/test/CodeGen/mingw-long-double-size.c new file mode 100644 index 000000000000..5e72da6a7e18 --- /dev/null +++ b/clang/test/CodeGen/mingw-long-double-size.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple i686-pc-windows-gnu -S %s -o - | FileCheck %s -check-prefix=CHECK_I686 +// CHECK_I686: lda,12 +// RUN: %clang_cc1 -triple x86_64-pc-windows-gnu -S %s -o - | FileCheck %s -check-prefix=CHECK_X86_64 +// CHECK_X86_64: lda,16 +long double lda;