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

            Bug ID: 77633
           Summary: AVX512: shuffle intrinsic has incorrect signature when
                    optimizations are enabled
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wen...@mitsuba-renderer.org
  Target Milestone: ---

The AVX512 shuffle intrinsic switches to a different implementation (&
different signature) when optimizations are turned on. This leads to the
following strange error message when compiling a snippet that passes the type
checker at -O0.

///////////////////////////////////////////////////////////


$ g++-7 test.c -march=knl -O3
In file included from
/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include/immintrin.h:29:0,
                 from test.c:1:
test.c: In function ‘void test()’:
test.c:8:50: error: invalid conversion from ‘int’ to ‘_MM_PERM_ENUM’
[-fpermissive]
     _mm512_shuffle_epi32(_mm512_setzero_epi32(), _MM_SHUFFLE(0, 3, 0, 1));
                                                  ^
In file included from
/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include/immintrin.h:45:0,
                 from test.c:1:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include/avx512fintrin.h:3848:1:
note:   initializing argument 2 of ‘__m512i _mm512_shuffle_epi32(__m512i,
_MM_PERM_ENUM)’
 _mm512_shuffle_epi32 (__m512i __A, _MM_PERM_ENUM __mask)
 ^~~~~~~~~~~~~~~~~~~~


///////////////////////////////////////////////////////////


#include <immintrin.h>

void test() {
    /* SSE shuffle: works */
    _mm_shuffle_epi32(_mm_setzero_si128(), _MM_SHUFFLE(0, 3, 0, 1));

    /* AVX512 shuffle: type checker error when optimizations are turned on! */
    _mm512_shuffle_epi32(_mm512_setzero_epi32(), _MM_SHUFFLE(0, 3, 0, 1));
}

Reply via email to