Generating branch hints

Generating branch hints

Is there any support for generating branch hints for jumps? GCC has intrinsic __builtin_expect.
It should be useful to support something like this in all versions of the intel compiler, ie. for Windows and Linux. IA64 and new IA32 processors have branch hints for jumps.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Do you not consider the prof_gen and prof_use options to be built in? In their absence, Intel compilers are quite bull-headed in their optimization of code according to the forward conditional branch not taken heuristic. It often pays to make changes such as from
if(!(...));else break;

This is ugly, and maybe should not be necessary, but not so ugly as what you suggest.

Personally, I would prefer the old-fashioned branch probability pragmas over __builtin_expect, but the market rejected those years ago. Branch optimization in Intel compilers is quite different from gcc, although both support profile guided optimization feedback.

Yes, I am aware of PGO. But sometimes you need to make a "public" library distributed as precompiled binary. Then making suggestions to the compiler may be helpful, because no PGO for "endusers" is available.
Moreover, these libraries are often portable to a set of compilers, so making changes from if() to if()else can disturb other compilers.
I would prefer something like __builtin_expect (ie. as "function") mainly for compatibility with GCC.

The team is aware of __builtin_expect and is considering support for it in a future versions.


Thank you for the answer directly from the source:-)
Is there any time or version horizon for implementing it?

We are targetting support for this feature in 8.0 which is due out in the next few months.


Leave a Comment

Please sign in to add a comment. Not a member? Join today