Using likely() and unlikely()
Clang ignores branch predictor hints using __builtin_expect
#define likely(x) __builtin_expect ((x), 1) #define unlikely(x) __builtin_expect ((x), 0)
The rule of the thumb is: Mark branch that you want to be executed quickly as "likely" and the other branch as "unlikely".
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.