From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2063.outbound.protection.outlook.com [40.107.22.63]) by sourceware.org (Postfix) with ESMTPS id 7CB6E3858D20; Mon, 14 Mar 2022 16:05:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7CB6E3858D20 Received: from AS8PR04CA0032.eurprd04.prod.outlook.com (2603:10a6:20b:312::7) by VI1PR08MB4431.eurprd08.prod.outlook.com (2603:10a6:803:fe::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Mon, 14 Mar 2022 16:05:00 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:312:cafe::f4) by AS8PR04CA0032.outlook.office365.com (2603:10a6:20b:312::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26 via Frontend Transport; Mon, 14 Mar 2022 16:05:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 16:05:00 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Mon, 14 Mar 2022 16:05:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e865f08e5c27e4cf X-CR-MTA-TID: 64aa7808 Received: from 69ba91ce583e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F1FF3A5F-C718-4B71-B584-5A5F1AE97CD5.1; Mon, 14 Mar 2022 16:04:52 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 69ba91ce583e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Mar 2022 16:04:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNttK+CNN4dUs/KSnVH9MhqIeVCjge7rdWP3MftXEUKEl62sIfuqxffpMdmYbYnlSoePR1Bg4b3pKIdWz+WKyXBCXFeEk2ucgqbHiXw+iRgQTqt+v+W9t+Xpxs01qNeEgH+Az9EJ7+TChocC6vLklsUdSxs8YnZFL/J/X/zSRs78Jztvv/Z368ZVWJ8JNramyARIiOvY6eerauDGzOA7PdWeaA05WEsswdm+6h/rEzYEBi6QhDINIce79tgIIa3ZX+oqUkrKuCdabTZb8XTHar/3CK9A1wLTpEIF9S9ezpCdFNk8rSa4wZt7ei5Dx53g7yYa9+YvYerNLDwB4iorDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ixCmnDB1cKi9mD6Mvoi7o394OVBh+sRP5vCc3TLxmIc=; b=h8yJeFswlXpIy1BQ1mlC8DkZC927CuLwrEfIMH8cmV1TI07+7AgAPAmFLn0n8+QNrmC5CKvjmLjCOKbTVl2TLAjtogjl0G4ZDiEs0mognCaAkPFJ0Xk7fueKBldsCV+QH69f6bFmd+8xKJzJPHZZxE8W6TZoe1wJ0yvGtn0MP1lF/g+Kj7EYKTTbPobwyMpTcyAL3KXW6mW0HFcggxuNsc3CrdcBai5R8zR9HYTm3pb0IqSjHZpuPLcQKfD7NrWv3u36HmF9l9kcm07WKpx9hrrXw/9qYOturTEewQ6Fvou+tErY5gRwVskT90l63Csukv592h2+vjyTtT/E/mkl3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DBAPR08MB5589.eurprd08.prod.outlook.com (2603:10a6:10:1a2::23) by PA4PR08MB5967.eurprd08.prod.outlook.com (2603:10a6:102:e7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.25; Mon, 14 Mar 2022 16:04:50 +0000 Received: from DBAPR08MB5589.eurprd08.prod.outlook.com ([fe80::b5c1:bcf1:ffcf:8219]) by DBAPR08MB5589.eurprd08.prod.outlook.com ([fe80::b5c1:bcf1:ffcf:8219%6]) with mapi id 15.20.5061.028; Mon, 14 Mar 2022 16:04:50 +0000 From: Richard Sandiford To: Xi Ruoyao Mail-Followup-To: Xi Ruoyao , Qing Zhao , Jeff Law , "gcc-patches\@gcc.gnu.org" , YunQiang Su , Jakub Jelinek , richard.sandiford@arm.com Cc: Qing Zhao , Jeff Law , "gcc-patches\@gcc.gnu.org" , YunQiang Su , Jakub Jelinek Subject: Re: [PATCH RFC] mips: add TARGET_ZERO_CALL_USED_REGS hook [PR104817, PR104820] References: <93ab62b2b9473733e5118f4265b61804978adfd7.camel@mengyan1223.wang> <53408AB1-0FA4-4529-95D9-A10FA8999DF6@oracle.com> <4ec3ce765b9959334d2a3e08d8957fc2fcf57f7d.camel@mengyan1223.wang> Date: Mon, 14 Mar 2022 16:04:48 +0000 In-Reply-To: (Xi Ruoyao's message of "Sun, 13 Mar 2022 14:03:23 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO4P123CA0162.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::23) To DBAPR08MB5589.eurprd08.prod.outlook.com (2603:10a6:10:1a2::23) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 125ebadf-bd2e-43a9-f170-08da05d4647b X-MS-TrafficTypeDiagnostic: PA4PR08MB5967:EE_|AM5EUR03FT013:EE_|VI1PR08MB4431:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: t5sBbOW9xFy8Ks1hO38RtoXQ42txzKoGO9eh6fIiyXH02xmS6AWbSdHclzuYYLqY07CC7JtuQCa0lovoui9BckQbsG4xKBwwuNVHkiGa6sihN4j36KtjyGVqUawBJKTEy8enLSwFFifmvHEVLwpE9cDNKR1vUdO/NQTBLBfEB8fsadSElrpJjhprqsrAn2clBg4+/xr9BeNP0tHsIT/Q//u//CLY7zYrT1/zeB2JexN0OJ99tT6Fvx6f0V48cybKHRNFrYEYyZDz4rNf7zFAJgJUDZC0D5Ses2+6YaSg0IQCbxomcFD+V1tUTTxFYGJM461aNQab6oyL52ZOcaUhcWAG8WetBl1m+Qz6+racZA7R8raosYY6pPwNyDAtPPm8jfh6v4ILZO7UgMMgYKoUesC1YMIvwoGTBPhh7R8C/JQI2sI+8AbPkvybxZ8qXam1eJlrACz+xbY0bQXJiMlC9CHcS2kcXYlvyQ7MAFzu/a6SaGjzATSdlkehwF0bxeOfvj6vNp75yparhksc8ah5aYTuC/1W5fNYVL75kMsrf7benwvXtVH5sSrExzFV5GZafpJde4bqx+zpGzjVOo4AAjhiQ+h9Evvi5TyeCwQvY1C4urLsiUtwZEmC+dPl6c5kpGYqT4RLyjh8ShMs+egolpg08OqL7IYH0P1EoZEQftA8PVkc48Uvo73LfXu9pDuGV+WjTnS+EYauRA2HAzNSYQmGyCnv+lJLAVJTWjKxwNxi2n2z/tg7fVx3F0uQehiNxACKMlsRfHlS/OQ/emWmYg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5589.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(44832011)(36756003)(83380400001)(186003)(26005)(54906003)(5660300002)(86362001)(6916009)(8936002)(2906002)(6512007)(2616005)(316002)(38100700002)(6486002)(508600001)(966005)(66556008)(66476007)(66946007)(8676002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5967 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 74dc13d0-54f4-43b4-9704-08da05d45e9d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mNjflG3dPJaMrvH3AEWpnOmvd7p5YPMykhievGCYY2holNIjuxvDoCzLdjRhGQ2moB5BRKg9NHkrs5Yqmk4uqAwVtDz4jjozK2mbfxugE4LYwolwpfh4Dlt/x/lHFq8hm8/IoiYvIIBOO+KNC5Yzr9iwgVtnP/MjwQajVrYBI05M7jqNnpjK7bbVUh3g2o7sO8lV8XrIbLe71aIvwIEC/HY6kfAKsd03T1Bj8JCKFc3hl7UIanc3QtMZBKPzkyGELgoR9/Wf9ZhaAOKP9hevBvzxX2AqAaqAZJ7mJtlgeSIq+57ZqUI/b3OnbSu4DP+jBzDmRA/LD98jpzMtyBo5kLnM+gdTvPHfFEkdEYDX4hO8P9wLkNxtwxndVmOBd3YO4uEehYcgGTrr6rkmcp/YckX1G4ZIM3y4qRiJltXXn1a+DkRMjzGEw1LByx/x+bhafzMp6XhNEo3C/XcDJYBgG80lmQgLcKWLXHUj/CzaK6PlSg6Hwnjl7gCRG0YczPstcInxBSCOseZggb9hXjWyNM3teHXddw8fH8KEq1wuKRDGm6r/pHU9WAUo6fTKFSvi4iparKRG1ez6zMEyratCwntsb7TlCMgp6hCt/uXWZdHgi4qk439YvWTA2npU9bQliS37kr7Bxsp1knZg/xckkPuVagjJnLvrr8K+uODsAKsSjgYbBuR2gq/VVk1efXMP8skQ6J37PEcLq5T07GNTaIjBuXMPZh6cvLTikUBTcRkxu3ef3WHb90u0OaSUa51awjxF/jkGOJq3OOsXa4kc6NpKmDTbZ5xuK9ljkcrLmms= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(6506007)(36756003)(83380400001)(44832011)(186003)(26005)(54906003)(47076005)(5660300002)(86362001)(40460700003)(8936002)(6512007)(2906002)(2616005)(316002)(81166007)(82310400004)(356005)(36860700001)(336012)(6486002)(508600001)(450100002)(70586007)(966005)(4326008)(70206006)(6862004)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 16:05:00.2459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 125ebadf-bd2e-43a9-f170-08da05d4647b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4431 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 14 Mar 2022 16:05:16 -0000 Sorry for the slow response, was out for a few days. Xi Ruoyao writes: > On Sat, 2022-03-12 at 18:48 +0800, Xi Ruoyao via Gcc-patches wrote: >> On Fri, 2022-03-11 at 21:26 +0000, Qing Zhao wrote: >> > Hi, Ruoyao, >> >=20 >> > (I might not be able to reply to this thread till next Wed due to a >> > short vacation). >> >=20 >> > First, some comments on opening bugs against Gcc: >> >=20 >> > I took a look at the bug reports PR104817 and PR104820: >> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104820 >> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104817 >> >=20 >> > I didn=E2=80=99t see a testing case and a script to repeat the error, = so I >> > cannot repeat the error at my side. >>=20 >> I've put the test case, but maybe you didn't see it because it is too >> simple: >>=20 >> echo 'int t() {}' | /home/xry111/git-repos/gcc-test-mips/gcc/cc1 - >> nostdinc -fzero-call-used-regs=3Dall >>=20 >> An empty function is enough to break -fzero-call-used-regs=3Dall.=C2=A0 = And >> if >> you append -mips64r2 to the cc1 command line you'll get 104820.=C2=A0 I >> enabled 4 existing tests for MIPS (reported "not work" on MIPS) in the >> patch so I think it's unnecessary to add new test cases. >>=20 >> Richard: can we use MIPS_EPILOGUE_TEMP as a scratch register in the >> sequence for zeroing the call-used registers, and then zero itself >> (despite it's not in need_zeroed_hardregs)? > > No, it leads to an ICE at stage 3 bootstrapping :(. > > Now I think the only rational ways are: > > (1) allow zeroing more registers than need_zeroed_hardregs. I think this is the way to go. I agree it's a bit hacky, but it seems like the least worst option. A less hacky alternative would be to pass an extra argument to the hook that contains the set of registers that the hook is *allowed* to clobber. For -fzero-call-used-regs=3DX, this new argument would be the set that would have been chosen for -fzero-call-used-regs=3Dall, regardless of what X actually is. We could then assert that the extra registers we want to clobber are in that set (which will be true for all values of X). > Or > > (2) allow zeroing less registers than need_zeroed_hardregs (then I'll > skip ST_REGS, after all they are just 8 bits in total). Yeah, this is explicitly OK, provided that the target maintainers feel that the contents of the registers in question are not a significant security concern. I don't feel I can make that call though. It's really a question for the userbase. Thanks, Richard > If all these are unacceptable, then > > (3) I'll just call sorry in MIPS target hook to tell not to use this > feature on MIPS.