[Patch, Fortran] Use __builtin_expect in libgfortran
Andrew Thomas Pinski
pinskia@gmail.com
Sun Aug 3 14:44:00 GMT 2008
Sent from my iPhone
On Aug 3, 2008, at 3:36, Tobias Burnus <tobias.burnus@physik.fu-berlin.de
> wrote:
> This patch replaces
>
> if (unlikely fulfilled condition)
> runtime_error (...);
>
> by
> if (__builtin_expect (unlikely fulfilled condition, 0))
> runtime_error (...);
>
> to speed up the library.
If rutime_error is marked as noreturn, gcc already does this internally.
-- Pinski
>
>
> See: http://www.imodulo.com/gnu/gcc/Other-Builtins.html
>
> "The use of __builtin_expect has now two uses:
>
> - on platforms where conditional jump instructions have prediction
> bits
> this information can be used to set them
>
> - on all architectures it should now be possible to use
> -freorder-blocks
> to use the information to put the basic blocks in an order which
> guarantees an optimal straight pass through the code for the
> normal case."
> (quote from http://sources.redhat.com/ml/libc-hacker/2000-04/msg00129.html
> -freorder-blocks is enabled with -O2)
>
>
> I hope that I have not missed any place or wrongly marked something as
> likely/unlikely which is not.
>
>
> Build and check-gfortraned on x86-64-linux
> OK for the trunk?
>
> Tobias
> <built-expect.diff>
> <built-expect-gen.diff.gz>
More information about the Fortran
mailing list