Re: [PATCH V2] Split loop for NE condition.

2021-06-01 Thread guojiufu via Gcc-patches
On 2021-06-01 11:28, guojiufu via Gcc-patches wrote: On 2021-05-26 17:50, Richard Biener wrote: On Mon, 17 May 2021, Jiufu Guo wrote: Or relax all this, of course. It would easy to handle the above cases: e->src before latch, or simple header. To relax this, we may need to peel (parti

Re: [PATCH V2] Split loop for NE condition.

2021-05-31 Thread guojiufu via Gcc-patches
On 2021-05-26 17:50, Richard Biener wrote: On Mon, 17 May 2021, Jiufu Guo wrote: ... while (++k > 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

Re: [PATCH V2] Split loop for NE condition.

2021-05-26 Thread Segher Boessenkool
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 l

Re: [PATCH V2] Split loop for NE condition.

2021-05-26 Thread Richard Biener
On Mon, 17 May 2021, Jiufu Guo wrote: > When there is the possibility that overflow/wrap may happen on the loop index, > a few optimizations would not happen. For example code: > > foo (int *a, int *b, unsigned k, unsigned n) > { > while (++k != n) > a[k] = b[k] + 1; > } > > For this code

Re: [PATCH V2] Split loop for NE condition.

2021-05-18 Thread Bernd Edlinger
On 5/18/21 1:00 PM, Segher Boessenkool wrote:> On Tue, May 18, 2021 at 08:36:34AM +0200, Bernd Edlinger wrote: >> On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: >>> Bootstrap and regtest pass on ppc64le. Is this ok for trunk? > >> I've tried this patch and it does not seem to pass its own

Re: [PATCH V2] Split loop for NE condition.

2021-05-18 Thread guojiufu via Gcc-patches
On 2021-05-18 18:32, guojiufu wrote: On 2021-05-18 17:28, guojiufu via Gcc-patches wrote: On 2021-05-18 14:36, Bernd Edlinger wrote: On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: When there is the possibility that overflow/wrap may happen on the loop index, a few optimizations would no

Re: [PATCH V2] Split loop for NE condition.

2021-05-18 Thread Segher Boessenkool
On Tue, May 18, 2021 at 08:36:34AM +0200, Bernd Edlinger wrote: > On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: > > Bootstrap and regtest pass on ppc64le. Is this ok for trunk? > I've tried this patch and it does not seem to pass its own test: > > FAIL: gcc.dg/loop-split1.c scan-tree-dump

Re: [PATCH V2] Split loop for NE condition.

2021-05-18 Thread guojiufu via Gcc-patches
On 2021-05-18 17:28, guojiufu via Gcc-patches wrote: On 2021-05-18 14:36, Bernd Edlinger wrote: On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: When there is the possibility that overflow/wrap may happen on the loop index, a few optimizations would not happen. For example code: foo (int

Re: [PATCH V2] Split loop for NE condition.

2021-05-18 Thread guojiufu via Gcc-patches
On 2021-05-18 14:36, Bernd Edlinger wrote: On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: When there is the possibility that overflow/wrap may happen on the loop index, a few optimizations would not happen. For example code: foo (int *a, int *b, unsigned k, unsigned n) { while (++k !=

Re: [PATCH V2] Split loop for NE condition.

2021-05-17 Thread Bernd Edlinger
On 5/17/21 4:01 AM, Jiufu Guo via Gcc-patches wrote: > When there is the possibility that overflow/wrap may happen on the loop index, > a few optimizations would not happen. For example code: > > foo (int *a, int *b, unsigned k, unsigned n) > { > while (++k != n) > a[k] = b[k] + 1; > } > >