From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id F40843858D29 for ; Thu, 7 Jan 2021 05:42:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F40843858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kito.cheng@sifive.com Received: by mail-lf1-x130.google.com with SMTP id m25so11834953lfc.11 for ; Wed, 06 Jan 2021 21:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AWJ6RbcrJoZY9/9kEavnu/1exBIqW0foapcjeTVKVjQ=; b=NQA4Cr+njZ+depoNVjyT6+41gEOSrRlwWYhE5vePubrBXqHE6XWGh/6+7hD+OE0nBL 7MWXE4uJXgiHLFIp1C6aJDqE3dw/ClM2XAljWQTM9Z0NpJKJsUDzDiI6oD74rYvt9Pkp tPZ6bh9aBxqqL2R5FAW23mBLVCqjBE26gLRsr+1S73alxg8HwP8zdJm9dpTwu1e3ywlp xTL3FCDoziK2XcyRaHrnp4EpxGGEY4lFcr4P4K/rMyaCbEi4ChHVwwkG5FXEsKW/4zEt 3mZhrPwyxE9jhNkoPbsljFbZrawASCf0tmvteF7S2uw62ImEELK24yHiWmuoH5PFnRKN dIhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AWJ6RbcrJoZY9/9kEavnu/1exBIqW0foapcjeTVKVjQ=; b=gpQJquaijy5HPbd12yT+JUDvz04t5YD6Ce9MHG8BGovioZl2IRt9RPfTgFxeZoJeV/ Bl7kuHmDeQiG8ctGudzSNvTptkFHn6M3q4WCsF6zwKor43iScSGvqAHqJQ1YGkZiNtdn RhQm9YTcKeWG5Ax1IaVX21d8doI7Q1BjdcwdRE/kA2/wMgShz0sHGltPLjIP8+SGH2eJ YlEDwRpUg6BwGnur74vPHodQTBIMVim0rzSjMMubYG6WhpM5/DYM4ZKZ5OOHbPwqEjB9 3qN9crgYiUaYbrka94iJxlKtPPBJ7ShRd+pt9l2XEU1RFzT7QZqpE2bL/3/aQbxHsLJR 5D/g== X-Gm-Message-State: AOAM533a2IzxdVf3/azZekiB5ANGpiXc6kx/iDdeyOxVHUgOtrHxN9OR Xu/FBizbW+GVGheyU0fVzqWwfxVEWWtGqP65MMsnGQ== X-Google-Smtp-Source: ABdhPJwUwfiChsz/7NGptzqBeX9jSqwzL/XKQS+qFNhSojQVLiDpdpfCfhc2XMBl+ytSTEI6R9TRZ1/sI9x9oMhCS54= X-Received: by 2002:a2e:b5a4:: with SMTP id f4mr3524474ljn.407.1609998130660; Wed, 06 Jan 2021 21:42:10 -0800 (PST) MIME-Version: 1.0 References: <20210106173303.27988-1-philipp.tomsich@vrull.eu> In-Reply-To: From: Kito Cheng Date: Thu, 7 Jan 2021 13:41:59 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Zihintpause: add __builtin_riscv_pause To: Andrew Waterman Cc: Kito Cheng , Philipp Tomsich , Jim Wilson , GCC Patches X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: , X-List-Received-Date: Thu, 07 Jan 2021 05:42:13 -0000 Hi Andrew: It's safe to execute on old machine, but it is still a new extension not included on baseline ISA, so I still prefer having -march to guard that, and then we can track that in the ELF attribute to see what extensions and which version are used in the executable / object files. On Thu, Jan 7, 2021 at 11:51 AM Andrew Waterman wrote: > I've got a contrary opinion: > > Since HINTs are guaranteed to execute as no-ops--e.g., this one is > just a FENCE instruction, which is already a mandatory part of the > base ISA--they don't _need_ to be called out as separate extensions in > the toolchain. > > Although there's nothing fundamentally wrong with Kito's suggestion, > it seems like an extra hoop to jump through without commensurate > benefit. I see no reason to restrict the use of __builtin_pause, > since all RISC-V implementations, including old ones, are required to > support it. And, of course, that's the reason we encoded it this way > :) > > > On Wed, Jan 6, 2021 at 7:35 PM Kito Cheng wrote: > > > > Hi Philipp: > > > > Could you add zihintpause to -march parser and guard that on the > > pattern and builtin like zifencei[1-2]? > > > > And could you sent a PR to > > https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md to > > mention __builtin_riscv_pause? > > > > Thanks! > > > > [1] march parser change: > > > https://github.com/gcc-mirror/gcc/commit/b03be74bad08c382da47e048007a78fa3fb4ef49 > > [2] Default version for ext.: > > > https://github.com/gcc-mirror/gcc/commit/4b81528241ca682025d92558ff6aeec91dafdca8 > > > > > > > --- /dev/null > > > +++ b/gcc/testsuite/gcc.target/riscv/builtin_pause.c > > > @@ -0,0 +1,10 @@ > > > +/* { dg-do compile } */ > > > +/* { dg-options "-O2" } */ > > > + > > > +void test_pause() > > > > I would suggest you change the function name in the testcase, > > otherwise the scan-assembler test will always pass even if you didn't > > generate "pause" instruction. > > > > > > > +{ > > > + __builtin_riscv_pause (); > > > +} > > > + > > > +/* { dg-final { scan-assembler "pause" } } */ > > > + > > > -- > > > 2.18.4 > > > >