From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id A79481B014 for ; Fri, 12 Jan 2018 16:35:32 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1594B20C47; Fri, 12 Jan 2018 10:35:32 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 12 Jan 2018 10:35:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=ulYxBgQHxJ24TyGxDMGLwGkfGO 3C2NeLo8YeX/2paD0=; b=smqTVHGxjkZGp/Gj3sON8fiyuiHO+GIga2d52ycQzF uhXyxuR4ZJkkL4U0FP/y75dH9IYz8jNfm6p+KEOCgSTVQ0kgORlKai3NF88YzX4F IGvaPNi2zhd36gkJdsrCCVwhDVGsOtDnII9c6BRTnNh+4ICxIyzcCtxJHyRqEEwi A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ulYxBg QHxJ24TyGxDMGLwGkfGO3C2NeLo8YeX/2paD0=; b=moI1LK/8Y3HKEMX6jnloUp j5ZWhxXtHJaQ/UqNir8lLayY+Jx+T+eeqpsK55pQFGulwNZMCJ0GD8063CWgqiay rrx8TeKnfMigTNCAF6PFOpERGDD/AuTpp6qqRCckHN+9LlTeXmKBxTyeesIS7hAX LHUqKvlyiIxic2ZL0p/0XhEv/3k/Ddt3epXaxP7Q80BIH8mMdgvNWKh2ztmWnEwJ d2aVfi3TzSw9g9oIXRjI0JousL829PcfOWSElEOVB0MIKG5Vh5BCrb3A45xxHpkk HeuxbpASyPLb5YIYMTP50rz0Hmexh/UB5oesxIgDIqljL6kEjKWEKkN47w96nPMQ == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id B3E5224600; Fri, 12 Jan 2018 10:35:31 -0500 (EST) From: Thomas Monjalon To: Aleksey Baulin Cc: dev@dpdk.org, "Wiles, Keith" Date: Fri, 12 Jan 2018 16:35:01 +0100 Message-ID: <5180253.XvhpJrJZVt@xps> In-Reply-To: References: <1511129764-23123-1-git-send-email-Aleksey.Baulin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] eal/common: better likely() and unlikely() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 15:35:32 -0000 21/11/2017 08:05, Aleksey Baulin: > On Mon, Nov 20, 2017 at 4:36 PM, Wiles, Keith wrote: > > > On Nov 19, 2017, at 4:16 PM, Aleksey Baulin > > 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).