[Bug c/26367] multiple levels of __builtin_expect
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 16 17:05:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26367
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-02-16
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
As noted in comment #7 the three levels are provided by a combination of
__builtin_expect and __builtin_unreachable, for example like so:
void f_n (void);
void f_p (void);
void f_0 (void);
void f (int i)
{
if (__builtin_expect (i < 0, 0)) __builtin_unreachable (); // certain
if (__builtin_expect (i == 0, 0)) f_0 (); // weak
if (__builtin_expect (i > 0, 1)) f_p (); // strong
}
Is there anything else that's not covered by these two built-ins or can this
bug be resolved?
More information about the Gcc-bugs
mailing list