Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Mar 2010 16:14:49 -0600
From:      Scott Long <scottl@samsco.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        max@love2party.net, rwatson@freebsd.org, freebsd-arch@freebsd.org
Subject:   Re: likely and unlikely
Message-ID:  <DA31205F-41FA-4AC3-888E-2001210EE623@samsco.org>
In-Reply-To: <20100318.161117.658811636873842325.imp@bsdimp.com>
References:  <201003121513.38721.max@love2party.net> <20100313200155.O22734@delplex.bde.org> <alpine.BSF.2.00.1003131346270.51476@fledge.watson.org> <20100318.161117.658811636873842325.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mar 18, 2010, at 4:11 PM, M. Warner Losh wrote:
> In message: <alpine.BSF.2.00.1003131346270.51476@fledge.watson.org>
>            Robert Watson <rwatson@FreeBSD.org> writes:
> :=20
> : On Sat, 13 Mar 2010, Bruce Evans wrote:
> :=20
> : >> My point is: Handle with care!!!  Trust your compiler/CPU
> : >> predictors/... - most of the time, they are smarter than you are =
;)
> : >
> : > These macros may have useful 15-25 years ago for i386, i486 and
> : > Pentium1, since CPU branch predictors were either nonexistent or =
not
> : > so good. After that, CPU branch predictors became quite good.  The
> : > macros should have been mostly unused 15-25 years ago too, since =
they
> : > optimize for unreadability and unwritability.  Fortunately they =
are
> : > rarely used in FreeBSD.  They were imported from NetBSD in 2003 =
where
> : > they are used more (306 instances in 2005 NetBSD /sys vs 28 =
instances
> : > in 2004 FreeBSD /sys; there are 2208 instances of likely() in 2004
> : > linux-2.6.10).
> :=20
> : I think it would be reasonable to expect that people deploy branch
> : prediction macros (as with prefetch, etc) only where there's =
specific
> : measurements that indicate they are important to have there -- at =
the
> : very least, pmc data, but ideally also benchmarking data.
>=20
> They are more useful on architectures where you have branches that
> tell the CPU if they are likely or unlikely to be taken...
>=20

And that's a very good point, one that Bruce really failed to address.  =
Not only
is branch prediction useful for MIPS and ARM, I suspect that it's also =
useful
for Atom.

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DA31205F-41FA-4AC3-888E-2001210EE623>