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

            Bug ID: 99100
           Summary: Inconsistent vector length used in autovectorizer for
                    AVX-512
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shibatch.sf.net at gmail dot com
  Target Milestone: ---

When AVX512 instruction is available, the auto-vectorizer in gcc 
sometimes generates calls to AVX2 functions instead of AVX512 functions.
-mprefer-vector-width=512 does not affect the result.


$ cat vabitest.c
#include <stdio.h>
#include <math.h>

_Pragma ("omp declare simd simdlen(8) notinbranch") 
__attribute__((const)) double myfunc(double x);

#define N 1024
__attribute__ ((__aligned__(256))) double a[N], b[N], c[N];

int main(void) {
   for (int i = 0; i < N; i++) a[i] = myfunc(b[i]);
   for (int i = 0; i < N; i++) c[i] = sin(b[i]);
}

$ gcc-10 -ffast-math -O3 -mavx512f -fopenmp vabitest.c -S -o- | grep _ZGV
         call    _ZGVdN8v_myfunc@PLT
         call    _ZGVeN8v_sin@PLT

Reply via email to