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 36DF4385DC00 for ; Fri, 3 Apr 2020 06:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 36DF4385DC00 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 033666xp016715 for ; Fri, 3 Apr 2020 02:13:16 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 304g885uxr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Apr 2020 02:13:16 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Apr 2020 07:12:58 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 3 Apr 2020 07:12:56 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0336DBJx18284968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Apr 2020 06:13:11 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 095154C040; Fri, 3 Apr 2020 06:13:11 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FC644C044; Fri, 3 Apr 2020 06:13:09 +0000 (GMT) Received: from luoxhus-MacBook-Pro.local (unknown [9.197.227.13]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 3 Apr 2020 06:13:08 +0000 (GMT) Subject: Re: [PATCH] rs6000: Don't split constant oprator when add, move to temp register for future optimization To: Segher Boessenkool Cc: gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com, guojiufu@linux.ibm.com, linkw@gcc.gnu.org References: <20200326100643.32487-1-luoxhu@linux.ibm.com> <20200327143331.GD22482@gate.crashing.org> <388143a3-7889-0476-abd7-d2e9b667e5f4@linux.ibm.com> <20200402221653.GG26902@gate.crashing.org> From: luoxhu Date: Fri, 3 Apr 2020 14:13:06 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200402221653.GG26902@gate.crashing.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 20040306-4275-0000-0000-000003B8AA61 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040306-4276-0000-0000-000038CE027C Message-Id: <596ce54a-996c-3180-dbf1-df5e94ded4cb@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-03_03:2020-04-02, 2020-04-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004030046 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable 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: Fri, 03 Apr 2020 06:13:18 -0000 On 2020/4/3 06:16, Segher Boessenkool wrote: > Hi! > > On Mon, Mar 30, 2020 at 11:59:57AM +0800, luoxhu wrote: >>> Do we want something later in the RTL pipeline to make "addi"s etc. again? > > (This would be a good thing to consider -- maybe a define_insn_and_split > will work. But see below). > >> [PATCH] rs6000: Don't split constant operator add before reload, move to temp register for future optimization >> >> Don't split code from add3 for SDI to allow a later pass to split. >> This allows later logic to hoist out constant load in add instructions. >> In loop, lis+ori could be hoisted out to improve performance compared with >> previous addis+addi (About 15% on typical case), weak point is >> one more register is used and one more instruction is generated. i.e.: >> >> addis 3,3,0x8765 >> addi 3,3,0x4321 >> >> => >> >> lis 9,0x8765 >> ori 9,9,0x4321 >> add 3,3,9 > > (This patch will of course have to wait for stage 1). > > Such a define_insn_and_split could be for an add of a (signed) 32-bit > immediate. combine will try to combine the three insns (lis;ori;add), > and match the new pattern. Currently 286r.split2 will split "12:%9:DI=0x87654321" to lis+ori by rs6000_emit_set_const of define_split, do you mean add new define_insn_and_split to do the split? Another patch to do this after this one goes upstream in stage 1? > > This also links in with Alan's work on big immediates, and with paddi > insns, etc. Seems PR94393? Yes, rs6000_emit_set_const calls rs6000_emit_set_long_const for DImode. I tried unsigned long like 0xabcd87654321, 0xffffabcd87654321 and 0xc000000000000000ULL, All of them are outside of loop even without my patch. No difference with or without Alan's patch. 0xabcd87654321: li 9,0 ori 9,9,0xabcd sldi 9,9,32 oris 9,9,0x8765 ori 9,9,0x4321 0xffffabcd87654321: lis 9,0xabcd ori 9,9,0x8765 sldi 9,9,16 ori 9,9,0x4321 0xc000000000000000ULL: li 9,-1 rldicr 9,9,0,1 Thanks, Xionghu > > > Segher >