[PATCH] enable -fweb and -frename-registers at -O3 for rs6000

Jiufu Guo guojiufu@linux.ibm.com
Fri Dec 20 07:10:00 GMT 2019


Hi,

Previously, limited unrolling was enabled at O2 for powerpc in r278034.  At that
time, -fweb and -frename-registers were not enabled together with -funroll-loops
even for -O3.  After that, we notice there are some performance degradation on
SPEC2006fp which caused by without web and rnreg.  This patch enable -fweb
and -frename-registers for -O3 to align original behavior before r278034.

Since this patch help to prevent performance regression, I'm thinking to
submit to trunk.

Bootstrap and regtest pass on powerpc64le. Is this okay for trunk?

Thanks,
Jiufu

gcc/
2019-12-20  Jiufu Guo  <guojiufu@linux.ibm.com>

	* gcc/common/config/rs6000/rs6000-common.c
	(rs6000_option_optimization_table) [OPT_LEVELS_ALL]: Remove
	disabling -fweb and -frename-registers.
	[OPT_LEVELS_3_PLUS]: Enable -fweb and -frename-registers. 

gcc.testsuite/
2019-12-20  Jiufu Guo  <guojiufu@linux.ibm.com>

	* gcc.dg/torture/stackalign/builtin-return-1.c: Add
	option -fno-rename-registers for powerpc.

---
 gcc/common/config/rs6000/rs6000-common.c                   | 7 +++----
 gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c | 1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/common/config/rs6000/rs6000-common.c b/gcc/common/config/rs6000/rs6000-common.c
index eb0328d..75a7caf 100644
--- a/gcc/common/config/rs6000/rs6000-common.c
+++ b/gcc/common/config/rs6000/rs6000-common.c
@@ -38,10 +38,9 @@ static const struct default_options rs6000_option_optimization_table[] =
        loops at -O2 and above by default.  */
     { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_funroll_loops, NULL, 1 },
     { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_munroll_only_small_loops, NULL, 1 },
-    /* -fweb and -frename-registers are useless in general for rs6000,
-       turn them off.  */
-    { OPT_LEVELS_ALL, OPT_fweb, NULL, 0 },
-    { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 },
+    /* -fweb and -frename-registers are useful only above -O3 for rs6000.  */
+    { OPT_LEVELS_3_PLUS, OPT_fweb, NULL, 1 },
+    { OPT_LEVELS_3_PLUS, OPT_frename_registers, NULL, 1 },
 
     /* Double growth factor to counter reduced min jump length.  */
     { OPT_LEVELS_ALL, OPT__param_max_grow_copy_bb_insns_, NULL, 16 },
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
index ec4fd8a..4e342c0 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
@@ -2,6 +2,7 @@
 /* Originator: Andrew Church <gcczilla@achurch.org> */
 /* { dg-do run } */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-additional-options "-fno-rename-registers" { target { powerpc*-*-* } } } */
 
 /* This used to fail on SPARC because the (undefined) return
    value of 'bar' was overwriting that of 'foo'.  */
-- 
2.7.4



More information about the Gcc-patches mailing list