From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 3CB8D3840C1E for ; Mon, 25 May 2020 11:10:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3CB8D3840C1E Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04PB3q5m117284; Mon, 25 May 2020 07:10:48 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 316ytsht84-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 May 2020 07:10:48 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04PBAIMS137591; Mon, 25 May 2020 07:10:48 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 316ytsht7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 May 2020 07:10:48 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 04PB1gfh024900; Mon, 25 May 2020 11:10:46 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 316uf8sk0x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 May 2020 11:10:46 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04PBAhwB64553128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 May 2020 11:10:43 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9936852051; Mon, 25 May 2020 11:10:43 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8F47C52054; Mon, 25 May 2020 11:10:42 +0000 (GMT) From: guojiufu To: gcc-patches@gcc.gnu.org Cc: guojiufu@linux.ibm.com, wschmidt@linux.ibm.com, segher@kernel.crashing.org, dje.gcc@gmail.com, richard.guenther@gmail.com Subject: [PATCH 2/2] rs6000: Turn on -frtl-unroll-loops instead -funroll-loops at -O2 Date: Mon, 25 May 2020 19:10:40 +0800 Message-Id: <20200525111040.8876-2-guojiufu@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525111040.8876-1-guojiufu@linux.ibm.com> References: <20200525111040.8876-1-guojiufu@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-25_05:2020-05-25, 2020-05-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=1 priorityscore=1501 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 cotscore=-2147483648 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005250082 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 11:10:50 -0000 Previously, turning -funroll-loops on at -O2, which also turn on GIMPLE cunroll fully. While cunroll unrolls some complex loops. This patch turn on -frtl-unroll-loops at -O2 only, and continue to use previous tuned rs6000 heurisitics for small loops. While this patch does not turn on GIMPLE cunroll any more. We may tune cunroll in near future at -O2. In this patch, it become simpler to check/set -fweb, -frename-register and -munroll-only-small-loops. Together with -frtl-unroll-loops, -fweb is useful, then turn -fweb on; and -frename-registers is no need to be checked, because it is affected by -frtl-unroll-loops. Bootstrap and regtest pass on powerpc64le, is this ok for trunk? And backport to GCC10 together with the patch "Seperate -funroll-loops for GIMPLE unroller and RTL unroller" Jiufu gcc/ChangeLog 2020-05-25 Jiufu Guo PR target/95018 * common/config/rs6000/rs6000-common.c (rs6000_option_optimization_table) [OPT_LEVELS_2_PLUS_SPEED_ONLY]: Replace -funroll-loops with -frtl-unroll-loops. Remove -munroll-only-small-loops and add -fweb. [OPT_LEVELS_ALL]: Remove turn off -frename-registers. * config/rs6000/rs6000.c (rs6000_option_override_internal): -funroll-loops overrides -munroll-only-small-loops and -frtl-unroll-loops. --- gcc/common/config/rs6000/rs6000-common.c | 11 +++-------- gcc/config/rs6000/rs6000.c | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/gcc/common/config/rs6000/rs6000-common.c b/gcc/common/config/rs6000/rs6000-common.c index ee37b9dc90b..c7388edb867 100644 --- a/gcc/common/config/rs6000/rs6000-common.c +++ b/gcc/common/config/rs6000/rs6000-common.c @@ -34,14 +34,9 @@ static const struct default_options rs6000_option_optimization_table[] = { OPT_LEVELS_ALL, OPT_fsplit_wide_types_early, NULL, 1 }, /* Enable -fsched-pressure for first pass instruction scheduling. */ { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 }, - /* Enable -munroll-only-small-loops with -funroll-loops to unroll small - 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 }, - - /* -frename-registers leads to non-optimal codegen and performance - on rs6000, turn it off by default. */ - { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 }, + /* Enable -frtl-unroll-loops and -fweb at -O2 and above by default. */ + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_frtl_unroll_loops, NULL, 1 }, + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_fweb, 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/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8435bc15d72..96620651a59 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4557,17 +4557,16 @@ rs6000_option_override_internal (bool global_init_p) param_sched_pressure_algorithm, SCHED_PRESSURE_MODEL); - /* Explicit -funroll-loops turns -munroll-only-small-loops off, and - turns -frename-registers on. */ - if ((global_options_set.x_flag_unroll_loops && flag_unroll_loops) - || (global_options_set.x_flag_unroll_all_loops - && flag_unroll_all_loops)) - { - if (!global_options_set.x_unroll_only_small_loops) - unroll_only_small_loops = 0; - if (!global_options_set.x_flag_rename_registers) - flag_rename_registers = 1; - } + /* if -f[no-]unroll-loops is specified explicitly, turn [off/]on + -frtl-unroll-loops. */ + if (global_options_set.x_flag_unroll_loops + && !global_options_set.x_flag_rtl_unroll_loops) + flag_rtl_unroll_loops = flag_unroll_loops; + + /* If flag_unroll_loops is effect, not _only_ small loops, but + large loops are unrolled if possible. */ + if (!global_options_set.x_unroll_only_small_loops) + unroll_only_small_loops = flag_unroll_loops ? 0 : 1; /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0) can be optimized to -- 2.17.1