From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by sourceware.org (Postfix) with ESMTPS id 1825C396E828 for ; Sat, 17 Dec 2022 09:40:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1825C396E828 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-qv1-xf2e.google.com with SMTP id pv25so3234372qvb.1 for ; Sat, 17 Dec 2022 01:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NXequEAFfke1t+NuebwOeQdNHKVwtqxqZm1tE1k/oC8=; b=T/EVyIDxVUCf6WszHvjTAn7rt6GkXtS4fQWyHnxaGnBFy1Wu6cVKP/MSq+VnsJyTKb J/ytkBrMs0KcIO7cv+K63/cZeURSm70qHHpBjcMahI58xpGNYRKgay3BS15/GhhfXOAg MCMhgiBWQmbmb11I8GxHkCSm4rkNmQVaiDIJHfopM2T3qUertiGs0xzp/izqu3UVmLBb iqXmM1rgjHIwcuRvKnNXaEygZZU4PzVbkQeByE4ijEdtx8j77FA0CrceTQzHkmqZ3SVM TZuOjoZmQt3QtoZk1v+i3rNTVuS29HosmiS+DLpYA26sNH+aoYnIq8LIAJEMUqapZ3Pb WX5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NXequEAFfke1t+NuebwOeQdNHKVwtqxqZm1tE1k/oC8=; b=4i4odIh+l2sFp4lr/UsQz+I7F5nbxCDW2gA0qIVNz22lFVRqtdbXuooyUzMTx/XgQg kpJ/t2gJ5SMmVKpC+R0LKioQyBtWJcsjpo8l4BZfLxfp4pwKErKGU/zwQSFeuhtLtrFj +fdwTqpv8dv7JTbxXB0ieFTZ5kKx2Qt0ei5MkqGPWX4vRXBEaAyKhdWR5zHd6Okwedpg C3ht1ernk/PH/DiqrpWrMAig9XkMM9IdcawenpqlI8F/Gy4kpDLhu7iszxB8e7lSFOjj RnJe8fd9IY6vB9/9ZdnEZoeCW3WxcePMsFqVVTXLoaIhDI7uC/C+l0FpsTj3Dzz0DkWz ghMw== X-Gm-Message-State: ANoB5pmz5rpNSzSy8oUrh02Zgx2P83v62fdK899GeUmMmCsCb2BUvSnm 6/255xI4i+lukC5eg+9nA41f3NyKQ8jy6a5xSb/pEEhKEXFPFE4hTc6ti6BQT6RUnUoT+nOSDlJ bj4BRR6fevD3qlriXr3sQYXS7llcJt8YchylOUWVmu+SAZaqUN9dY1eB+vtpq13CwWGnzL2M= X-Google-Smtp-Source: AA0mqf53kPjPUrif67380duJIkOCfOCKCuF1UAmwiKppp5JetVc5fpBQ4Ihd+8WGO0lZ2+A28DxXDA== X-Received: by 2002:ad4:404c:0:b0:4c7:884:7739 with SMTP id r12-20020ad4404c000000b004c708847739mr43590635qvp.52.1671270055059; Sat, 17 Dec 2022 01:40:55 -0800 (PST) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com. [209.85.219.181]) by smtp.gmail.com with ESMTPSA id v18-20020a05620a0f1200b006cf38fd659asm3387104qkl.103.2022.12.17.01.40.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Dec 2022 01:40:54 -0800 (PST) Received: by mail-yb1-f181.google.com with SMTP id j206so4839723ybj.1 for ; Sat, 17 Dec 2022 01:40:54 -0800 (PST) X-Received: by 2002:a25:25c2:0:b0:706:ba81:7944 with SMTP id l185-20020a2525c2000000b00706ba817944mr10857105ybl.561.1671270053670; Sat, 17 Dec 2022 01:40:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Waterman Date: Sat, 17 Dec 2022 01:40:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] RISC-V: Note that __builtin_riscv_pause() implies Xgnuzihintpausestate To: Palmer Dabbelt Cc: Kito Cheng , gcc-patches@gcc.gnu.org, Greg Favor Content-Type: multipart/alternative; boundary="000000000000df763605f002e126" X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: --000000000000df763605f002e126 Content-Type: text/plain; charset="UTF-8" It took me a few minutes to understand the purpose of this chicanery, but there's indeed a contradiction in the ISA spec. HINT instructions _do_ affect architectural state in a limited fashion--namely, updating the PC. So, it's incorrect to say that PAUSE changes no architectural state. Because these statements are contradictory, a common-sense reading should parse this as "PAUSE changes no architectural state in the same informal sense as other HINTs". Otherwise, PAUSE wouldn't actually be a HINT. I'm just going to delete the erroneous text. This eliminates the contradiction and makes the spec consistent with both the de facto and de jure golden models, which behave in the common-sense manner Palmer's Xgnuzihintpausestate extension would suggest. To avoid confusion, I strongly suggest deleting all references to Xgnuzihintpausestate, since its existence invites a question that no longer needs to be answered. cc'ing Greg since AFAICS he merged in the erroneous text. On Fri, Dec 16, 2022 at 8:48 AM Palmer Dabbelt wrote: > On Mon, 28 Nov 2022 10:45:51 PST (-0800), Palmer Dabbelt wrote: > > On Fri, 18 Nov 2022 09:01:08 PST (-0800), Palmer Dabbelt wrote: > >> On Thu, 17 Nov 2022 22:59:08 PST (-0800), Kito Cheng wrote: > >>> Wait, what's Xgnuzihintpausestate??? > >> > >> I just made it up, it's defined right next to the name like those > >> profile extensions are. I figured that's the most RISC-V way to define > >> something like this, but we could just drop it and run with the > >> definition -- IIRC we just stuck a comment in for Linux and QEMU, I > >> doubt anyone is actually going to implement the "doesn't touch PC" > >> version of pause. > > > > Just checking up on this one. I don't care a ton about the name, just > > that we document where we're intentionally violating the specs. > > I'm just committing this one, no big deal if you want to change the > wording. I just want it out of my queue. > > > > >> > >>> On Fri, Nov 18, 2022 at 12:30 PM Palmer Dabbelt > wrote: > >>>> > >>>> gcc/ChangeLog: > >>>> > >>>> * doc/extend.texi (__builtin_riscv_pause): Imply > >>>> Xgnuzihintpausestate. > >>>> --- > >>>> gcc/doc/extend.texi | 4 +++- > >>>> 1 file changed, 3 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi > >>>> index b1dd39e64b8..26f14e61bc8 100644 > >>>> --- a/gcc/doc/extend.texi > >>>> +++ b/gcc/doc/extend.texi > >>>> @@ -21103,7 +21103,9 @@ Returns the value that is currently set in > the @samp{tp} register. > >>>> @end deftypefn > >>>> > >>>> @deftypefn {Built-in Function} void __builtin_riscv_pause (void) > >>>> -Generates the @code{pause} (hint) machine instruction. > >>>> +Generates the @code{pause} (hint) machine instruction. This implies > the > >>>> +Xgnuzihintpausestate extension, which redefines the @code{pause} > instruction to > >>>> +change architectural state. > >>>> @end deftypefn > >>>> > >>>> @node RX Built-in Functions > >>>> -- > >>>> 2.38.1 > >>>> > --000000000000df763605f002e126--