[Bug target/94832] AVX512 scatter/gather macros lack parentheses when unoptimized
gcc at kheafield dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 29 09:56:08 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94832
--- Comment #3 from Kenneth Heafield <gcc at kheafield dot com> ---
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);
}
Without optimization, error because the template , is interpreted by the macro.
g++ -mavx512f -c template.cc
template.cc:6:118: error: macro "_mm512_mask_i32scatter_epi32" passed 6
arguments, but takes just 5
6 | _mm512_mask_i32scatter_epi32(TemplatedFunction<void, void>(), 0xffff,
_mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
|
^
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/immintrin.h:55,
from template.cc:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/avx512fintrin.h:10475: note:
macro "_mm512_mask_i32scatter_epi32" defined here
10475 | #define _mm512_mask_i32scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
|
template.cc: In function ‘void Fail()’:
template.cc:6:3: error: ‘_mm512_mask_i32scatter_epi32’ was not declared in this
scope
6 | _mm512_mask_i32scatter_epi32(TemplatedFunction<void, void>(), 0xffff,
_mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
With optimization, no output.
g++ -mavx512f -O3 -c template.cc
More information about the Gcc-bugs
mailing list