Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-10 Thread Jiufu Guo via Gcc-patches
Hi Segher, Thanks a lot for your time and helpful comments! Segher Boessenkool writes: > Hi Jiufu, > > On Thu, Jul 09, 2020 at 04:01:38PM +0800, Jiufu Guo wrote: >> Segher Boessenkool writes: ... > If the generic code decides to unroll big loops with calls *and* jumps, > there is a big problem

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-10 Thread Jiufu Guo via Gcc-patches
Hi, Segher Boessenkool writes: > Hi Jiufu, > > On Thu, Jul 09, 2020 at 04:01:38PM +0800, Jiufu Guo wrote: >> Segher Boessenkool writes: >> >> But for each single condition, loop unrolling may still be helpful. >> >> While, if these conditions are all occur in a loop, it would be more >> >> po

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-09 Thread Segher Boessenkool
Hi Jiufu, On Thu, Jul 09, 2020 at 04:01:38PM +0800, Jiufu Guo wrote: > Segher Boessenkool writes: > >> But for each single condition, loop unrolling may still be helpful. > >> While, if these conditions are all occur in a loop, it would be more > >> possible to get negative impacts after unrolled

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-09 Thread Jiufu Guo via Gcc-patches
Segher Boessenkool writes: Hi, > On Wed, Jul 08, 2020 at 11:39:56AM +0800, Jiufu Guo wrote: >> Segher Boessenkool writes: >> > I am not happy about what is considered "a complex loop" here. >> For early exit, which may cause and *next* unrolled iterations may be >> not executed, then unroll may

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-08 Thread Segher Boessenkool
On Wed, Jul 08, 2020 at 11:39:56AM +0800, Jiufu Guo wrote: > Segher Boessenkool writes: > > I am not happy about what is considered "a complex loop" here. > For early exit, which may cause and *next* unrolled iterations may be > not executed, then unroll may be not benifit. Yes, and it can well r

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-07 Thread Jiufu Guo via Gcc-patches
Segher Boessenkool writes: Thanks all! > Hi! > > On Mon, Jul 06, 2020 at 03:13:13PM +0800, guojiufu wrote: >> For very small loops (< 6 insns), it would be fine to unroll 4 >> times to use cache line better. Like below loops: >> `while (i) a[--i] = NULL; while (p < e) *d++ = *p++;` > > Yes,

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-07 Thread Jiufu Guo via Gcc-patches
will schmidt writes: Thanks! > On Mon, 2020-07-06 at 15:13 +0800, guojiufu via Gcc-patches wrote: > > Hi, > > Assorted comments below. thanks :-) > >> For very small loops (< 6 insns), it would be fine to unroll 4 >> times to use cache line better. Like below loops: >> `while (i) a[--i] = NUL

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-07 Thread Segher Boessenkool
Hi! On Mon, Jul 06, 2020 at 03:13:13PM +0800, guojiufu wrote: > For very small loops (< 6 insns), it would be fine to unroll 4 > times to use cache line better. Like below loops: > `while (i) a[--i] = NULL; while (p < e) *d++ = *p++;` Yes, definitely. > And for very complex loops which may

Re: [PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-07 Thread will schmidt via Gcc-patches
On Mon, 2020-07-06 at 15:13 +0800, guojiufu via Gcc-patches wrote: Hi, Assorted comments below. thanks :-) > For very small loops (< 6 insns), it would be fine to unroll 4 > times to use cache line better. Like below loops: > `while (i) a[--i] = NULL; while (p < e) *d++ = *p++;` > > And

[PATCH] rs6000: Refine RTL unroll adjust hook

2020-07-06 Thread guojiufu via Gcc-patches
For very small loops (< 6 insns), it would be fine to unroll 4 times to use cache line better. Like below loops: `while (i) a[--i] = NULL; while (p < e) *d++ = *p++;` And for very complex loops which may cause negative impacts: branch-miss or cache-miss. Like below loop: there are calls, earl