From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id E42043857B8D for ; Fri, 23 Sep 2022 15:41:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E42043857B8D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,339,1654588800"; d="scan'208,223";a="83589069" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 23 Sep 2022 07:41:00 -0800 IronPort-SDR: EiONXUuuzTFu4Kksc79uNA0QTYCoXIOg2Lglyuka4X5DpqvyNq0CLr2ts2ZTmJWLuR0SC1B9JX l17Ui9KwHb2BVH5NgTUGPMEkwFFpwtOx6Eusivm4qdiUc4mfrz/4PiPt+Jpi6UD5fL5ce7r+q5 hNrKP6d+9vT6ywwqYWyGaCrLQxSMUFg1HZpWCTlwTcboqJ4MpD0c1sJjTjVcx2mE4j1uEr5YGQ m0bz5G7M6zLuYaQkNUyTeGpqez5jxGvSv05/SAAEBH30sjcxqf50oxH6mBT/3Zfgvj9oPygtUb gG4= From: Thomas Schwinge To: Tobias Burnus , Subject: [og12] Come up with {,UN}LIKELY macros (was: [Patch][2/3][v2] nvptx: libgomp+mkoffload.cc: Prepare for reverse offload fn lookup) In-Reply-To: <8301889b-64f9-8c60-15ca-2fa1fc495791@codesourcery.com> References: <40563a1c-49ef-a185-3c01-9f717cd48fc5@codesourcery.com> <8301889b-64f9-8c60-15ca-2fa1fc495791@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 23 Sep 2022 17:40:44 +0200 Message-ID: <878rmaqetf.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_LOTSOFHASH,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! Since the 2022-09-12 backport of this: On 2022-08-29T20:43:26+0200, Tobias Burnus wrote: > nvptx: libgomp+mkoffload.cc: Prepare for reverse offload fn lookup ... to og12 in commit 2b6ad53fd76c7bb9605be417d137a7d9a18f2117, the og12 branch didn't build anymore: [...]/gcc/config/nvptx/mkoffload.cc: In function 'void process(FILE*, F= ILE*, uint32_t)': [...]/gcc/config/nvptx/mkoffload.cc:284:59: error: 'UNLIKELY' was not d= eclared in this scope if (UNLIKELY (startswith (input + i, ".target sm_"))) ^ [...]/gcc/config/nvptx/mkoffload.cc:289:57: error: 'UNLIKELY' was not d= eclared in this scope if (UNLIKELY (startswith (input + i, ".version "))) ^ make[2]: *** [[...]/gcc/config/nvptx/t-nvptx:8: mkoffload.o] Error 1 > --- a/gcc/config/nvptx/mkoffload.cc > +++ b/gcc/config/nvptx/mkoffload.cc > @@ -261,6 +281,16 @@ process (FILE *in, FILE *out, uint32_t omp_requires) > case '\n': > fprintf (out, "\\n\"\n\t\""); > /* Look for mappings on subsequent lines. */ > + if (UNLIKELY (startswith (input + i, ".target sm_"))) > + { > + sm_ver =3D input + i + strlen (".target sm_"); > + continue; > + } > + if (UNLIKELY (startswith (input + i, ".version "))) > + { > + version =3D input + i + strlen (".version "); > + continue; > + } To fix this, I've pushed a (very much reduced) partial cherry-pick of commit r13-171-g22d9c8802add09a93308319fc37dd3a0f1125393 "Come up with {,UN}LIKELY macros" to og12 branch in commit 44b77201a5431450f608b4538fefb1319127de13, see attached. Gr=C3=BC=C3=9Fe Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Come-up-with-UN-LIKELY-macros.og12.patch" >From 44b77201a5431450f608b4538fefb1319127de13 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 3 Feb 2022 10:58:18 +0100 Subject: [PATCH] Come up with {,UN}LIKELY macros. gcc/ChangeLog: * system.h (LIKELY): Define. (UNLIKELY): Likewise. (cherry picked from commit 22d9c8802add09a93308319fc37dd3a0f1125393, partial) --- gcc/ChangeLog.omp | 8 ++++++++ gcc/system.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 4f80bcbd356..30c3abfc15b 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-09-23 Thomas Schwinge + + Backport from master branch: + 2022-05-09 Martin Liska + + * system.h (LIKELY): Define. + (UNLIKELY): Likewise. + 2022-09-12 Tobias Burnus Backport from mainline: diff --git a/gcc/system.h b/gcc/system.h index e10c34f70ec..6b6868d0bbf 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -736,6 +736,9 @@ extern int vsnprintf (char *, size_t, const char *, va_list); #define __builtin_expect(a, b) (a) #endif +#define LIKELY(x) (__builtin_expect ((x), 1)) +#define UNLIKELY(x) (__builtin_expect ((x), 0)) + /* Some of the headers included by can use "abort" within a namespace, e.g. "_VSTD::abort();", which fails after we use the preprocessor to redefine "abort" as "fancy_abort" below. */ -- 2.35.1 --=-=-=--