[Bug target/94832] AVX512 scatter/gather macros lack parentheses when unoptimized
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 29 10:01:42 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94832
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Kenneth Heafield from comment #3)
> Being a macro some of the time also causes trouble with template commas and
> the C preprocessor.
>
> #include <immintrin.h>
> template <class S, class T> int *TemplatedFunction();
> void Fail() {
> _mm512_mask_i32scatter_epi32(TemplatedFunction<void, void>(), 0xffff,
> _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
> }
You need to wrap the arguments in ()s then, I'm afraid there is nothing else
that can be done about that. The reason for the macros rather than inline
functions is that those particular intrinsic require at least one compile time
constant argument and at -O0 there is no guarantee the compile time constant
would be propagated into the builtin that is used under the hood for the
intrinsic.
It is the same thing as with say C header APIs, those can be also implemented
as functions or as macros.
More information about the Gcc-bugs
mailing list