From nobody Mon Jul 01 21:49:12 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WCfnj3hWGz5QC1L; Mon, 01 Jul 2024 21:49:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCfnj31zPz44Nx; Mon, 1 Jul 2024 21:49:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719870553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wf2TaSpVrvwuzbPk1y4gUuAcr/aR62B67Z9yO7DHfAc=; b=IhjvSzr7JmmrKYehdPnbl8ViveHHlhQkGcNk+7pB3yUWNlDEzbA58B9bf70Uy9BTRcz3cF wNAe80GiFdn6n+8oeki7F6TtFxkdHv/6rT1JJ/3eZVHgysLLKcEbApgJRXOHCckWAplAww V81kmHP/47KhoYGuicmMrXq83sga/VRKMttqVf3dNYsNpq0a3KpuoFZfjsKkYXkX7iiA/t +gFrREP2ckqriWv9HFT8g0kAuQnsthPtkwLDAD5O8EaXZUJmw1BnzhRYT/SNvgW0nXh3vZ q0OdTZoDbdBPcaZX7XS8eg/ZFDJkZlOyquk4J/IS7M9ZKwICANHMdPlg+OGCoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719870553; a=rsa-sha256; cv=none; b=hRpoieE29Ip7pDE4M46FWUrMBxkoAzCrW4SZxRK3MjejQeaaLRW5q7tWvjKlVkSPu5VZ/K i5Ve3/ydchszP8juXAcSolHiq2kS45b6lKbajcW30rmAO8le7CA46INIlxfTmuanBiAoSX N+Lca4dSdcobgmUwTHpa9ePdAdvc5WoTImaJAbthJHSzJYLbixyjWw5zywTsYrJBpPGnUK BzdI9HdemuSGTjfSnGtsFHO0WAd/qrnbDeQE7mapZGmbS2edDaFX8nhiYF524ZGTew26Q0 krO9n9Z68Yc4vzb0nAAkhKjYTJ5EBeJkv/YgSLmmarHtychDXsiyIccC8mItMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719870553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wf2TaSpVrvwuzbPk1y4gUuAcr/aR62B67Z9yO7DHfAc=; b=iS1jpNwF3V39V2G1Fx6WR/jARvHD2QkR+gBA3kdWsVGNpXU36j7UvRv2OQXh232j5Lky29 KT5Zkl0vo8mbv+q27UDjMV9FGFeoeDamvUFOiHQQFOukpFMVMiFfEvRez08IFyw6bqF+pl F9TXe6X9vCxSYYJtRHf3jMEk25BdLOeuecdGAfrptrZfvdQk2Dh6JqZmLY0X3qJVvFP5Lw gAdwGJ8wU74I+BRIgiN1cUQfzFW89rCYJ4SlAkC0+Z1U/7gbO0ftxgf4Nv2DLSPxfBkeGJ OWMkejRKrytK9LEKwm9vuTcw+EqrFWfgrcwKMkpzY24wJBT9KaBkFtVKghGlSA== Received: from [IPV6:2601:5c0:4200:b830:198e:c253:cce:4f0] (unknown [IPv6:2601:5c0:4200:b830:198e:c253:cce:4f0]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WCfnj17W2zWHW; Mon, 1 Jul 2024 21:49:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <7ca0ab94-4d5e-405e-b178-84ef3d8ebc8d@FreeBSD.org> Date: Mon, 1 Jul 2024 17:49:12 -0400 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 2508372b7b46 - main - cdefs.h: Assume the compiler supports at least GNU C 3.0 extensions Content-Language: en-US To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202406210241.45L2fNU2056962@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202406210241.45L2fNU2056962@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/20/24 7:41 PM, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2508372b7b46117a9fb801b50624265d30888442 > > commit 2508372b7b46117a9fb801b50624265d30888442 > Author: Warner Losh > AuthorDate: 2024-06-20 23:02:42 +0000 > Commit: Warner Losh > CommitDate: 2024-06-21 02:41:08 +0000 > > cdefs.h: Assume the compiler supports at least GNU C 3.0 extensions > > All compilers that can build FreeBSD binaries (as opposed to the entire > system) support at least gcc 9 (gcc, clang, tcc). Even pcc supports most > of the gcc 4.3 attributes. Make this file simpler by removing support > for pre-3.0 compilers. > > Reviewed by: brooks > Differential Revision: https://reviews.freebsd.org/D45653 > Sponsored by: Netflix > --- > sys/sys/cdefs.h | 79 +-------------------------------------------------------- > 1 file changed, 1 insertion(+), 78 deletions(-) > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > index 476c89d1dddb..88019819eb35 100644 > --- a/sys/sys/cdefs.h > +++ b/sys/sys/cdefs.h > @@ -389,45 +367,10 @@ > */ > #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901 > #define __restrict restrict > -#elif !__GNUC_PREREQ__(2, 95) > -#define __restrict > #endif > > -/* > - * GNU C version 2.96 adds explicit branch prediction so that > - * the CPU back-end can hint the processor and also so that > - * code blocks can be reordered such that the predicted path > - * sees a more linear flow, thus improving cache behavior, etc. > - * > - * The following two macros provide us with a way to utilize this > - * compiler feature. Use __predict_true() if you expect the expression > - * to evaluate to true, and __predict_false() if you expect the > - * expression to evaluate to false. > - * > - * A few notes about usage: > - * > - * * Generally, __predict_false() error condition checks (unless > - * you have some _strong_ reason to do otherwise, in which case > - * document it), and/or __predict_true() `no-error' condition > - * checks, assuming you want to optimize for the no-error case. > - * > - * * Other than that, if you don't know the likelihood of a test > - * succeeding from empirical or other `hard' evidence, don't > - * make predictions. > - * > - * * These are meant to be used in places that are run `a lot'. > - * It is wasteful to make predictions in code that is run > - * seldomly (e.g. at subsystem initialization time) as the > - * basic block reordering that this affects can often generate > - * larger code. > - */ > -#if __GNUC_PREREQ__(2, 96) > #define __predict_true(exp) __builtin_expect((exp), 1) > #define __predict_false(exp) __builtin_expect((exp), 0) > -#else > -#define __predict_true(exp) (exp) > -#define __predict_false(exp) (exp) > -#endif I think the comment was worth keeping around. You just need to modify the start of it to "Modern compilers include explicit branch prediction..." In particular, I think our current practice is still to apply prediction hints rather conservatively. -- John Baldwin