21/11/2017 08:05, Aleksey Baulin: > On Mon, Nov 20, 2017 at 4:36 PM, Wiles, Keith <keith.wi...@intel.com> wrote: > > > On Nov 19, 2017, at 4:16 PM, Aleksey Baulin <aleksey.bau...@gmail.com> > > wrote: > > > -#define unlikely(x) __builtin_expect((x),0) > > > +#define unlikely(x) __builtin_expect(!!(x), 0) > > > > I have not looked at the generated code, but does this add some extra > > instruction now to do the !!(x) ? > > Sorry for late response. Jim had given the correct answer already. > You won't get an extra instruction with compiler optimization turned on.
So this patch is adding an instruction in not optimized binary. I don't understand the benefit. Is it just to avoid to make pointer comparison explicit? likely(pointer != NULL) looks better than likely(pointer).