[cfe-commits] r166927 - in /cfe/trunk: lib/Basic/Targets.cpp test/CodeGen/ppc64-align-long-double.c
Bill Schmidt
wschmidt at linux.vnet.ibm.com
Mon Oct 29 07:59:24 PDT 2012
Author: wschmidt
Date: Mon Oct 29 09:59:24 2012
New Revision: 166927
URL: http://llvm.org/viewvc/llvm-project?rev=166927&view=rev
Log:
This patch adds alignment information for long double to the 64-bit PowerPC
ELF subtarget.
The existing description string is moved from PPC64TargetInfo to its
DarwinTargetInfo subclass, to avoid any changes to the Darwin ABI.
PPC64TargetInfo now has two possible description strings: one for FreeBSD,
which requires 8-byte alignment, and a default string that requires
16-byte alignment.
I've added a test for PPC64 Linux to verify the 16-byte alignment. If
somebody wants to add a separate test for FreeBSD, that would be great.
Note that there is a companion patch to update the alignment information
in LLVM, which I am committing now as well.
Added:
cfe/trunk/test/CodeGen/ppc64-align-long-double.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=166927&r1=166926&r2=166927&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 29 09:59:24 2012
@@ -1054,13 +1054,18 @@
IntMaxType = SignedLong;
UIntMaxType = UnsignedLong;
Int64Type = SignedLong;
- DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
- "i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64";
if (getTriple().getOS() == llvm::Triple::FreeBSD) {
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
- }
+ DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
+ "i64:64:64-f32:32:32-f64:64:64-f128:64:64-"
+ "v128:128:128-n32:64";
+ } else
+ DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
+ "i64:64:64-f32:32:32-f64:64:64-f128:128:128-"
+ "v128:128:128-n32:64";
+
}
virtual BuiltinVaListKind getBuiltinVaListKind() const {
return TargetInfo::CharPtrBuiltinVaList;
@@ -1094,6 +1099,8 @@
: DarwinTargetInfo<PPC64TargetInfo>(triple) {
HasAlignMac68kSupport = true;
SuitableAlign = 128;
+ DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
+ "i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64";
}
};
} // end anonymous namespace.
Added: cfe/trunk/test/CodeGen/ppc64-align-long-double.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc64-align-long-double.c?rev=166927&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ppc64-align-long-double.c (added)
+++ cfe/trunk/test/CodeGen/ppc64-align-long-double.c Mon Oct 29 09:59:24 2012
@@ -0,0 +1,18 @@
+// REQUIRES: ppc64-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: -f128:128:128-
+
+struct S {
+ double a;
+ long double b;
+};
+
+// CHECK: %struct.{{[a-zA-Z0-9]+}} = type { double, ppc_fp128 }
+
+long double test (struct S x)
+{
+ return x.b;
+}
+
+// CHECK: %{{[0-9]}} = load ppc_fp128* %{{[a-zA-Z0-9]+}}, align 16
More information about the cfe-commits
mailing list