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 CA8483858D1E; Tue, 29 Nov 2022 13:37:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA8483858D1E 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 (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATDJWgd001518; Tue, 29 Nov 2022 13:37:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version; s=pp1; bh=4XKKSAUTMIlVeBitj+pAPT0KuCE/n3GKpKoaFeSBubg=; b=ifX9Kz7B2br2nWRwav22lCml+dTNvyRybsAFYOMAj3DXOXjX0D+3QPL6iY6jDL0FCHkA re+J5GrgCMwPGTODtzl2w+4XqS/IeX5Byc/8LH7zBLgDoayTyGhGESyP7kvL6ouTvncl 1vIuxbOEkmxZ5wXxFIjVVlUFOIVOogyXQvgLauyEtn3RHc3XFUIbe9hIeKrHPs7rBucg nxoRI0935AOdmw3SS1IlmKKBNr/P98aGvo6vObMP28dZOlLAsl2yQ606xodcRtpSCKKi CsfNAiVtrJwU9DsWiIrRim8w9b2YvZxRErisPYE3zJwcgUuWGp6rfbNnrhAi8UCnKBJw sQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m5jv00j33-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 13:37:36 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2ATDK97Y003350; Tue, 29 Nov 2022 13:37:35 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m5jv00j1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 13:37:35 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2ATD5STY031498; Tue, 29 Nov 2022 13:37:33 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 3m3ae9c3wd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 13:37:32 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2ATDbU131180236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 13:37:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8364AE045; Tue, 29 Nov 2022 13:37:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D92C7AE04D; Tue, 29 Nov 2022 13:37:29 +0000 (GMT) Received: from pike.rch.stglabs.ibm.com (unknown [9.5.12.127]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 29 Nov 2022 13:37:29 +0000 (GMT) From: Jiufu Guo To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, guojiufu@linux.ibm.com, rguenther@suse.de, jeffreyalaw@gmail.com Subject: [PATCH V3] Use sub-mode to move block on struct param and ret Date: Tue, 29 Nov 2022 21:37:29 +0800 Message-Id: <20221129133729.185336-1-guojiufu@linux.ibm.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: y9h76wFRXLcOdATI5KHCki9lP-0DmVmN X-Proofpoint-GUID: nej5HNG95udgAYUWo-l61Ro0Th7RW6Cj X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_08,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290078 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP 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, When assigning a parameter to a variable, or assigning a variable to return value with struct type, "block move" are used to expand the assignment. It would be better to use the register mode according to the target/ABI to move the blocks. And then this would raise more opportunities for other optimization passes(cse/dse/xprop). As the example code (like code in PR65421): typedef struct SA {double a[3];} A; A ret_arg_pt (A *a){return *a;} // on ppc64le, expect only 3 lfd(s) A ret_arg (A a) {return a;} // just empty fun body void st_arg (A a, A *p) {*p = a;} //only 3 stfd(s) This patches check the "from" and "to" of an assignment in "expand_assignment", if it is about param/ret which may passing via register, then use the register mode to move sub-blocks for the assignning. This patches are based on the discussions for previous version: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606498.html When drafting this patch, I also investigated to update gimplify/nrv to replace "return D.xxx;" with "return ;". While there is one issue: "" with PARALLEL code can not be accessed through address/component_ref. In this patches serial, the first patch is adding support for assigning from parameter; the second support assigning to returns; the last one adds test cases. BR, Jeff (Jiufu)