From owner-freebsd-arch@FreeBSD.ORG Fri Mar 19 01:44:05 2010 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAB83106566B; Fri, 19 Mar 2010 01:44:05 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8EF8FC14; Fri, 19 Mar 2010 01:44:05 +0000 (UTC) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.14.3/8.14.3) with ESMTP id o2J1hvVc013954; Thu, 18 Mar 2010 19:43:57 -0600 (MDT) (envelope-from scottl@samsco.org) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Scott Long In-Reply-To: <20100318.165725.480410072667175878.imp@bsdimp.com> Date: Thu, 18 Mar 2010 19:43:57 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <15D5A6D4-1594-4667-AE51-0E26950C81DA@samsco.org> References: <20100318.161117.658811636873842325.imp@bsdimp.com> <20100318.165725.480410072667175878.imp@bsdimp.com> To: "M. Warner Losh" X-Mailer: Apple Mail (2.1077) X-Spam-Status: No, score=-1.0 required=3.8 tests=ALL_TRUSTED autolearn=unavailable version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on pooker.samsco.org Cc: max@love2party.net, rwatson@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 01:44:06 -0000 On Mar 18, 2010, at 4:57 PM, M. Warner Losh wrote: > In message: > Scott Long writes: > : On Mar 18, 2010, at 4:11 PM, M. Warner Losh wrote: > : > In message: = > : > Robert Watson 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 > :=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. >=20 > The PMC work will tell us that... >=20 My understanding was that Atom wasn't super-scalar at all and has no = branch prediction or out-of-order logic. It's basically an 80486 with a = modern instruction set. Scott