This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Rohit Garg <rpg.314@gmail.com> writes:

> 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.

You should be able to use __attribute__ ((aligned (16))) to make this
happen.

> 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.....

gcc will normally sort the stack variables to avoid wasting stack space.
The order in which you declare the variables in your program is
irrelevant.  That said, stack space is fairly cheap.  Why do you need to
optimize it?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]