[Top] [All Lists]

Re: compile errors

To: Steve Lord <lord@xxxxxxx>
Subject: Re: compile errors
From: "Andi Kleen" <ak@xxxxxxx>
Date: Thu, 27 Apr 2000 18:55:46 +0200
Cc: Andrew Park <apark@xxxxxxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx, suzukis@xxxxxxxxxxxxxxxxxxxxxx, ealonso@xxxxxxxxxxxxxxxxx
In-reply-to: <200004271646.LAA00417@xxxxxxxxxxxxxxxxxxxx>; from lord@xxxxxxx on Thu, Apr 27, 2000 at 11:46:05AM -0500
References: <apark@xxxxxxxxxxxxxxx> <200004271646.LAA00417@xxxxxxxxxxxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
On Thu, Apr 27, 2000 at 11:46:05AM -0500, Steve Lord wrote:
> The pragmas are still there because I want to find a way to tell gcc that
> this is an infrequently executed code path. If you know how to do that I
> will change them all.

This is only supported in gcc-current (since about two weeks or so) and 
in the latest GnuPRO release from cygnus. You do it via __builtin_expect(),

        ptr = function(); 
        if (__builtin_expect(ptr == NULL, 0)) { 
                /* error path */

At least for == NULL checks gcc-current (the upcoming gcc 3.0) will default
to not predicted. When you compile with -freorder-blocks it should also
move the error path out of line (in theory, -freorder-blocks seems to be
still rather buggy). I don't know what GnuPro does exactly with 
__builtin_expect, apparently it is a different implementation.

I'm guess it'll be quite some time until gcc 3.0 is released and accepted
generally for Linux kernel development (the later is probably years away)


<Prev in Thread] Current Thread [Next in Thread>