From patchwork Tue Feb 6 17:38:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Lu X-Patchwork-Id: 197570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1703959dyb; Tue, 6 Feb 2024 09:39:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcr4OtbD4W/5L5Bg3pJw+7HHacQsU+OeX6QUdnFb8yTl31rDrvtqyN/3MRycSf/wUqMscU X-Received: by 2002:ac8:4e49:0:b0:42b:eb39:e201 with SMTP id e9-20020ac84e49000000b0042beb39e201mr3589633qtw.61.1707241176995; Tue, 06 Feb 2024 09:39:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707241176; cv=pass; d=google.com; s=arc-20160816; b=LW0GUUj4JTag2r42u7Vgw+N9dqWo9FclF9n2svUu1Yg9x6/QnAVA/Nuusq5p7pcuMw ZXLVtxEENJiN0bPse/EKf/wFYao3q6yxs1Wg/GEXzfOr/LzLaegrjwQRZqCDDERleCse shGyknegjMSuw7PifKVkAMhgZ40+jM16e2+4yPf1IUf4s1ySLM8QFinxfetBi4zzkNQE bc1l9PlWH1jnr8v6zHhAIXsqHMuPNmpdT7mppSoZ7zZCZXT1qiOJOOUgftCf2UW9zuSK CxmaoBNKwMhKeh8GyRirJ1Zf3/U5OE1YOdEwyG9Kq1ylmLpmDU5ZBaWj1410Nj4L/LcJ EalA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=aVTsnybiZ8DGTppk2uffcY5XjYR/pNWXIH+yikDCrJg=; fh=zEkhuCA5jHfZIZ88MCTrsJa5kJvpQp4Vw4rHLlAMM8c=; b=uE/aGKXxgtMip1O6AeW7F3UUwwySUfAh3piS7wIDfG9VbI7NU9zFFI1dfTr1ySV+Yj DGkehDIaP/PrOKNZjJ9eRby666v4XR994rgWr0LgFbKtg7W+n+di8ZUchzsSmufN1lb/ PmFloIX86y2r22dzPOpOTlCSCwsQXEdwGjotPCOD6Vm3Y9oyios6ZAF7eQhLkL4L2j4m YgMZPCVy1LGtI1n7dyOpCRImmelxl6MGpXUMnqSQc1Z+XZQwTqhdZDJ6uf0/nS5hyj2L U30suVeCaKGqRhAsF4xFvqy1CO8s/Gi4zRoDabVr5kwWpVjT82PulYPrxCN1GZET2JYG nhdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=pyhFsW3q; arc=pass (i=1); 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" X-Forwarded-Encrypted: i=1; AJvYcCVrlPZk7Bym2V8/muylLUaq1U5PuBx2GOk+KCzwJ5mrbLo/kPXRv6ogXIUn32mgpHDKDlqg13036ehyM3Xqi7DY3A3E8g== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e11-20020ac85dcb000000b0042c260dff43si2827695qtx.637.2024.02.06.09.39.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 09:39:36 -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.20230601.gappssmtp.com header.s=20230601 header.b=pyhFsW3q; arc=pass (i=1); 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 B2FE63858429 for ; Tue, 6 Feb 2024 17:39:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 2297F3858C29 for ; Tue, 6 Feb 2024 17:38:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2297F3858C29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2297F3858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707241132; cv=none; b=eq8WaUrbkIOpO3P0HG+6JnZozvR5n6T9cJqyJOI7E8gZFgXABbICYvtNPdUIKhMau/TpQEezRISiWAVg0YMO3oneF2pSHkoHK1ETH61PFCAdQmEi7sqxIzFVkaON18YFtxucrFSMOcJ8SnhWIffL5uNnrSVSDAFl9XoFbug3LEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707241132; c=relaxed/simple; bh=v6mmUBIhxEZAKIpkMzgcoNt6bLrOGk1nn7pUgq2A//I=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=U8Hq+s2I3WqoxPdZSlxu0ygY0ZCwwKlstcpzP3JXsslCoGGENhMrB6n+DMQ6jX5QhJE5XXgnR+8tDAtBzaYZ9eb0X3uVt9omFsNspk+wxW664v8BrqwToyLwriq6Mngx7YbGHirluyUEmB8VfzEa/dtQK569Pmz9qa3bkpDXt9s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d70b0e521eso45561415ad.1 for ; Tue, 06 Feb 2024 09:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1707241128; x=1707845928; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aVTsnybiZ8DGTppk2uffcY5XjYR/pNWXIH+yikDCrJg=; b=pyhFsW3qpXIFp66IIiaZUJVITZQBamYD8IVQv2pHDRPNK5XXx7GSlxOzZAabFLG5x7 pqRVPJaEQ8bOJH1Uaz7xhPZ5IT77gaFBywlvf/rzHs3OKC+T2Zk9RPCrgKnXXIBKGZdG SvCPwely9+xR4U2RvCtmJOHMlFMIiZos9N+N8RVOVX/7+a1AAJe+pwDG2HzcmX1Pq7t3 3wNUusbZgzxXq8Tgma/K7pqVCxzMzKcm9KTNbpYpZNRCSbsVyWKN1+21yxI0t8xwd/6m Kk0LsogzdMWsWu7pfSC9CYvYs4YDdsrhDXW0UUYuVLVbNa9uGs2LfyFPWMxXPi7Ip6Wl l2SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707241128; x=1707845928; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aVTsnybiZ8DGTppk2uffcY5XjYR/pNWXIH+yikDCrJg=; b=Ew5J7nO5rDlAPYJfcMABvS08eQQiedIwVWkaS/NBohwUMzRSS9jfanQgSqOUKmKEnH eGHYeLzJkWnLcdHbYAURuu70EyhKdnnMISdav/51EHMCQ6G4DHchzMrhRVeg9Fvd+vLd TXu9meSiwtyzq73PMCO9oO4VtGkNAQTSJSZFxrc5s4ST/FwQJS6bbEXhlc81CML06ch0 yEn8ZwCrNrIu1V/nixkHotBlO2RByvbuXij+zH3TvbBYYR7vVKM7J4q9FeurvEQwLPGT XoTpUAKSgJpBWm0mzjI/5K6vAPwuU9CiqkUm/MN81YE5uzsznz6r6i6EcoqGyWriz7PN DMBQ== X-Gm-Message-State: AOJu0YyuJ6PSXAeRFQTvDylg48p8cnFU7KgkwyZPxF/FAcopSnhEbwND Zk0EWZQtdCUTQN4AZsXTGlz7ZG2K/c9y/T7FaK+/H3zvKaHNkJtSeO+30ittiCSb/SUHXpp9Rhs x X-Received: by 2002:a17:902:6848:b0:1d9:e1c1:c7c1 with SMTP id f8-20020a170902684800b001d9e1c1c7c1mr1497969pln.59.1707241127999; Tue, 06 Feb 2024 09:38:47 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWsR6uBtTT9YJLpYxSVDQZrmDajbCxSKp+gSUs0sGoynzC7SJFxaMSF3KlnVmO8zdGkcyubdljRKv1kPNJIAeSMqGye/JJizXslc0wEO19MyuYkb2I3WpUmyEJBH1UvLKXF7OAyYELPHhQ= Received: from ewlu.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id q17-20020a170902c75100b001d8a81e22cbsm2160357plq.14.2024.02.06.09.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 09:38:47 -0800 (PST) From: Edwin Lu To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, ved@rivosinc.com, patrick@rivosinc.com, Edwin Lu Subject: [PATCH] RISC-V: Add support for B standard extension Date: Tue, 6 Feb 2024 09:38:43 -0800 Message-Id: <20240206173843.4007731-1-ewlu@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790172124264854841 X-GMAIL-MSGID: 1790172124264854841 This patch adds support for recognizing the B standard extension to be the collection of Zba, Zbb, Zbs extensions for consistency and conciseness across toolchains * https://github.com/riscv/riscv-b/tags gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Add imply rules for B extension * config/riscv/arch-canonicalize: ditto Signed-off-by: Edwin Lu --- gcc/common/config/riscv/riscv-common.cc | 7 +++++++ gcc/config/riscv/arch-canonicalize | 1 + 2 files changed, 8 insertions(+) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 631ce8309a0..31117a7b0fd 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -77,6 +77,10 @@ static const riscv_implied_info_t riscv_implied_info[] = {"f", "zicsr"}, {"d", "zicsr"}, + {"b", "zba"}, + {"b", "zbb"}, + {"b", "zbs"}, + {"zdinx", "zfinx"}, {"zfinx", "zicsr"}, {"zdinx", "zicsr"}, @@ -235,6 +239,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"c", ISA_SPEC_CLASS_20190608, 2, 0}, {"c", ISA_SPEC_CLASS_2P2, 2, 0}, + {"b", ISA_SPEC_CLASS_NONE, 1, 0}, + {"h", ISA_SPEC_CLASS_NONE, 1, 0}, {"v", ISA_SPEC_CLASS_NONE, 1, 0}, @@ -388,6 +394,7 @@ static const struct riscv_ext_version riscv_ext_version_table[] = /* Combine extensions defined in this table */ static const struct riscv_ext_version riscv_combine_info[] = { + {"b", ISA_SPEC_CLASS_NONE, 1, 0}, {"zk", ISA_SPEC_CLASS_NONE, 1, 0}, {"zkn", ISA_SPEC_CLASS_NONE, 1, 0}, {"zks", ISA_SPEC_CLASS_NONE, 1, 0}, diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index 629bed85347..dcfae732714 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -41,6 +41,7 @@ LONG_EXT_PREFIXES = ['z', 's', 'h', 'x'] IMPLIED_EXT = { "d" : ["f", "zicsr"], "f" : ["zicsr"], + "b" : ["zba", "zbb", "zbs"], "zdinx" : ["zfinx", "zicsr"], "zfinx" : ["zicsr"], "zhinx" : ["zhinxmin", "zfinx", "zicsr"],