This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Altivec + 16 byte alignment
- From: <tm_gccmail at mail dot kloo dot net>
- To: Gianni Mariani <gmariani at chaincast dot com>
- Cc: Gianni Tedesco <gianni at scaramanga dot co dot uk>, gcc at gcc dot gnu dot org
- Date: Tue, 11 Feb 2003 11:21:02 -0800 (PST)
- Subject: Re: Altivec + 16 byte alignment
On Tue, 11 Feb 2003, Gianni Mariani wrote:
> Gianni Tedesco wrote:
>
> >Hi,
> >
...
> >This seems to work for global variables, but when allocated on the
> >stack, my structures end up mis-aligned (on to 8-byte boundaries) which
> >totally screws up the results of the altivec computation.
> >
> >Is this a compiler problem, or can't the compiler be expected to
> >guarantee alignments that large?
> >
>
> This is a problem with the malloc implementation.
>
> Most malloc's support 8 byte alignment. You could specifically tune one
> of the
> many malloc packages out there to be 16 byte aligned and hence this
> would solve
> your problem.
malloc is not responsible for allocating stack space, and therefore cannot
be implicated as the culprit for the set of circumstances he is
describing.
The basic problem is the compiler does not know the alignment of the
staack when the function is entered, so it doesn't know the amount of
offset required to align the stack to a particular boundary.
The only way to solve this is to example the stack pointer at runtime and
mask off bits in it to align the stack, which isn't currently supported
as an option in gcc.
Toshi