From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6785E3854833; Mon, 15 Feb 2021 09:01:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6785E3854833 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99100] Inconsistent vector length used in autovectorizer for AVX-512 Date: Mon, 15 Feb 2021 09:01:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 09:01:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99100 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Component|tree-optimization |target --- Comment #2 from Richard Biener --- What's odd is that with -mavx512f -mtune=3Dskylake-avx512 we don't vectoriz= e 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 =3D 0; i < N; i++) a[i] =3D 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 anymor= e. There's also no sign of handling of prefered SIMD modes in the above function... Target issue. Not sure about the -mtune=3Dskylake-avx512 issue though.=