From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 43CB53858C50; Mon, 24 Oct 2022 10:00:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 43CB53858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D5682ED1; Mon, 24 Oct 2022 03:00:36 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54BE23F7B4; Mon, 24 Oct 2022 03:00:27 -0700 (PDT) From: Richard Sandiford To: Segher Boessenkool Mail-Followup-To: Segher Boessenkool ,"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 Cc: "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" Subject: Re: [PATCH 1/2] Add a parameter for the builtin function of prefetch to align with LLVM 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> Date: Mon, 24 Oct 2022 11:00:26 +0100 In-Reply-To: <20221020185415.GU25951@gate.crashing.org> (Segher Boessenkool's message of "Thu, 20 Oct 2022 13:54:15 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-37.2 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: 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. So personally I think we should stick with the current choice of a default-on warning. Thanks, Richard