Date: Fri, 05 Sep 2025 17:09:16 -0700
On Friday, 5 September 2025 15:53:24 Pacific Daylight Time Paul Caprioli via
Std-Proposals wrote:
> For example, in clang19's header file avx512fintrin.h:
> typedef long long __m512i __attribute__((__vector_size__(64),
> __aligned__(64)));
>
> In gcc12:
> typedef long long __m512i __attribute__ ((__vector_size__ (64),
> __may_alias__));
Actually, you can't infer the alignment from the headers. You can see in the
definition of __m128i in the GCC headers that it lacks the __aligned__ portion
too, so all those types should have had the alignment of "long long" (8) but
don't. It's implemented in the compiler itself.
https://gcc.godbolt.org/z/6556Mo1j9
The original SSE 128-bit registers did require 128-bit aligned memory for all
but the explicitly-unaligned memory loads and stores. AVX inverted that so
that most operations are unaligned, except for the explicitly-aligned memory
operations. The recommendation now is to never, ever use the explicitly-
aligned memory operations for AVX, especially because GCC took a long time to
finally add support for AVX for C++ on Windows.
Std-Proposals wrote:
> For example, in clang19's header file avx512fintrin.h:
> typedef long long __m512i __attribute__((__vector_size__(64),
> __aligned__(64)));
>
> In gcc12:
> typedef long long __m512i __attribute__ ((__vector_size__ (64),
> __may_alias__));
Actually, you can't infer the alignment from the headers. You can see in the
definition of __m128i in the GCC headers that it lacks the __aligned__ portion
too, so all those types should have had the alignment of "long long" (8) but
don't. It's implemented in the compiler itself.
https://gcc.godbolt.org/z/6556Mo1j9
The original SSE 128-bit registers did require 128-bit aligned memory for all
but the explicitly-unaligned memory loads and stores. AVX inverted that so
that most operations are unaligned, except for the explicitly-aligned memory
operations. The recommendation now is to never, ever use the explicitly-
aligned memory operations for AVX, especially because GCC took a long time to
finally add support for AVX for C++ on Windows.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Platform & System Engineering
Received on 2025-09-06 00:09:24