From patchwork Fri Sep 23 15:40:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp284308wrt; Fri, 23 Sep 2022 08:41:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7np8c2IB/FCxMm9ToUpb5qEO1HEBv819PfWXxIrPeUU7mJSNHRkHiDD1pRdR2Py8btTI5x X-Received: by 2002:a05:6402:134e:b0:456:8aae:2dd4 with SMTP id y14-20020a056402134e00b004568aae2dd4mr3493272edw.139.1663947688199; Fri, 23 Sep 2022 08:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663947688; cv=none; d=google.com; s=arc-20160816; b=ENvFfMqJElclNgRbtTxRawsXaQS370WWn/4APr3KUamFWknP5//t/nb7yexYfnfyW2 SY0QzN6pJEyhkId6R4UFu+6fiXZyb6k9/Jqbpbx/TP9rCFC4iLmzOwjui4e8lmGwBFmP NqlNuSuzHQu3CYytOLOMX8olJptaU5qfPMdsMHZhnz/HucQ3GcLp4FbRkrZw5TjpdX4v yDpAXRduLpPXpMCYglHSe2eJRyAm6ZKvY+3knBLmSJLa5O0W9JmZlAgIuz4zJzMgXtNs 11kTvGuT1qWpoAZutruUCozGRfUmC1USfhwyj3mhxhB1SekxG83khv00CdXwO6wDRD72 xplA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=KdF5DZgGCp29dS8FgIh8DqDfXxRqiL6ssKX3uMxmqT8=; b=lmL0Itx9JQWYbYpjzm6z0UQ1aL1Bt77TilKJlh5c2N9EXWy8osBmwUEWa2DkUz/pLR LD/eiv3FvrnX0rDD59xv6HlyyAoqj0fhAocdMb+PTliBo0QKRz+PbPxYNs9oaqTRONCW 0wJhVeemow43TMF34pf5/qKTohIAvEf+ExHJS8aVHIw5KSgeVJSNVA3ZdAH2BjZ3Wf+p iRac96vKeiCSpuAa+6iQ7G8PMAiFPWPDuxJFBnqiAaykrQMz2XygTXyrg5JP7eINJ+IL ORei2L37ZrHwbrF5bKyE18rSMjqgUU3s3j9oS7riLK/9CEXttdKlOls88/l7BsUbY5Md w4GQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h17-20020a05640250d100b00443e3fe60a0si7687977edb.622.2022.09.23.08.41.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 08:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9978B385703E for ; Fri, 23 Sep 2022 15:41:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744775611025987497?= X-GMAIL-MSGID: =?utf-8?q?1744775611025987497?= 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*, FILE*, uint32_t)': [...]/gcc/config/nvptx/mkoffload.cc:284:59: error: 'UNLIKELY' was not declared in this scope if (UNLIKELY (startswith (input + i, ".target sm_"))) ^ [...]/gcc/config/nvptx/mkoffload.cc:289:57: error: 'UNLIKELY' was not declared 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 = input + i + strlen (".target sm_"); > + continue; > + } > + if (UNLIKELY (startswith (input + i, ".version "))) > + { > + version = 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üße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 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