https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120895

--- Comment #31 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, the __m512 type as documented in Intel documentation simply doesn't exist
when the corresponding ISAs aren't enabled.
In older versions of GCC before target attribute and pragmas have been
introduced,
if you included immintrin.h or similar headers, avx512fintrin.h simply wouldn't
be included and __m512 wouldn't be provided.
With the introduction of target attribute and pragmas that changed, each ISA
specific
subheader is provided guarded with target pragmas so that one can do
#include <immintrin.h>

__attribute__((target ("avx512f"))) void foo (void) { __m512 x = _m512_* ();
... }
and have the AVX512F (or any other ISA) intrinsics usable in that function.
But outside of such functions, __m512 is a merge generic vector as documented
in the GCC documentation, something emulated using smaller vectors or scalars
where many of the ISA specific intrinsics cause errors.  And you can't expect
ABI compatibility when using such types between functions with the ISA enabled
and disabled, not just for function argument passing/returning (e.g.
vector_size (64) vectors are passed in %zmmN etc. registers when enabled and
otherwise on the stack etc.  And ditto, you shouldn't be allocating those in
function with one ISA disabled and use in a function with it enabled or vice
versa.
Namespace scope variables will work.

Reply via email to