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 3E335385702F for ; Tue, 15 Sep 2020 18:15:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3E335385702F Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08FI26Lw147544; Tue, 15 Sep 2020 14:15:33 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 33k1hg25c8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Sep 2020 14:15:33 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08FI2GBC148718; Tue, 15 Sep 2020 14:15:32 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 33k1hg25c4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Sep 2020 14:15:32 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08FI6Zij025170; Tue, 15 Sep 2020 18:15:32 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03dal.us.ibm.com with ESMTP id 33gny9fqn8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Sep 2020 18:15:32 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08FIFRsQ34472318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Sep 2020 18:15:27 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D138DC605F; Tue, 15 Sep 2020 18:15:30 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4138FC605B; Tue, 15 Sep 2020 18:15:30 +0000 (GMT) Received: from sig-9-65-226-203.ibm.com (unknown [9.65.226.203]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 15 Sep 2020 18:15:30 +0000 (GMT) Message-ID: <0f9db93107de8948f6a3bc88d8ab98921513ce66.camel@vnet.ibm.com> Subject: Re: [RS6000] rtx_costs From: will schmidt To: Alan Modra , Segher Boessenkool Cc: gcc-patches@sourceware.org Date: Tue, 15 Sep 2020 13:15:29 -0500 In-Reply-To: <20200915011946.3395-1-amodra@gmail.com> References: <20200915011946.3395-1-amodra@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-15_12:2020-09-15, 2020-09-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1011 lowpriorityscore=0 mlxlogscore=926 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 impostorscore=0 bulkscore=0 suspectscore=3 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009150140 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, 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: Tue, 15 Sep 2020 18:15:36 -0000 On Tue, 2020-09-15 at 10:49 +0930, Alan Modra via Gcc-patches wrote: > This patch series fixes a number of issues in rs6000_rtx_costs, the > aim being to provide costing somewhat closer to reality. Probably > the > most important patch of the series is patch 4, which just adds a > comment. Without the analysis that went into that comment, I found > myself making what seemed to be good changes but which introduced > regressions. > > So far these changes have not introduced any testsuite regressions > on --with-cpu=power8 and --with-cpu=power9 all lang bootstraps on > powerpc64le-linux. Pat spec tested on power9 against a baseline > master from a few months ago, seeing a few small improvements and no > degradations above the noise. I've read through all the patches in this series, (including the tests that were sent a bit later). Your use of comments does a good job helping describe whats going on. One comment/question/point of clarity for the AND patch that I'll send separately. That said, the series lgtm. :-) thanks, -Will > > Some notes: > > Examination of varasm.o shows quite a number of cases where > if-conversion succeeds due to different seq_cost. One example: > > extern int foo (); > int > default_assemble_integer (unsigned size) > { > extern unsigned long rs6000_isa_flags; > > if (size > (!((rs6000_isa_flags & (1UL << 35)) != 0) ? 4 : 8)) > return 0; > return foo (); > } > > This rather horrible code turns the rs6000_isa_flags value into > either > 4 or 8: > rldicr 9,9,28,0 > srdi 9,9,28 > addic 9,9,-1 > subfe 9,9,9 > rldicr 9,9,0,61 > addi 9,9,8 > Better would be > rldicl 9,9,29,63 > sldi 9,9,2 > addi 9,9,4 > > There is also a "rlwinm ra,rb,3,0,26" instead of "rldicr ra,rb,3,60", > and "li r31,0x4000; rotldi r31,r31,17" vs. > "lis r31,0x8000; clrldi r31,r31,32". > Neither of these is a real change. I saw one occurrence of a 5 insn > sequence being replaced with a load from memory in > default_function_rodata_section, for ".rodata", and others elsewhere. > > Sometimes correct insn cost leads to unexpected results. For > example: > > extern unsigned bar (void); > unsigned > f1 (unsigned a) > { > if ((a & 0x01000200) == 0x01000200) > return bar (); > return 0; > } > > emits for a & 0x01000200 > (set (reg) (and (reg) (const_int 0x01000200))) > at expand time (two rlwinm insns) rather than the older > (set (reg) (const_int 0x01000200)) > (set (reg) (and (reg) (reg))) > which is three insns. However, since 0x01000200 is needed later the > older code after optimisation is smaller.