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(),
e.g.:
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)
-Andi
|