From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id E6E81394D8A4 for ; Thu, 7 Jan 2021 03:51:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E6E81394D8A4 Received: by mail-ot1-x335.google.com with SMTP id w3so5076510otp.13 for ; Wed, 06 Jan 2021 19:51:09 -0800 (PST) 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=8JkM4rzb9AJYtSMClRvxZDUAYA4PPo4ZNYigfCAi/+4=; b=mahaG5V12d+5g4Hch+lo0E8PgG1rlmmY4ZrshrWPTeY71o8s+y9kSDQHNTOzIYuuWk IhOpq1T8Cg92w4jwFmMlMOZLQ9u/CIWsAE0W3JaAs82Itx66c7vVLwScU+cwRJ8ndYuB IHln6U9mdWhNgQHR0J3Ybtak6+twIWD9asH+ev7vJcOj7uWvF8W6m2zFTzzOARB3MvWj Fw8wGRPAw63TEwINN8cLtwaZcR2xshxudpdCKn+bJ4POhGZKe3ZCwzTLN7bKgpWcLMvC xpJ7N4AQrfrq4PzABL/IKGKlkuylnuJOPqKIZxmwZV/ds8VEzkvIzAcMGaPZytlrZqo7 AXqg== X-Gm-Message-State: AOAM531w8pO2OoTOnVz0A1Q8hKOzh83s5rnNd3sPbZr/oq2TJBroL7l8 IG62Shd3Hy5T56/et2vCMgSXgM0Rs1mSHkbk3k8= X-Google-Smtp-Source: ABdhPJyKgK2jqMbXI6AMLZI/FIUS8wb6RSqW6QjHnT1mh70ewYJvX2gOrrEhMNzY7ChgXfECLR+8j0RMkEuoNh6CxOU= X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr5497562otp.38.1609991469284; Wed, 06 Jan 2021 19:51:09 -0800 (PST) MIME-Version: 1.0 References: <20210106173303.27988-1-philipp.tomsich@vrull.eu> In-Reply-To: From: Andrew Waterman Date: Wed, 6 Jan 2021 19:50:58 -0800 Message-ID: Subject: Re: [PATCH] RISC-V: Zihintpause: add __builtin_riscv_pause To: Kito Cheng Cc: Philipp Tomsich , Jim Wilson , GCC Patches , Kito Cheng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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 03:51:11 -0000 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 > >