https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88760

--- Comment #42 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
Author: guojiufu
Date: Mon Oct 28 05:23:24 2019
New Revision: 277501

URL: https://gcc.gnu.org/viewcvs?rev=277501&root=gcc&view=rev
Log:
rs6000: Enable limited unrolling at -O2

In PR88760, there are a few disscussion about improve or tune unroller for
targets. And we would agree to enable unroller for small loops at O2 first.
And we could see performance improvement(~10%) for below code:
```
  subroutine foo (i, i1, block)
    integer :: i, i1
    integer :: block(9, 9, 9)
    block(i:9,1,i1) = block(i:9,1,i1) - 10
  end subroutine foo

```
This kind of code occurs a few times in exchange2 benchmark.

Similar C code:
```
  for (i = 0; i < n; i++)
    arr[i] = arr[i] - 10;
```

On powerpcle, for O2 , enable -funroll-loops and limit
PARAM_MAX_UNROLL_TIMES=2 and PARAM_MAX_UNROLLED_INSNS=20, we can see >2%
overall improvement for SPEC2017.

This patch is only for rs6000 in which we see visible performance improvement.

gcc/
2019-10-25  Jiufu Guo  <guoji...@linux.ibm.com>     

        PR tree-optimization/88760
        * config/rs6000/rs6000-common.c (rs6000_option_optimization_table):
        Enable -funroll-loops for -O2 and above.
        * config/rs6000/rs6000.c (rs6000_option_override_internal): Set
        PARAM_MAX_UNROLL_TIMES to 2 and PARAM_MAX_UNROLLED_INSNS to 20, and
        do not turn on web and rngreg implicitly, if the unroller is not
        explicitly enabled.

gcc.testsuite/
2019-10-25  Jiufu Guo  <guoji...@linux.ibm.com>

        PR tree-optimization/88760
        * gcc.target/powerpc/small-loop-unroll.c: New test.
        * c-c++-common/tsan/thread_leak2.c: Update test.
        * gcc.dg/pr59643.c: Update test.
        * gcc.target/powerpc/loop_align.c: Update test.
        * gcc.target/powerpc/ppc-fma-1.c: Update test.
        * gcc.target/powerpc/ppc-fma-2.c: Update test.
        * gcc.target/powerpc/ppc-fma-3.c: Update test.
        * gcc.target/powerpc/ppc-fma-4.c: Update test.
        * gcc.target/powerpc/pr78604.c: Update test.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/small-loop-unroll.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common/config/rs6000/rs6000-common.c
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/tsan/thread_leak2.c
    trunk/gcc/testsuite/gcc.dg/pr59643.c
    trunk/gcc/testsuite/gcc.target/powerpc/loop_align.c
    trunk/gcc/testsuite/gcc.target/powerpc/ppc-fma-1.c
    trunk/gcc/testsuite/gcc.target/powerpc/ppc-fma-2.c
    trunk/gcc/testsuite/gcc.target/powerpc/ppc-fma-3.c
    trunk/gcc/testsuite/gcc.target/powerpc/ppc-fma-4.c
    trunk/gcc/testsuite/gcc.target/powerpc/pr78604.c

Reply via email to