From patchwork Wed Nov 9 03:00:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 17325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp105834wru; Tue, 8 Nov 2022 19:02:23 -0800 (PST) X-Google-Smtp-Source: AMsMyM4qyDvZuE2YhIEZjdYQXkbUP9BFtf/uxrASI/HG1yz4G0oTccU+qk7Dh6xB24NulmsQzFa1 X-Received: by 2002:a17:907:6288:b0:78d:ab30:c374 with SMTP id nd8-20020a170907628800b0078dab30c374mr55574143ejc.266.1667962943311; Tue, 08 Nov 2022 19:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667962943; cv=none; d=google.com; s=arc-20160816; b=gHTZfSeDSFvtmhFOyFjVlaWTpwYaZH8a7z0mq11IG7O28rukNVBN5ajibh12smGAfi otHn4Q8XLlw9EqZs+2OO72H2fJJNhIxUqoo3VqIfadhUUu8thXz+fmJO8Zr3B82cx3JN /VJmOddEie7WfrtjSviagES5xHt+Y/IjXsh1uFLxWUpDDKp2rLYrZHBYvV/JTNJYEUdt uymEmjTde/g11tqbAPH5rlhISWPQn8JqEzDrWQ8m8C3KlyPC+EzQeFxBxbCddfO3Llrr mQlmb1NF+Cx5f7xHUyivkcBN1LOSOPIyV3oyUUaeItBskmobJoArr8C2mKqtvTIOh1vK aUhg== 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:to:from:cc :content-transfer-encoding:mime-version:message-id:date:subject :dkim-signature:dmarc-filter:delivered-to; bh=FIpvsttOkxBXJWizCtCGQKEHTjXxnGv/MHk31gLeVUU=; b=owCAdc6cKz9lYvBkMlY8fcQjHqI7zMkx5XAbxKrzB61BkredsChJgMWEGUDZOpKpLU HzPggXczkfc4kmOiD9uQW1EFgcosTE5kxQFzTb5ZNC9cmx3hf6afFD/Oqb8BvL2oZyvD RXb5wTQrsA5hMAogeQwqmtRjVdy716edWaI/fgc1uQzFF9LhMxcmMRXxl1mO/8iUx/t0 zdZ+JzGNx1XyEBDW8VjPcqI7TKEW5cu446fBijqp/FFEWaVPw7YRltBnzZ7pbHpLPx52 NkKhu8vE18n/TjLjacQK6Sh4wWbM+hyvU4ZcgPUvw3HaB+D8z8Fbi0uhJMMtabPGP53J 4f8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="mQf37/wI"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y22-20020a056402359600b0045c13366de4si15825869edc.572.2022.11.08.19.02.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:02:23 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="mQf37/wI"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 D6E683858029 for ; Wed, 9 Nov 2022 03:01:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id DF99A385842F for ; Wed, 9 Nov 2022 03:00:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF99A385842F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pg1-x531.google.com with SMTP id 78so15036531pgb.13 for ; Tue, 08 Nov 2022 19:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=FIpvsttOkxBXJWizCtCGQKEHTjXxnGv/MHk31gLeVUU=; b=mQf37/wI7PE1aXVaS7XQ4jR/cEnIrX1lIdlQT13HKUHb70W5SF87Lmw+L5uFRVkjBh UEkac2CKLqs9wekQj6kUDbxN6dpMorNMd9ElF+63DJVJFtbX1YQzzU5vv8ODyhSfR3bB M9gr/KMZMqHQ8ZKjnsQFK0ylPGjgfDpsvDagRRWiw2Ipb8CdMCEE+6kjzOr6ghURfSEy 70sAX58OGASyA5lSSgMLBWq0kegoQbhLhAOW59NyJURYmmgGaRPhyf591EifjUhTTvdc xP/XF+jKpWrk2h/iCE2OUks9qqkgi9mpH9pFJHVOjsqWksEFZMpnFtAhqvWBMCw3QdoI DtRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FIpvsttOkxBXJWizCtCGQKEHTjXxnGv/MHk31gLeVUU=; b=KBHlSO19MEfxq0uRshdPZVwz2y62eWQCvxfnLLvgTIutaLhfL+2l/7/uVRbuPys5/n UlxCEgIpabVZ46EvBuDPmzq6OaGK673ZNZjVRh/K0iukWZfvyzsU373QDLcz0brASzFl KdLXa72Y1vqamFWB/u9JYUBlIDKq99mZQ5QoM++pnvv88bC98ajiI6b95rUKKwtfHnUy VxsDddTay8to5XfJ4tNGQZ1sVAgxJnSO7je0sDLJKRA/Q8+Xz3JgFHquFFhzIUSnlDrq 64HloAzD2gJouCq78xtR5sIK+msJKAlCV6CewREOBA88XCHlkWhuaPJ/vVy9KuH4TBz0 WICA== X-Gm-Message-State: ACrzQf21siKUjgOUgR8apmJUoGUR5xBH/gfA6vkO2PGhUKTP+QgaN2bd GH4c4m38K++XZVvlOChFs3DIt7psmOUPcw== X-Received: by 2002:a63:ff10:0:b0:46f:efa0:2824 with SMTP id k16-20020a63ff10000000b0046fefa02824mr34523801pgi.460.1667962849859; Tue, 08 Nov 2022 19:00:49 -0800 (PST) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id c188-20020a624ec5000000b0056c0d129edfsm7063787pfb.121.2022.11.08.19.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:00:49 -0800 (PST) Subject: [PATCH] RISC-V: Add the Zihpm and Zicntr extensions Date: Tue, 8 Nov 2022 19:00:36 -0800 Message-Id: <20221109030036.19175-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 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?1748985911396640422?= X-GMAIL-MSGID: =?utf-8?q?1748985911396640422?= 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'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},