From: Thomas Monjalon <thomas@monjalon.net>
To: Aleksey Baulin <Aleksey.Baulin@gmail.com>
Cc: dev@dpdk.org, "Wiles, Keith" <keith.wiles@intel.com>
Subject: Re: [PATCH] eal/common: better likely() and unlikely()
Date: Fri, 12 Jan 2018 16:35:01 +0100 [thread overview]
Message-ID: <5180253.XvhpJrJZVt@xps> (raw)
In-Reply-To: <CAJ+OjZkv24B=aVthrj8EepX-jpXtx+Pc1KBuyuTpJ3stMUd3jg@mail.gmail.com>
21/11/2017 08:05, Aleksey Baulin:
> On Mon, Nov 20, 2017 at 4:36 PM, Wiles, Keith <keith.wiles@intel.com> wrote:
> > > On Nov 19, 2017, at 4:16 PM, Aleksey Baulin <aleksey.baulin@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).
next prev parent reply other threads:[~2018-01-12 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 22:16 [PATCH] eal/common: better likely() and unlikely() Aleksey Baulin
2017-11-20 13:36 ` Wiles, Keith
2017-11-20 17:21 ` Jim Thompson
2017-11-21 7:05 ` Aleksey Baulin
2018-01-12 15:35 ` Thomas Monjalon [this message]
2018-01-13 22:05 ` Aleksey Baulin
2018-01-13 22:24 ` Thomas Monjalon
2018-01-13 22:45 ` Aleksey Baulin
2018-01-14 17:17 ` Stephen Hemminger
2018-01-20 16:28 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5180253.XvhpJrJZVt@xps \
--to=thomas@monjalon.net \
--cc=Aleksey.Baulin@gmail.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.