Re: Default stack alignment on x86-64, fedora 11

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My hunch is that, similar to struct ordering, the order of declaration
is the order on the stack.  I do not know this for sure.

If that's the case, you can get the best packing by putting the
highest alignment items first.  For example:

__m128 a;
double b;
float c;
short d;
uint8_t e;

  Brian

On Wed, Aug 26, 2009 at 12:28 AM, Rohit Garg<rpg.314@xxxxxxxxx> wrote:
> Hi,
>
> What is the default stack alignment for gcc 4.4 on x86-64 linux? I
> assume it is 16 bytes so that SSE can use aligned loads and stores. I
> have googled for it a little and found some references for it that say
> so in passing, but I'd prefer to get some official blessing for it.
>
> My real issue is that I would like to declare certain variables on
> stack as aligned on 16 byte boundaries, so I can load/store them
> quickly. Of course, I'd prefer if this didn't involve _any_ overhead.
>
> http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
>
> This here says that stack can be aligned to 16 bytes, which is also
> default. If I wish to avoid any code size increase, is there any
> particular order of declaring these variables which I should follow so
> that no extra space is consumed for padding. I would have thought that
> GCC would be smart enough to reorder variables to minimize code bloat,
> but.....
>
> I am using fedora 11, so all code is compiled using gcc 4.4. Not sure
> what the compilation options are.
>
> Thanks,
>
> --
> Rohit Garg
>
> http://rpg-314.blogspot.com/
>
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux