From: Segher Boessenkool <segher@kernel.crashing.org>
To: Richard Biener <rguenther@suse.de>
Cc: Jiufu Guo <guojiufu@linux.ibm.com>,
gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com,
dje.gcc@gmail.com, jlaw@tachyum.com, bin.cheng@linux.alibaba.com
Subject: Re: [PATCH V2] Split loop for NE condition.
Date: Wed, 26 May 2021 08:22:34 -0500 [thread overview]
Message-ID: <20210526132233.GJ10366@gate.crashing.org> (raw)
In-Reply-To: <nycvar.YFH.7.76.2105261123230.9200@zhemvz.fhfr.qr>
On Wed, May 26, 2021 at 11:50:07AM +0200, Richard Biener wrote:
> > We can split the loop into two loops:
> >
> > while (++k > n)
> > a[k] = b[k] + 1;
> > while (l++ < n)
> > a[k] = b[k] + 1;
> >
> > then for the second loop, it could be optimized.
>
> Btw, I think even the first loop should be vectorized. I see we do
> not handle it in niter analysis:
>
> Analyzing loop at t.c:3
> t.c:3:14: note: === analyze_loop_nest ===
> t.c:3:14: note: === vect_analyze_loop_form ===
> t.c:3:14: note: === get_loop_niters ===
> t.c:3:14: missed: not vectorized: number of iterations cannot be
> computed.
>
> but the number of iterations should be UINT_MAX - k (unless I'm
> missing sth), may_be_zero would be sth like k < n. It would be
> nice to not split this into loops that niter analysis cannot handle ...
As long as it doesn't do that for signed loop counters, because that
would be a waste -- ever executing such code is UB, so vectorising it
will only cost extra insns (usually).
Segher
next prev parent reply other threads:[~2021-05-26 13:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 2:01 Jiufu Guo
2021-05-18 6:36 ` Bernd Edlinger
2021-05-18 9:28 ` guojiufu
2021-05-18 10:32 ` guojiufu
2021-05-18 11:04 ` guojiufu
2021-05-18 11:00 ` Segher Boessenkool
2021-05-18 11:14 ` Bernd Edlinger
2021-05-26 9:50 ` Richard Biener
2021-05-26 13:22 ` Segher Boessenkool [this message]
2021-06-01 3:28 ` guojiufu
2021-06-01 8:23 ` guojiufu
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=20210526132233.GJ10366@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=bin.cheng@linux.alibaba.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=guojiufu@linux.ibm.com \
--cc=jlaw@tachyum.com \
--cc=rguenther@suse.de \
--cc=wschmidt@linux.ibm.com \
/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: link
Be 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).