public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101842] New: Vectorizer doesn't vectorize when loop bound depends on two independent variables that are unknown Date: Tue, 10 Aug 2021 09:41:11 +0000 [thread overview] Message-ID: <bug-101842-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101842 Bug ID: 101842 Summary: Vectorizer doesn't vectorize when loop bound depends on two independent variables that are unknown Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tnfchris at gcc dot gnu.org Target Milestone: --- The following example float f(float *p, float d, int len, float lim) { float m[4]; for (int i = 0; i < len && d >= lim; i += 4) { m[0] = p[0] * p[0]; m[1] = p[1] * p[1]; m[2] = p[2] * p[2]; m[3] = p[3] * p[3]; d = d - m[0]; d = d - m[1]; d = d - m[2]; d = d - m[3]; p += 4; } return d; } isn't vectorized at -Ofast because ``` missed: not vectorized: number of iterations cannot be computed. ``` which seems odd because I would expect that it would be treated as just any other loop with unbounded iterations. Commenting out this check results in it bailing out because of it not knowing how to deal with the reduction. This loop should be easy to vectorize with vectorizing the multiplications of m and then reducing the changes of `d - sum (m[0..3])`.
next reply other threads:[~2021-08-10 9:41 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-10 9:41 tnfchris at gcc dot gnu.org [this message] 2021-08-10 10:06 ` [Bug tree-optimization/101842] " rguenth at gcc dot gnu.org 2021-08-10 10:22 ` rguenth at gcc dot gnu.org 2021-08-10 10:44 ` tnfchris at gcc dot gnu.org 2021-08-10 10:54 ` rguenth at gcc dot gnu.org 2021-08-10 11:16 ` tnfchris at gcc dot gnu.org
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-101842-4@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).