From patchwork Fri Jan 6 09:28:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 62776 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2E8D3858430 for ; Fri, 6 Jan 2023 09:29:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2E8D3858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672997344; bh=m/YSHyvOT4BIEYZc4pdCn3PZ3tfKhC3XjuBQvOSpw9s=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=D91NAh/30N7qt6Y+j0MLAAcSGTr/GQBTjVWoK57jGyHItZ7Tgn2EVHDP5h5F+WTBO 3eOTvtnl/l0Jt8hjmVtHZs+Qk+Sd4KpHzL+EJrCIAimSZKG2XrMH6+XK8SyuDPm+LD fXkWDo/8ATOPFm+4KRSzbQkdSJa5XCKjEQs+ypYk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 32EBB3858D28 for ; Fri, 6 Jan 2023 09:28:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32EBB3858D28 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3066U0hx023331; Fri, 6 Jan 2023 09:28:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mxee8k3ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Jan 2023 09:28:34 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3069LUQ9017595; Fri, 6 Jan 2023 09:28:34 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 3mxee8k3y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Jan 2023 09:28:34 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3068Z41G002786; Fri, 6 Jan 2023 09:28:32 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3mtcq6g31r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Jan 2023 09:28:31 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3069STqO44695952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Jan 2023 09:28:29 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 737BF20043; Fri, 6 Jan 2023 09:28:29 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C75C120040; Fri, 6 Jan 2023 09:28:27 +0000 (GMT) Received: from [9.197.231.22] (unknown [9.197.231.22]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 6 Jan 2023 09:28:27 +0000 (GMT) Message-ID: Date: Fri, 6 Jan 2023 17:28:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US Subject: [PATCH] rs6000: Allow powerpc64 to be unset for implicit 64 bit [PR108240] To: GCC Patches Cc: Segher Boessenkool , David Edelsohn , Peter Bergner X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4zP0RlEPb0gXL63r6WpHuJRXZjuQrWp3 X-Proofpoint-ORIG-GUID: _tVdVaREys5ct47A7UXRvoe4B-1WjxyA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-06_05,2023-01-05_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxscore=0 mlxlogscore=932 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301060066 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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 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-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, Before r13-4894, if 64 bit is explicitly specified, option powerpc64 is explicitly enabled too; while if 64 bit is implicitly enabled and there is no explicit setting for option powerpc64, option powerpc64 is eventually enabled or not would rely on the default value of the used cpu. It's initially set as the setting for 64 bit, but later if the used cpu doesn't have powerpc64 supported by default, it gets cleared. To keep it consistent with before (also the relevant error/ warning messages), this patch is to allow that powerpc64 can be unset if 64 bit is enabled implicitly, and only stop it from being unset if 64 bit is enabled explicitly. Note that since the behaviors are different for implicit and explicit 64 bit, I failed to construct one solid test case since it becomes fragile once RUNTESTFLAGS specifying -m64 explicitly. BTW, the exposed latent ICE is still there, would be fixed by a separated patch later. Bootstrapped and regress-tested on: - powerpc64-linux-gnu P7 and P8 {-m64,-m32} - powerpc64le-linux-gnu P9 and P10 - powerpc-ibm-aix7.2.0.0 {-maix64,-maix32} I'm going to push this next week if no objections. BR, Kewen ----- PR target/108240 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_option_override_internal): Allow implicit powerpc64 setting to be unset if 64 bit is enabled implicitly. --- gcc/config/rs6000/rs6000.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 6ac3adcec6b..a9e1a790f28 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -3662,14 +3662,17 @@ rs6000_option_override_internal (bool global_init_p) /* Without option powerpc64 specified explicitly, we need to ensure powerpc64 always enabled for 64 bit here, otherwise some following - checks can use unexpected TARGET_POWERPC64 value. Meanwhile, we - need to ensure set_masks doesn't have OPTION_MASK_POWERPC64 on, - otherwise later processing can clear it. */ + checks can use unexpected TARGET_POWERPC64 value. */ if (!(rs6000_isa_flags_explicit & OPTION_MASK_POWERPC64) && TARGET_64BIT) { rs6000_isa_flags |= OPTION_MASK_POWERPC64; - set_masks &= ~OPTION_MASK_POWERPC64; + /* Need to stop powerpc64 from being unset in later processing, + so clear it in set_masks. But as PR108240 shows, to keep it + consistent with before, we want to make this only if 64 bit + is enabled explicitly. */ + if (rs6000_isa_flags_explicit & OPTION_MASK_64BIT) + set_masks &= ~OPTION_MASK_POWERPC64; } /* Process the -mcpu= and -mtune= argument. If the user changed