On Sun, 25 Sep 2016 19:01:14 +0200 Jakub Jelinek <ja...@redhat.com> wrote:
> On Sun, Sep 25, 2016 at 02:48:19PM +0100, Sergei Trofimovich wrote: > > From: Sergei Trofimovich <siarh...@google.com> > > > > Today I traced AVX2 optimisation bug in gcc and > > distilled it down to '__builtin_ia32_gatheraltdiv4si256' > > generated by gcc. > > > > When I attempted to use this builtin directly > > in a simple program gcc refused to recognise > > it as known: > > > > #include <immintrin.h> > > > > void a (void) { > > __builtin_ia32_gatheraltdiv4si256 (1); > > } > > > > $ LANG=C gcc -c -march=core-avx2 a.c > > a.c: In function 'a': > > a.c:4:5: warning: implicit declaration of function > > '__builtin_ia32_gatheraltdiv4si256' > > [-Wimplicit-function-declaration] > > > > The cause is trailing whitespace in builtin definition: > > > > def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4si256 > > ", > > > > Fixed by dropping trailing whitespace. > > No, that isn't a fix, adding such characters has been an older way to > express internal only builtins that aren't ever meant to be available to > users (these days we'd use internal-fn.* stuff, except we don't have support > for backends adding their own internal functions). Aha, got it. Having a seemingly callable name is very confusing. I did grab the name from one of -fdump-tree-all outputs (bug.c.165t.optimized) which looked as: vect_.16_59 = VIEW_CONVERT_EXPR<vector(4) long long int>(vect_var_.12_56); vect_var_.14_60 = __builtin_ia32_gatheraltdiv4si256 ({ -1, -1, -1, -1, -1, -1, -1, -1 }, &PERMS, vect_.16_59, { -1, -1, -1, -1, -1, -1, -1, -1 }, 4); vect_.17_61 = VIEW_CONVERT_EXPR<vector(4) long long int>(vect_var_.12_57); vect_var_.14_62 = __builtin_ia32_gatheraltdiv4si256 ({ -1, -1, -1, -1, -1, -1, -1, -1 }, &PERMS, vect_.17_61, { -1, -1, -1, -1, -1, -1, -1, -1 }, 4); and I assumed that builtin can be used directly to reproduce smaller example. Sorry for the noise. -- Sergei
pgpmQcY54o8k2.pgp
Description: Цифровая подпись OpenPGP