[PATCH] Use __glibc_(un)likely instead __builtin_expect.

Mike Frysinger vapier@gentoo.org
Sat Feb 8 14:43:00 GMT 2014


On Wednesday, December 04, 2013 10:49:11 Ondřej Bílka wrote:
> On Mon, Oct 28, 2013 at 12:48:43PM +0530, Siddhesh Poyarekar wrote:
> > On Wed, Oct 23, 2013 at 12:01:31AM +0200, Ondřej Bílka wrote:
> > > Hi,
> > > 
> > > Now I return to one of todo-list issues which is using
> > > glibc-likely/unlikely.
> > > 
> > > First comes a easy case which can be expressed as following script.
> > > 
> > > cat $1 | sed -e "s/if (__builtin_expect (\(.*\), 0))/if
> > > (__glibc_unlikely (\1))/" | sed -e "s/if (__builtin_expect (\(.*\),
> > > 1))/if (__glibc_likely (\1))/"> 
> > Based on Roland's comment, I did some automated verification of the
> > patch.  I found the following problems:
> > 
> > 1. Changes in whitespace in macro definitions
> > 2. Changes in whitespace in malloc routines
> > 
> > Could you fix these and repost?
> 
> I reposted patch but sourceware thinks its spam,
> 
> To avoid that use following link:
> 
> http://kam.mff.cuni.cz/~ondra/libc_likely.patch

the ChangeLog entries need line wrapping

i did a scan of the diff and it looked fine.  i did notice some entries with 
redundant paren, but it's not entirely something you introduced:
-      else if (__builtin_expect ((a < 0.0), 1))
+      else if (__glibc_likely ((a < 0.0)))

so if it compiled fine, LGTM
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140208/4421fd77/attachment.sig>


More information about the Libc-alpha mailing list