From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 0D47B3858033; Thu, 15 Jun 2023 07:59:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0D47B3858033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35F7qd7X016901; Thu, 15 Jun 2023 07:59:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type; s=pp1; bh=rO0JdTsR6AZRxoxZMX1Iux+m4+YuMeRIg2RrGDM1hK0=; b=RYvw7onDw1u2kcp4BQ9JcYS69CeFGKUGVJCN4CJlJawwRqHprvhg/U2lmamT1pPMyNzB H1mo0OgVFQ8MhQmypsqnJANMDH4FsGOzg3SqOGUAxMtaVljlt4bF1FgBLNREL5h3q6IZ 86m9E0r6B8wIqPihKuzVCHH/Fq5OEy7WIai0WpV6zof07wpxD0mmDdZYBU7fHcKWM1g+ lSkLJ7IZh/pAbVFzZDzzdpzLVRW3lTMOuILGfx8sUKyE8ijn4iOtGDCAevJO+/M/4Vqb z0v37pfd/n72lfNo0QXWKCOL//V2rtEqWBlk+PJi5QmK92SUuupIpnVrsbC0AY1Ris9l DA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r7xj8g7en-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 07:59:18 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35F7mnl4002399; Thu, 15 Jun 2023 07:59:18 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r7xj8g7dr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 07:59:16 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35F6lUgH012080; Thu, 15 Jun 2023 07:59:15 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3r4gt6g85h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 07:59:15 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35F7xDFl65798464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Jun 2023 07:59:14 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEFA858045; Thu, 15 Jun 2023 07:59:13 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 502FD58061; Thu, 15 Jun 2023 07:59:13 +0000 (GMT) Received: from ltcden2-lp1.aus.stglabs.ibm.com (unknown [9.3.90.43]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Thu, 15 Jun 2023 07:59:13 +0000 (GMT) From: Jiufu Guo To: Segher Boessenkool Cc: Xi Ruoyao , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, rguenther@suse.de, richard.sandiford@arm.com, jeffreyalaw@gmail.com Subject: Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie References: <20230613122335.2108620-1-guojiufu@linux.ibm.com> <7nfs6ubyel.fsf@ltcden2-lp1.aus.stglabs.ibm.com> <6bd54083cadc5d5720afb01f9ab202a2ac748863.camel@xry111.site> <20230614150507.GV19790@gate.crashing.org> Date: Thu, 15 Jun 2023 15:59:10 +0800 In-Reply-To: <20230614150507.GV19790@gate.crashing.org> (Segher Boessenkool's message of "Wed, 14 Jun 2023 10:05:07 -0500") Message-ID: <7no7lh88c1.fsf@ltcden2-lp1.aus.stglabs.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: V_Bz99nszokChJG5B31VI8C5tRciyPBV X-Proofpoint-GUID: wznGOW5ErAqNGPVqlXlpBC0K75QIpP2m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-15_04,2023-06-14_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 bulkscore=0 suspectscore=0 impostorscore=0 adultscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306150063 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, Segher Boessenkool writes: > Hi! > > On Wed, Jun 14, 2023 at 05:18:15PM +0800, Xi Ruoyao wrote: >> The generic issue here is to fix (not "papering over") the signed >> overflow, we need to perform the addition in a target machine mode. We >> may always use Pmode (IIRC const_anchor was introduced for optimizing >> some constant addresses), but can we do better? > > The main issue is that the machine description generated target code to > compute some constants, but the sanitizer treats it as if it was user > code that might do wrong things. > >> Should we try addition in both DImode and SImode for a 64-bit capable >> machine? > > Why? At least on PowerPC there is only one insn, and it is 64 bits. > The SImode version just ignores all bits other than the low 32 bits, in > both inputs and output. > >> Or should we even try more operations than addition (for eg bit >> operations like xor or shift)? Doing so will need to create a new >> target hook for const anchoring, this is the "complete rework" I meant. > Yeap! This would be a different implementation than the current const_anchor in cse.cc. In postreload.cc, there is another implementation: "reload_cse_move2add" which checks all 'add's instructions from the target. But both implementations have pros and cons. Using gcc source code as a benchmark, analyzing the relations between constants (focusing on those constants in the same function or the same basic block). IIRC, 'add's can cover most of the relations. Small part of constants can be built via other operations(e.g. shift, and, neg ,...). There may be still some benchmarks that hit other operations in the hot path. Indeed, the const_anchor feature could be enhanced to cover more cases. BR, Jeff (Jiufu Guo) > This might make const anchor useful for way more targets maybe, > including rs6000, yes :-) > > > Segher