[cfe-commits] Alignment of return from __builtin_alloca
joerg at britannica.bec.de
Thu Jun 7 16:10:46 PDT 2012
On Thu, Jun 07, 2012 at 03:31:06PM -0700, David Sehr wrote:
> Just out of curiosity, how do those x86 platforms handle
> stack-allocated SSE2 variables? Do they just always use the unaligned
> variants of the instructions?
> This was the reason that the Linux x86 (32 and 64) ABIs now align
> stacks 0mod16, I thought.
The reason is more that until very recently, GCC just created broken
code that. The only way to do it correctly is by realigning the stack.
At least we are getting to the point where LLVM handles all cases
correctly. Requiring larger than natural stack alignment for allocar
at the very least adds an additional AND to all functions using dynamic
allocas. That said, unlike malloc and the posix_memalign interface,
expecting anything but natural alignment
for memory returned by alloca seems to be a very strong assumption...
More information about the cfe-commits