public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105968] GCC vectorizes but reports that it did not vectorize Date: Tue, 14 Jun 2022 10:22:07 +0000 [thread overview] Message-ID: <bug-105968-4-amvIhpI2X2@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105968-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105968 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WONTFIX --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- > ./cc1 -quiet t.c -O3 -mavx2 -fopt-info t.c:11:25: optimized: loops interchanged in loop nest > ./cc1 -quiet t.c -O2 -mavx2 -fopt-info t.c:14:19: optimized: loop vectorized using 32 byte vectors so we interchange the loop to for (i = 0; i < N; ++i) for (times = 0; times < NTIMES; times++) r[i] = (a[i] + b[i]) * c[i]; which is indeed good for memory locality (now, we should then eliminate the inner loop completely but we have no such facility - only unrolling and DSE/DCE would do this but nothing on the high-level loop form). "Benchmark" issue. The outer loop should have a memory clobber. Oh, and we should in theory be able to vectorize the outer loop if N is a multiple of the vector element count. But: t.c:11:25: note: === vect_analyze_data_ref_accesses === t.c:11:25: note: zero step in inner loop of nest t.c:11:25: missed: not vectorized: complicated access pattern. t.c:15:14: missed: not vectorized: complicated access pattern. t.c:11:25: missed: bad data access. so we don't handle this exact issue (maybe the offending check can simply be elided - assuming dependence checking handles zero steps correctly). Putting __asm__ volatile ("" : : : "memory"); at the end of the outer loop vectorizes with -O3 as well (but doesn't interchange). Not a bug I think unless you want to make it a bug about not vectorizing the outer loop after interchange.
prev parent reply other threads:[~2022-06-14 10:22 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-14 8:55 [Bug c++/105968] New: " steveire at gmail dot com 2022-06-14 9:02 ` [Bug c++/105968] " crazylht at gmail dot com 2022-06-14 10:22 ` rguenth at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105968-4-amvIhpI2X2@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).