mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
This patch adds alignment information for long double to the 64-bit PowerPC
ELF subtarget. The existing logic is used as a fallback to avoid any changes to the Darwin ABI. PPC64 ELF now has two possible data layout 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 Clang, which I am committing now as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
edece78550
commit
01d013ec04
@ -113,6 +113,12 @@ public:
|
|||||||
const char *getDataLayoutString() const {
|
const char *getDataLayoutString() const {
|
||||||
// Note, the alignment values for f64 and i64 on ppc64 in Darwin
|
// Note, the alignment values for f64 and i64 on ppc64 in Darwin
|
||||||
// documentation are wrong; these are correct (i.e. "what gcc does").
|
// documentation are wrong; these are correct (i.e. "what gcc does").
|
||||||
|
if (isPPC64() && isSVR4ABI())
|
||||||
|
if (TargetTriple.getOS() == llvm::Triple::FreeBSD)
|
||||||
|
return "E-p:64:64-f64:64:64-i64:64:64-f128:64:64-v128:128:128-n32:64";
|
||||||
|
else
|
||||||
|
return "E-p:64:64-f64:64:64-i64:64:64-f128:128:128-v128:128:128-n32:64";
|
||||||
|
|
||||||
return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128-n32:64"
|
return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128-n32:64"
|
||||||
: "E-p:32:32-f64:64:64-i64:64:64-f128:64:128-n32";
|
: "E-p:32:32-f64:64:64-i64:64:64-f128:64:128-n32";
|
||||||
}
|
}
|
||||||
|
26
test/CodeGen/PowerPC/ppc64-align-long-double.ll
Normal file
26
test/CodeGen/PowerPC/ppc64-align-long-double.ll
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
; RUN: llc -mcpu=pwr7 -O0 < %s | FileCheck %s
|
||||||
|
|
||||||
|
; Verify internal alignment of long double in a struct. The double
|
||||||
|
; argument comes in in GPR3; GPR4 is skipped; GPRs 5 and 6 contain
|
||||||
|
; the long double. Check that these are stored to proper locations
|
||||||
|
; in the parameter save area and loaded from there for return in FPR1/2.
|
||||||
|
|
||||||
|
target datalayout = "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"
|
||||||
|
target triple = "powerpc64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
%struct.S = type { double, ppc_fp128 }
|
||||||
|
|
||||||
|
define ppc_fp128 @test(%struct.S* byval %x) nounwind {
|
||||||
|
entry:
|
||||||
|
%b = getelementptr inbounds %struct.S* %x, i32 0, i32 1
|
||||||
|
%0 = load ppc_fp128* %b, align 16
|
||||||
|
ret ppc_fp128 %0
|
||||||
|
}
|
||||||
|
|
||||||
|
; CHECK: std 6, 72(1)
|
||||||
|
; CHECK: std 5, 64(1)
|
||||||
|
; CHECK: std 4, 56(1)
|
||||||
|
; CHECK: std 3, 48(1)
|
||||||
|
; CHECK: lfd 1, 64(1)
|
||||||
|
; CHECK: lfd 2, 72(1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user