https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99100
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|tree-optimization |target --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- What's odd is that with -mavx512f -mtune=skylake-avx512 we don't vectorize it at all. I'm looking at a smaller test: #pragma omp declare simd simdlen(8) notinbranch extern double __attribute__((const)) myfunc(double x); #define N 1024 __attribute__ ((__aligned__(256))) double a[N], b[N], c[N]; void foo() { for (int i = 0; i < N; i++) a[i] = myfunc(b[i]); } we have 3 simd clones here and the only discriminator is the target badness returned by targetm.simd_clone.usable (n). I suspect switch (node->simdclone->vecsize_mangle) { case 'b': if (!TARGET_SSE2) return -1; if (!TARGET_AVX) return 0; return TARGET_AVX2 ? 2 : 1; case 'c': if (!TARGET_AVX) return -1; return TARGET_AVX2 ? 1 : 0; case 'd': if (!TARGET_AVX2) return -1; return 0; case 'e': if (!TARGET_AVX512F) return -1; return 0; since 'd' behaves the same as 'e' here we prefer 'd' or 'e' dependent on the order in the simd clones. Note the odd thing is we produce a 'c' mangling clone _and_ a 'd' mangling one. But indeed once we reach 'd' badness is zero and can't improve anymore. There's also no sign of handling of prefered SIMD modes in the above function... Target issue. Not sure about the -mtune=skylake-avx512 issue though.