__BIGGEST_ALIGNMENT / more on arch compiler defines
Jeffrey Walton
noloader@gmail.com
Thu Jun 22 17:05:00 GMT 2017
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
More information about the Gcc-help
mailing list