[patch] Fix darwin ppc DataLayout in clang.

Iain Sandoe iain at codesourcery.com
Wed Dec 18 01:06:19 PST 2013


Hi Rafael,

The Apple gcc compilers produce natural alignment (at both m32 and m64) for long doubles:

For the attached code with:
gcc version 4.0.1 (Apple Inc. build 5493)

we get:
align f = 8 t = 16
ls1 align 16, size 32 offset x 0
ls2 align 16, size 32 offset x 16
ls3 align 16, size 32 offset x 16
align a = 16 b = 16 bar = 16

So, it appears that there is no need to make an exception for long double on darwin.
(and the ABI document is possibly somewhat easy to misinterpret about embedded structure alignment for long doubles).
It seems that long doubles are, effectively, being treated the same as vectors.

So, actually, clang was correct; and the llvm string was under-aligning.

===

(on the stack, in the case of variadic functions, things might well be different - I need to dig out the code that checks that stuff).

Iain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: long-double-2.c
Type: application/octet-stream
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131218/b8bf8a89/attachment.obj>
-------------- next part --------------

On 18 Dec 2013, at 01:21, Rafael EspĂ­ndola wrote:

> This patch changes two things on the clang DataLayout strings for ppc darwin:
> 
> * The addition of f128:64:128, which was added on r40792 to the llvm
> side for ppc-darwin and ppc64-darwin and is still there.
> * The addition of f64:32:64 to ppc32-darwin. LLVM used to do this
> before r134367, and it looks like that change was unintentional for
> darwin. I was using that since at least r28414, which created the
> DataLayout string :-)




More information about the cfe-commits mailing list