From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id B07C13854544 for ; Fri, 18 Nov 2022 02:14:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B07C13854544 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-oi1-x234.google.com with SMTP id l127so3954836oia.8 for ; Thu, 17 Nov 2022 18:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; 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=IYE9npaCIgdjOlyxioWnzI3+b8ZhFB2F7MH/mtwOO+g=; b=sbFVvWMhFqylr1goV7vkP/8TW+JZ8fCDstRs23YUDUaXYQ7W7NCJipalIoBd4UKc7W isazLbN37PHeqLyBH6peP6fiYjKaf5egv7l7ZhtwBvV+mnBYQegry5pfe1pz4KSt6oOi oGlf1nMpWLZ/dO9vnS3Z7E4BDYmd0AkTFfGKKET3KBaiY3mfDORFl2rMI5ER4X7meZ27 9qUbSTpKDl2jSBdj3I/HDqUgvHOudWY41jdZmVzFBZ1TDpcPHSY7+MgA28t2VSY9Fdwm MsiCL7QaXYRznQAG2RYlP2nG1blcXJOOvjPDASJP13O3wtf7X5vzVmFQq27UhSbrcN1P /DZw== 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=IYE9npaCIgdjOlyxioWnzI3+b8ZhFB2F7MH/mtwOO+g=; b=Aby4tTdE26JXyUfthirlq4/H4fR34Eh4P2llQU+Yk43lrvq+n1zmJ/NInfjk4yzhEH 4qjXoKTfPUkpeItQbsnySQWWHum1NqOSRzfsLsopdPzTpD/ZnK/z+/Wx9lNLDZSX2Wud RuztM8gPZeWFwX8YOqMzwe6YMvDz5g16EXw2d/jY4UNSB8pqUmGGJVU1azp9u+5K+Egr gg7+qvvMdtJN2yRImcgUgJ7IXYnwarIL1bFVI/Z+OiR66qYWApAToHTpooWCr+hwYB6N X+jDWqFlhnhRdjrS0c7Y7/L6E72NV/34sZYRFIxJ9c8DrUt7M0CegRfc8VP5bUd+205i JOtA== X-Gm-Message-State: ANoB5pnKgtCP/mRrXT6U/0cXQAL+1u4dEkyF7jwcY02J1ExAdrJPaWu+ Dszr+U/urfe3iiv2zluIvj5rk7PIrliLhytQA9i4nw== X-Google-Smtp-Source: AA0mqf5Sy2g6zZFImPG28lZ9J1/LzsUF7IKR3LQxr9TK+uTan3pbftBpzAH/WYfgE87DMj1bFLIMrZ8QKrDDA5NhzxI= X-Received: by 2002:a05:6808:1649:b0:34b:7532:2d0e with SMTP id az9-20020a056808164900b0034b75322d0emr2585754oib.109.1668737668961; Thu, 17 Nov 2022 18:14:28 -0800 (PST) MIME-Version: 1.0 References: <20221109030036.19175-1-palmer@rivosinc.com> In-Reply-To: <20221109030036.19175-1-palmer@rivosinc.com> From: =?UTF-8?Q?Christoph_M=C3=BCllner?= Date: Fri, 18 Nov 2022 03:14:18 +0100 Message-ID: Subject: Re: [PATCH] RISC-V: Add the Zihpm and Zicntr extensions To: Palmer Dabbelt Cc: gcc-patches@gcc.gnu.org, Philipp Tomsich , Kito Cheng , Vedvyas Shanbhogue , Nelson Chu , Jeff Law Content-Type: multipart/alternative; boundary="000000000000fb693905edb54375" 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,JMQ_SPF_NEUTRAL,KAM_SHORT,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: --000000000000fb693905edb54375 Content-Type: text/plain; charset="UTF-8" On Wed, Nov 9, 2022 at 4:01 AM Palmer Dabbelt wrote: > These extensions were recently frozen [1]. As per Andrew's post [2] > we're meant to ignore these in software, this just adds them to the list > of allowed extensions and otherwise ignores them. I added these under > SPEC_CLASS_NONE even though the PDF lists them as 20190614 because it > seems pointless to add another spec class just to accept two extensions > we then ignore. > > 1: > https://groups.google.com/a/groups.riscv.org/g/isa-dev/c/HZGoqP1eyps/m/GTNKRLJoAQAJ > 2: > https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/QKjQhChrq9Q/m/7gqdkctgAgAJ > > gcc/ChangeLog > > * common/config/riscv/riscv-common.cc: Add Zihpm and Zicnttr > extensions. > > --- > > These deserves documentation, a test case, and a NEWS entry. I didn't > write those yet because it's not super clear this is the way we wanted > to go, though: just flat out ignoring the ISA feels like the wrong thing > to do, but the guidance here is pretty clear. Still feels odd, though. > We already have the infrastructure in GAS to check the CSR numbers. It is an optional feature, but it is here and working. We follow the guidance in the default configuration (CSR checking needs to be turned on). As long as we want to keep this infrastructure, there is no question if we should continue to support new extensions as required by this feature: We have to because everything else will lead to a broken feature. The question if CSR checking in GAS should be removed or not does not have to be answered right now if there is doubt about making the wrong decision. Additionally, I fully agree that we can not ignore unknown extensions. We must report an unknown extension in the march string to the user. And even without CSR checking, GCC needs to be aware of all extensions (e.g. for possible future support of -march=native). So I think this patch should go in (together with a test). That's why I also sent something similar for Smaia and Ssaia: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606640.html BR Christoph > We've also still got an open discussion on how we want to handle -march > going forwards that's pretty relevant here, so I figured it'd be best to > send this out sooner rather than later as it's sort of related. > --- > gcc/common/config/riscv/riscv-common.cc | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/common/config/riscv/riscv-common.cc > b/gcc/common/config/riscv/riscv-common.cc > index 4b7f777c103..72981f05ac7 100644 > --- a/gcc/common/config/riscv/riscv-common.cc > +++ b/gcc/common/config/riscv/riscv-common.cc > @@ -190,6 +190,9 @@ static const struct riscv_ext_version > riscv_ext_version_table[] = > {"zicbom",ISA_SPEC_CLASS_NONE, 1, 0}, > {"zicbop",ISA_SPEC_CLASS_NONE, 1, 0}, > > + {"zicntr", ISA_SPEC_CLASS_NONE, 2, 0}, > + {"zihpm", ISA_SPEC_CLASS_NONE, 2, 0}, > + > {"zk", ISA_SPEC_CLASS_NONE, 1, 0}, > {"zkn", ISA_SPEC_CLASS_NONE, 1, 0}, > {"zks", ISA_SPEC_CLASS_NONE, 1, 0}, > -- > 2.38.1 > > --000000000000fb693905edb54375--