__builtin_expect

Previous Other built-in functions provided by GCC Next

long __builtin_expect (long exp, long c);

You may use __builtin_expect to provide the compiler with branch prediction information.

The return value is the value of exp, which should be an integral expression. The value of c must be a compile-time constant. The semantics of the built-in are that it is expected that exp == c. For example:

if (__builtin_expect (x, 0))
  foo ();
would indicate that we do not expect to call foo, since we expect x to be zero. Since you are limited to integral expressions for exp, you should use constructions such as
if (__builtin_expect (ptr != NULL, 1))
  error ();
when testing pointer or floating-point values.