From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot0-f193.google.com (mail-ot0-f193.google.com [74.125.82.193]) by dpdk.org (Postfix) with ESMTP id 65A4223A for ; Mon, 20 Nov 2017 18:21:49 +0100 (CET) Received: by mail-ot0-f193.google.com with SMTP id o23so8262086otd.1 for ; Mon, 20 Nov 2017 09:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Pb1MQPE+YgkUK0EhReg0HWL2uLP/kozO2aoALsaOiE8=; b=a/pso15kpBWTVbzaW6K5dPW2nXgjcxvTUsr8JXUPnYsESO2pK5s1MbQMi1xHWgIOHs FqzHWKbjGTPzaqi6YbIvFk0GEHLAOcvk1vgglI4QSBgehCYD70n/22qhkyHlPUIo0paY HlD3i3AAgj51X2vDugjPnS029SZ3MUDJIPpjk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Pb1MQPE+YgkUK0EhReg0HWL2uLP/kozO2aoALsaOiE8=; b=dsPHgb+/jUMWfFxBHuWRBwxtAsvMs/KL26S6GsJGS0FDFKsai+uHhJoj9nbptPXAtr ohaSeejOwL6CyWpfKL6hRTSs8hMV2tSwkdN2e0s7rfWLdSDUvxXWC9P5vnmqUCTUa4KI /fKmZEaZThUKkWTk/BV0VGu1UNDgahRSWC1khihmoKpUjoQeRoJDNq9zzn/kRskVvwGq ZbyfWJkOE2ru+CSpKkoaxfwl/x/v78Paz7Pph4dXFlBN/oCpF4ZOfX9LG//CK3xbBOPn 4E9X2t9s4N+Vxek5W7HCojKkK8sIiwvwS+kIOBA3nz8Cge7o5mMrq0fegPowlSwzUN0Z GJkg== X-Gm-Message-State: AJaThX6NuuzvYSDr1xWqjfBkiUE1aceEQKr0v/I9OSu3wyLsU4yGcjk0 JO3TlB4+hQ5O5fGSq+w+geiIUw== X-Google-Smtp-Source: AGs4zMauIVLRZ7DRzZIptPqWFupZaL0xcewQ/WS4paLva1hOsvBvH2h2LV945WS5ohTAfg7hkDD75g== X-Received: by 10.157.16.36 with SMTP id h33mr3348980ote.208.1511198508516; Mon, 20 Nov 2017 09:21:48 -0800 (PST) Received: from [172.27.33.51] ([208.123.73.28]) by smtp.gmail.com with ESMTPSA id d8sm4664384oig.42.2017.11.20.09.21.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 09:21:47 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) From: Jim Thompson In-Reply-To: Date: Mon, 20 Nov 2017 11:21:47 -0600 Cc: Aleksey Baulin , Thomas Monjalon , "dev@dpdk.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <1511129764-23123-1-git-send-email-Aleksey.Baulin@gmail.com> To: "Wiles, Keith" X-Mailer: Apple Mail (2.3445.4.7) 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: Mon, 20 Nov 2017 17:21:49 -0000 > On Nov 20, 2017, at 7:36 AM, Wiles, Keith = wrote: >=20 >> On Nov 19, 2017, at 4:16 PM, Aleksey Baulin = wrote: >>=20 >> #ifndef unlikely >> -#define unlikely(x) __builtin_expect((x),0) >> +#define unlikely(x) __builtin_expect(!!(x), 0) >=20 > I have not looked at the generated code, but does this add some extra = instruction now to do the !!(x) ? >=20 >> #endif /* unlikely */ >>=20 >> #endif /* _RTE_BRANCH_PREDICTION_H_ */ >> --=20 >> 2.7.4 >>=20 >=20 > Regards, > Keith >=20 With no =E2=80=98-O=E2=80=99, you get an extra cmpl instruction with the = double negated unlikely() .vs the one without the =E2=80=98!!=E2=80=99. The same assembly is generated with =E2=80=98-O=E2=80=99 as a compiler = switch. Tested on: [jim@blackbox-1 ~]$ uname -a Linux blackbox-1.netgate.com 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 = 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux [jim@blackbox-1 ~]$ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is = NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR = PURPOSE. Jim=