From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B249C3858CDB for ; Fri, 30 Sep 2022 12:15:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B249C3858CDB 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 (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28UC9p7O028836; Fri, 30 Sep 2022 12:15:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=7smrdKLcy89LwiMElLTADi0zX5ZzteqWsvIFA5AhBI8=; b=YLzWJGghatW+EIDArtNRHtYUJ1XELxXmrAF+fdRIVL2w5OtrEGcpsn+CVRujRwU5MN4g IWb8O5uBqw5S+WId5U2zftNigtuA4y7v5iiZw/6PnocGigUPiYFTJS3Sin7MfQEFF6Bq yUOJ1KeDABMwwmmxDfL43M0wdMzHXlcPt9nRsuTIZDgTRXrx5MaBO13UAbbP5YhirPrz FCTEGbCh6+uDq3ipYxHCqUr6lXmIGBfNqFqWAulEoVOyhcOqxFtHyv3b18WcxKuPuQ1G CgtgAV0s4Q/N679fhs2OgLMn3p18Uq+X4Cz7Q05o/GudEezDwLFB4RbSpFMgFdbnUdCE ew== Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jwyy8gh1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Sep 2022 12:15:44 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28UC52bv018550; Fri, 30 Sep 2022 12:15:43 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 3jssh9624g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Sep 2022 12:15:42 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28UCFeeg6685230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Sep 2022 12:15:40 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9415C5204F; Fri, 30 Sep 2022 12:15:40 +0000 (GMT) Received: from [9.197.236.39] (unknown [9.197.236.39]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4DB435204E; Fri, 30 Sep 2022 12:15:39 +0000 (GMT) Message-ID: Date: Fri, 30 Sep 2022 20:15:37 +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 Subject: Re: [PATCH] rs6000: Rework option -mpowerpc64 handling [PR106680] Content-Language: en-US To: Segher Boessenkool Cc: Iain Sandoe , GCC Patches References: <9d9f1f43-b528-387d-45a7-1d89400de0fc@linux.ibm.com> <5B4DCBBB-3237-4A9F-ACCA-6669DE6905B8@sandoe.co.uk> <92415AC8-4A5A-4119-BFCC-D7C66472F961@sandoe.co.uk> <5e64fed0-7e79-3d60-da62-5c2bf3e2c707@linux.ibm.com> <20220929171100.GY25951@gate.crashing.org> From: "Kewen.Lin" In-Reply-To: <20220929171100.GY25951@gate.crashing.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: A79tn-nWRMcwfGB7oANPOP_sfpjICCVW X-Proofpoint-ORIG-GUID: A79tn-nWRMcwfGB7oANPOP_sfpjICCVW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-30_04,2022-09-29_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 malwarescore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209300076 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,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: on 2022/9/30 01:11, Segher Boessenkool wrote: > On Thu, Sep 29, 2022 at 01:45:16PM +0800, Kewen.Lin wrote: >> I found this flag is mainly related to tune setting and spotted that we have some code >> for tune setting when no explicit cpu is given. >> >> ... >> >> else >> { >> size_t i; >> enum processor_type tune_proc >> = (TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT); >> >> tune_index = -1; >> for (i = 0; i < ARRAY_SIZE (processor_target_table); i++) >> if (processor_target_table[i].processor == tune_proc) >> { >> tune_index = i; >> break; >> } >> } > > Ah cool, that needs fixing yes. > >> --- a/gcc/config/rs6000/rs6000.cc >> +++ b/gcc/config/rs6000/rs6000.cc >> @@ -3702,7 +3702,7 @@ rs6000_option_override_internal (bool global_init_p) >> else >> { >> /* PowerPC 64-bit LE requires at least ISA 2.07. */ >> - const char *default_cpu = (!TARGET_POWERPC64 >> + const char *default_cpu = (!TARGET_POWERPC64 && TARGET_32BIT >> ? "powerpc" >> : (BYTES_BIG_ENDIAN >> ? "powerpc64" > > ... but not like that. If this snippet should happen later just move it > later. Or introduce a new variable to make the control flow less > confused. Or something else. But don't make the code more complex, > introducing more special cases like this. Agree, the diff was mainly to check if it's the root cause. I think we need to place TARGET_POWERPC64 enablement for 64 bit before this hunk, I've adjusted it in the new version, will post it once it's full tested. > >> +#ifdef OS_MISSING_POWERPC64 >> + else if (OS_MISSING_POWERPC64) >> + /* It's unexpected to have OPTION_MASK_POWERPC64 on for OSes which >> + miss powerpc64 support, so disable it. */ >> + rs6000_isa_flags &= ~OPTION_MASK_POWERPC64; >> +#endif > > All silent stuff is always bad. > OK, with more testings for replacing warning instead of silently disablement I noticed that some disablement is needed, one typical case is -m32 compilation on ppc64, we have OPTION_MASK_POWERPC64 on from TARGET_DEFAULT which is used for initialization (It makes sense to have it on in TARGET_DEFAULT because of it's 64 bit cpu). And -m32 compilation matches OS_MISSING_POWERPC64 (!TARGET_64BIT), so it's the case that we have an implicit OPTION_MASK_POWERPC64 on and OS_MISSING_POWERPC64 holds, but it's unexpected not to disable it but warn it. BR, Kewen > If things are done well, we will end up with *less* code than what we > had before, not more! > > > Segher