This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Altivec + 16 byte alignment
- From: Michael S. Zick <mszick at goquest dot com>
- To: Gianni Tedesco <gianni at scaramanga dot co dot uk>,gcc at gcc dot gnu dot org
- Date: Tue, 11 Feb 2003 08:26:21 -0600
- Subject: Re: Altivec + 16 byte alignment
- References: <1044958034.1117.67.camel@lemsip>
On Tuesday 11 February 2003 04:07 am, Gianni Tedesco wrote:
> Hi,
>
> I'm currently working on a project which uses altivec (as inline
> assembly) to perform 3d affine transformations, and some other 3d vector
> functions.
>
> I have a problem in that altivec requires all inputs to be 16 byte
> aligned, so I am placing my vectors in a structure like this:
>
> struct vector {
> float x,y,z,w;
> }__attribute__((aligned(16)));
>
> 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?
>
> gcc version 2.95.4 20010319 (prerelease/franzo/20011204)
>
> PS. Is there any documentation about the vector support directly in C? I
> hear gcc3 has that feature.
>
> Thanks.
>
> PS. Please CC replies, im not a list subscriber.
Gianni,
A description of one solution can be found in Appendix F of:
ftp://download.intel.com/design/PentiumII/manuals/24512701.pdf
If you are talking about the ia32 hardware.
I do not think gcc 2.95.4 will do that unless you modify the
function prologue generation.
The gcc 3.x.y series has a lot of work done on altivec support
but I can not answer if stack alignment is controllable in any
of them yet. Perhaps someone working in that area will be
able to respond.
Mike