This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: __BIGGEST_ALIGNMENT / more on arch compiler defines
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Toebs Douglass <toby at winterflaw dot net>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Thu, 22 Jun 2017 13:05:42 -0400
- Subject: Re: __BIGGEST_ALIGNMENT / more on arch compiler defines
- Authentication-results: sourceware.org; auth=none
- References: <93d6c777-1f23-66dc-7fe9-6100891ca6f3@winterflaw.net>
- Reply-to: noloader at gmail dot com
On Thu, Jun 22, 2017 at 12:34 PM, Toebs Douglass <toby@winterflaw.net> wrote:
>
> I asked recently about the largest supported alignment.
>
> Turns out there is a compiler defined define, "__BIGGEST_ALIGNMENT",
> which indicates this value. It is usually small (16 bytes kindafing).
Its 32 for machines with AVX.
> It seems to have in older versions (something like 4.5 ish and earlier)
> to have been named "BIGGEST_ALIGNMENT".
>
> In other news, I've been experimenting again with the "__i686" define.
>
> As far as I can tell, it is defined for arch "i686" up to and including
> "pentium3" (I'm currently using 5.4.0).
>
> https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/x86-Options.html#x86-Options
Also see https://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html and
https://gcc.gnu.org/onlinedocs/cpp/System-specific-Predefined-Macros.html#System-specific-Predefined-Macros.
And from https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html :
GCC also provides a target specific macro
__BIGGEST_ALIGNMENT__, which is the largest
alignment ever used for any data type on the target
machine you are compiling for. For example, you
could write:
short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
Jeff