From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 31D583856DCB for ; Thu, 29 Sep 2022 17:12:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 31D583856DCB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 28THB14U002297; Thu, 29 Sep 2022 12:11:01 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 28THB1Rt002296; Thu, 29 Sep 2022 12:11:01 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 29 Sep 2022 12:11:00 -0500 From: Segher Boessenkool To: "Kewen.Lin" Cc: Iain Sandoe , GCC Patches Subject: Re: [PATCH] rs6000: Rework option -mpowerpc64 handling [PR106680] Message-ID: <20220929171100.GY25951@gate.crashing.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e64fed0-7e79-3d60-da62-5c2bf3e2c707@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no 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 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. > +#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. If things are done well, we will end up with *less* code than what we had before, not more! Segher