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

Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k



On Mon, May 26, 2025 at 2:23 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> On Mon, 2025-05-26 at 14:16 -0400, Jeffrey Walton wrote:
> > I don't know about the 64 byte alignment on NetBSD. Maybe it was
> > copied/pasted/modified from amd64? amd64 has a BIGGEST_ALIGNMENT of 64
> > due to AVX512. Prior to that, I believe amd64 had a BIGGEST_ALIGNMENT
> > of 32 due to AVX. (These were due to the aligned loads, like
> > _mm256_load_epi32 (32-byte requirement) or _mm512_load_epi32 (64-byte
> > requirement)).
> >
> > For PowerPC with Altivec, I believe BIGGEST_ALIGNMENT should be 16.
> >
> > I don't know if __ALTIVEC__ plays a part in BIGGEST_ALIGNMENT. That
> > is, should BIGGEST_ALIGNMENT be 4 (for int) or 8 (for doubles) unless
> > __ALTIVEC__ is defined; and if __ALTIVEC__ is defined, then
> > BIGGEST_ALIGNMENT should be 16.
>
> The alignment is specified in bits here, not bytes. Hence a BIGGEST_ALIGNMENT
> of 64 means 8 bytes, not 64 bytes.

Derp...

Maybe the 64-bits/8-bytes is coming from limitations in the linker.
See the discussion of __BIGGEST_ALIGNMENT__ at
<https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>:

    On some systems, the linker is only able to arrange for variables to
    be aligned up to a certain maximum alignment. (For some linkers, the
    maximum supported alignment may be very very small.) If your linker
    is only able to align variables up to a maximum of 8-byte alignment,
    then specifying aligned(16) in an __attribute__ still only provides
    you with 8-byte alignment.

Jeff


Reply to: