This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__((aligned(16)) on x86
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: __attribute__((aligned(16)) on x86
- From: "Ryan T. Sammartino" <ryants at home dot com>
- Date: Sat, 28 Jul 2001 02:03:56 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <20010630161223.A11962@home.com> <ord76mn524.fsf@guarana.lsd.ic.unicamp.br>
* Alexandre Oliva <aoliva@redhat.com> [27/07/2001 01:35]:
> I believe the problem is that the alignment of automatic variables is
> limited to PREFERRED_STACK_BOUNDARY and to whatever alignment the C
> library sets up in its initialization code. Even though
> PREFERRED_STACK_BOUNDARY has defaulted to 16 bytes these days, I think
> most (if not all) versions of glibc only guarantee 8-byte alignment of
> the stack.
I'm afraid I don't see the connection between glibc and
__attribute__((aligned())).
When I have something on the stack that is aligned to a certain
boundary, I expect the compiler to do something like:
sub 8, %esp
and -16, %esp
add 4, %esp
<now put variables on the stack>
which should then make esp aligned properly (the above may not be
entirely correct... I'm writing the e-mail very late at night after a
looooong day of hacking :) )
Aligning the stack is no good, since if I do something like:
char c;
vector v1;
my vector will be misaligned by sizeof(char).
Hope this clears it up.
--
Ryan T. Sammartino
http://members.home.net/ryants/
If you talk to God, you are praying; if God talks to you, you have
schizophrenia.
-- Thomas Szasz