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 6DF64385840C; Mon, 24 Oct 2022 21:20:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6DF64385840C 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 29OLJdtS014317; Mon, 24 Oct 2022 16:19:39 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 29OLJaOW014316; Mon, 24 Oct 2022 16:19:36 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 24 Oct 2022 16:19:36 -0500 From: Segher Boessenkool To: "Jiang, Haochen" , "gcc-patches@gcc.gnu.org" , "rguenther@suse.de" , "Liu, Hongtao" , "ubizjak@gmail.com" , "richard.earnshaw@arm.com" , "marcus.shawcroft@arm.com" , "kyrylo.tkachov@arm.com" , "rth@gcc.gnu.org" , "gnu@amylaar.uk" , "claziss@synopsys.com" , "nickc@redhat.com" , "ramana.radhakrishnan@arm.com" , "aoliva@gcc.gnu.org" , "hubicka@ucw.cz" , "mfortune@gmail.com" , "dje.gcc@gmail.com" , "linkw@gcc.gnu.org" , "uweigand@de.ibm.com" , "krebbel@linux.ibm.com" , "olegendo@gcc.gnu.org" , "davem@redhat.com" , "ebotcazou@libertysurf.fr" , "jeffreyalaw@gmail.com" , "dave.anglin@bell.net" , richard.sandiford@arm.com Subject: Re: [PATCH 1/2] Add a parameter for the builtin function of prefetch to align with LLVM Message-ID: <20221024211936.GB25951@gate.crashing.org> References: <20221014083406.8406-1-haochen.jiang@intel.com> <20221014083406.8406-2-haochen.jiang@intel.com> <20221019210645.GP25951@gate.crashing.org> <20221020185415.GU25951@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_MANYTO,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 Mon, Oct 24, 2022 at 11:00:26AM +0100, Richard Sandiford wrote: > Segher Boessenkool writes: > > On Thu, Oct 20, 2022 at 07:34:13AM +0000, Jiang, Haochen wrote: > >> > > + /* Argument 3 must be either zero or one. */ > >> > > + if (INTVAL (op3) != 0 && INTVAL (op3) != 1) > >> > > + { > >> > > + warning (0, "invalid fourth argument to %<__builtin_prefetch%>;" > >> > > + " using one"); > >> > > >> > "using 1" makes sense maybe, but "using one" reads as "using an > >> > argument", not very sane. > >> > > >> > An error would be better here anyway? > >> > >> Will change to 1 to avoid confusion in that. The reason why this is a warning > >> is because previous ones related to constant arguments out of range in prefetch > >> are also using warning. > > > > Please don't repeat historical mistakes. You might not want to fix the > > existing code (since that can in theory break existing user code), but > > that is not a reason to punish users of a new feature as well ;-) > > I agree an error would be appropriate for something like > __builtin_clear_cache. But __builtin_prefetch is a hint only. > Nothing should break if the compiler simply evaluates the arguments > and does nothing else. > > Using a warning in that situation means that, if the ranges of > parameters are increased in future, older compilers won't needlessly > reject new code. It means that if we want "2" to have a new meaning in the future, we can not do that, since it will use the semantics of "1" on older compilers (and that might well not be compatible). And for what? Is it ever so convenient for people to write random numbers here? Segher