From patchwork Mon Jan 8 13:47:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 186006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1028005dyq; Mon, 8 Jan 2024 05:48:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuMrzzWssonzVQUIxN/lV0ITtEU4X5OCz6H91T7QdbWEGAugwLT+GbHrcZ91y5OnSK0nnq X-Received: by 2002:ac8:58c2:0:b0:427:ebd9:215b with SMTP id u2-20020ac858c2000000b00427ebd9215bmr5469440qta.135.1704721726187; Mon, 08 Jan 2024 05:48:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704721726; cv=pass; d=google.com; s=arc-20160816; b=MfGTKHomNsmSoFuIwV3OuKbTegRG3+nnOl2LRUtm/WkwB0rV8v2QzhuYYYD1/HOzXk PQ4CXXnVtKh9HfC0XidSgAOzhenPXIjLnz6yZDgXHuUDkTHf9xa/mPc99+VKOM0iF9sh /KVqTY3P6ngriPEUWrKcK37LxI/4z6OIRPmSIr4eFZrsKa0z8Z6258hcl+H4sbnyTPws T9zWR5QYASq1VLcU+u/vJl+VYD0LcjvVX0+0oT4NMMW3jLcuHSAhkf2WFJY0fh7ZPjQ+ TL4QJJe3sX7FM+CBZz5LkZX+b0Tr5s7d5WrM5E3U6SdDPXYbPG38Nxg12ecl1/sRibfx ex5Q== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=D/0+e0XHYwUoo+ZUcUk5RYifTfQWY2+4ucstYkojjVk=; fh=3Ck16crQUxNabL1wC/NAUZY2nAVZpSKeVH/lwIj1XIE=; b=Xugi9epLytE6Y79blJcKl4NC6v/94gYlXVdWUYuIMVz6U54unvMBUtceCqK6F43hqT qlx2ZyGer1I4SIHxig2NVbrlaHptAFh9lYEz0350/XNtvU/JkHUssD9qJlooicdZFCRg X5qHm5A7aCxTxcdHq1ur2yFU06mJsG1nX96VGYObTjo/s4TCN9G4V6Ke1N/aAsrLZd0Z weUbZ4tEAV+FIPndXHgbc7vyup/WP3Hb9nEeHs9YPQzHEWjpeNXKQRgpwLP3PYW7dNEi Ot64XYwDVdTiF0LTskMe56x6bNiy+y8h0g9a2ETXZ5k1FCCplWTT9zvqz5J9jh+JbbSL UtIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=frq9Oczw; 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"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e10-20020ac84e4a000000b004299a319646si1076301qtw.277.2024.01.08.05.48.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:48:46 -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=@sifive.com header.s=google header.b=frq9Oczw; 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"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0B62385E44F for ; Mon, 8 Jan 2024 13:48:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id C5D0A3858292 for ; Mon, 8 Jan 2024 13:47:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5D0A3858292 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C5D0A3858292 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721676; cv=none; b=tbpN9lRwRSqsGb3woQWwYxSUKp++Eoircuu/4IdtFTp7BdktnKUqrCjiiKD86/Z6pjyKhuGKk5cagO58jH4xTw40ibjJMHbe9wwJ2M6WKErm2pOnOVzEPUqqDs0cQcHL22Aa4gFIArMYbVwFQyxZRAoHujCN+Pea4FbPSFTgUys= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721676; c=relaxed/simple; bh=Y1+N7pfH2152+A/3ZwJxYJaO3fj+hxQisOpS9XXHfBA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GYfmZXclRT/yRXUZtn1cQz6+I5jof0o7Zo+rcaPbqngjCd8biuwy+wgiL6LYzYsTsNQFZgvEcvPx9PyTz31Y32jTylm8ug5JtYq9Qgv/L6M1+9xAY04BcMP9HC5GC4on3xjF9vSs92c6Bn7Y4kUUoBRuUgK8zHPQ5AP/iNGOmI0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d542701796so3008185ad.1 for ; Mon, 08 Jan 2024 05:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721672; x=1705326472; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D/0+e0XHYwUoo+ZUcUk5RYifTfQWY2+4ucstYkojjVk=; b=frq9OczwMvxBrQ9JogbBIFprAYaSAjHhJwHXuTNab3t0pWTOELbQfBelz4fUEw1Onf rl5DYLXHs8Cn7T1ap3Z6vJVdlL7bgf6ReFR95T06e0q+0d4jamRSnFM6jrrtFEx+rCXQ 9WgIYO02RvqJsDMa/e+I04SfPGX+15FoZUp0P5WwhDZeRol+cYLlxkjXFw0rMfRla8MR Th5j0jVSZmdA7As3Vz65gVj4Jqt5TB5PcpwiCoiwbaLbHsRgVPV5bresgc/xP8ED2af8 sbaAjtJUrcJIa+Z64BS36P9nBvcYzmjE3U1ck6twOung9dvCFNQdWgQ7dvQprP0TKEPk huhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721672; x=1705326472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D/0+e0XHYwUoo+ZUcUk5RYifTfQWY2+4ucstYkojjVk=; b=HKhaobBmqO+LSzSUvJQ9TY5n8/Ho7rcNtgL3p2DY7opLHMZiylJCb4gbUL1Ea20MTE 2xf7bfkamk7u1ZxSYp6HRYLOPyFi3BVpYqv+d564RHabNCOqZcFrxxz/cEP9lEixuRN2 nYbMmJbwBwvYIX58KawAFh6FtXPOG7Q0LCbjG942YkIRoN0SCei+x5O6+JfehJwgnDi/ ZIGQBkVHzWoVFRbvundZVS3X2xTrvPSHDSeZkJ297wOwIeEaY7Qe66DZNh1J2pUGkv3d G6yOFRouOG2PPd2PapLPTEVe3grNXlNCrTz4mVahtX+VnTpteNqpkrZbwSRqo/dHEcvM BSqQ== X-Gm-Message-State: AOJu0YxESehRPUA6vKGBQ1UKahklnVd4ExdUSQ7f4IwBeAHhXYZOIxHS DCn6bryU7arkB+RkP2CvA+KV08DfXS9q8/1sezRt9mwNDe8KvRyaurVytCdK27iiUYbV5JCEXvK CKfnBraLsLZl64Gej2EANPpaHl2txVeBFtdtwxNaI+DuR8k6XOlWZoY4Q/5jEKy5TR2mSb5nnOL VnLw05EQLSsMA= X-Received: by 2002:a17:902:e74f:b0:1d0:8a8c:56b6 with SMTP id p15-20020a170902e74f00b001d08a8c56b6mr1526165plf.103.1704721672240; Mon, 08 Jan 2024 05:47:52 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:47:51 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 1/5] RISC-V: Extract part parsing base ISA logic into a standalone function [NFC] Date: Mon, 8 Jan 2024 21:47:34 +0800 Message-Id: <20240108134738.998804-2-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: 1787530288630127365 X-GMAIL-MSGID: 1787530288630127365 Minor refactor, preparation for further change. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse_base_ext): New. (riscv_subset_list::parse): Extract part of logic into riscv_subset_list::parse_base_ext. * config/riscv/riscv-subset.h (riscv_subset_list::parse_base_ext): New. --- gcc/common/config/riscv/riscv-common.cc | 68 ++++++++++++++++--------- gcc/config/riscv/riscv-subset.h | 2 + 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 0301d170a41..f0359380451 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -970,25 +970,38 @@ riscv_subset_list::parsing_subset_version (const char *ext, return p; } -/* Parsing function for standard extensions. +/* Parsing function for base extensions, rv[32|64][i|e|g] Return Value: - Points to the end of extensions. + Points to the end of extensions, return NULL if any error. Arguments: `p`: Current parsing position. */ - const char * -riscv_subset_list::parse_std_ext (const char *p) +riscv_subset_list::parse_base_ext (const char *p) { - const char *all_std_exts = riscv_supported_std_ext (); - const char *std_exts = all_std_exts; - unsigned major_version = 0; unsigned minor_version = 0; char std_ext = '\0'; bool explicit_version_p = false; + if (startswith (p, "rv32")) + { + m_xlen = 32; + p += 4; + } + else if (startswith (p, "rv64")) + { + m_xlen = 64; + p += 4; + } + else + { + error_at (m_loc, "%<-march=%s%>: ISA string must begin with rv32 or rv64", + m_arch); + return NULL; + } + /* First letter must start with i, e or g. */ switch (*p) { @@ -1043,6 +1056,28 @@ riscv_subset_list::parse_std_ext (const char *p) "% or %", m_arch); return NULL; } + return p; +} + + +/* Parsing function for standard extensions. + + Return Value: + Points to the end of extensions. + + Arguments: + `p`: Current parsing position. */ + +const char * +riscv_subset_list::parse_std_ext (const char *p) +{ + const char *all_std_exts = riscv_supported_std_ext (); + const char *std_exts = all_std_exts; + + unsigned major_version = 0; + unsigned minor_version = 0; + char std_ext = '\0'; + bool explicit_version_p = false; while (p != NULL && *p) { @@ -1499,22 +1534,9 @@ riscv_subset_list::parse (const char *arch, location_t loc) riscv_subset_list *subset_list = new riscv_subset_list (arch, loc); riscv_subset_t *itr; const char *p = arch; - if (startswith (p, "rv32")) - { - subset_list->m_xlen = 32; - p += 4; - } - else if (startswith (p, "rv64")) - { - subset_list->m_xlen = 64; - p += 4; - } - else - { - error_at (loc, "%<-march=%s%>: ISA string must begin with rv32 or rv64", - arch); - goto fail; - } + p = subset_list->parse_base_ext (p); + if (p == NULL) + goto fail; /* Parsing standard extension. */ p = subset_list->parse_std_ext (p); diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index 14461838db5..c8117d8daf2 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -67,6 +67,8 @@ private: const char *parsing_subset_version (const char *, const char *, unsigned *, unsigned *, bool, bool *); + const char *parse_base_ext (const char *); + const char *parse_std_ext (const char *); const char *parse_single_std_ext (const char *); From patchwork Mon Jan 8 13:47:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 186007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1028034dyq; Mon, 8 Jan 2024 05:48:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDUxv/qFFzZnytuxSeNxoMro9qq1+F3qilyZLHIkwcgTP8dr1kxhABhqv+leGzDVV0yB+g X-Received: by 2002:a05:622a:1046:b0:429:9872:da0e with SMTP id f6-20020a05622a104600b004299872da0emr1096203qte.117.1704721729669; Mon, 08 Jan 2024 05:48:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704721729; cv=pass; d=google.com; s=arc-20160816; b=bulJRP6NMop2dSYjTsttvkUpRVDIlmEiPFNVEl/GfICLVMkWdsLpmzPKe55kkS2cae wOBUIAJyWVDuj8pSiaDcqUBxfNDCGanjzzCjPtdmBDz8IcpR2QpNqDSLidunimXR/kFs MgqbbFWHfDUgGzHYM6cdeoHULR63KPbAhUIf9ehD2RBVqDXD3b0LXHRYVSTZEoyFIIjQ CfO55/6M7he7JeH9Yvm+MGaF9Imc/td6WtBh1S7WWuO1Y10N7NtSjTQJqJFkc/0PBcgB VZoHqG63Iwjw3hLGO3tWYNy6lwKWbzqaQQmKCLZt8wyXvujItOjItA1TFnH8K7EFRmH6 70RA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=fCKTiGAerFb02Yus8CvOf0Kfco4TBiIkJ+a/N4dc5L4=; fh=3Ck16crQUxNabL1wC/NAUZY2nAVZpSKeVH/lwIj1XIE=; b=MYce0bjPZ4+y1Ab65cdgdiw+8dWa2mZtQAYn0e87OGYJfMRgEMRWfleMNK/cmGfiMR qAg/0nBsCPZKpNyxGMcBUmpYszK2bJStXjJoMXKpZRr9HirwnJl8xX4QbS9WeCGhZCyC hMlKJq4ZdkvTTXvI7XTvr5vPHaLJ5C6M652NRH3x4JY/nb/ez0v5MUd6950SKE09G+xq V0LXEAA4B+oHkpe+1cP3+B2M8jlh2MxJO+ag5t3NkJ7l66dPvEdDRa7QI1SBaNwadQJK 6Ly/Wc+WQ4dylGroL0Ixi3BNTUCZHC4+TXh5Zso+bvM611vV89rnaHo5hPMbkE6vxD4W Ncag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=L89AUKyy; 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"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n17-20020ac85a11000000b004299afda6efsi810664qta.376.2024.01.08.05.48.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:48:49 -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=@sifive.com header.s=google header.b=L89AUKyy; 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"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBC83385DC37 for ; Mon, 8 Jan 2024 13:48:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 8EEE4385842B for ; Mon, 8 Jan 2024 13:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EEE4385842B Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8EEE4385842B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721682; cv=none; b=xRX7JspwuPZW6NqEMqL3PMwfMWcnKPznI9DYQXrShxVWmsvtGXtsAzjSj94JeG+06JawRE/gsQUZUS/5u3aV7DP5jujDRrMMv3HRCJLthvO0vbd2ya9btzWyvrJVcqVOX7wIa5LD6sKFaYZ2nRrwNSM8oBXXtVbMZTY6ZCjiA/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721682; c=relaxed/simple; bh=DceE9FZVoAA/O4oGg27GFlnoq6nTt49fnt8fpPgZpdg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=EsSH//FL4k/OpEBTKy9kKKuD9xLb0r81jLBNJCawboHoZXJUeJV7pGtmnu1TV3YP9rRmivfjj7xdG8FsYYbllfq2j7kYOeaEayS7sWltEyY+wWOINB8qBsSyFMUFopZiBLfRMCr/OiYNGQajMRVaDsurYQc55GGWTJCZP3anIeQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d4ba539f6cso16569705ad.3 for ; Mon, 08 Jan 2024 05:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721676; x=1705326476; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fCKTiGAerFb02Yus8CvOf0Kfco4TBiIkJ+a/N4dc5L4=; b=L89AUKyyUsT8SEx6Pq7DzU66c3zlvlCHIcbADSQKO8l7wa4H1u+Ibgd7exufeE6mTd fpqNY2Z9uircqYkvnxr2+kN8wbXaiq/5U87Q9O8+Fm1piTr4bYhs8wNTCtnEd1Ef9Cqk TvwOQ0OgfNxjg+sU/79MpmGjOd2tcZVdyV8rVR7mYAeajAZhe7chSQcu8wqdpRrjRJ30 9G2hSM4IFZn3Up55SE4uZZYgA723bbwINXGFFBTpgAEHGpwI2T+FJCJV8337i/GaudHr 5qhrpobsJlhVwZoFQKaCeW1xf/DKWe7uNovpE58SEV1IrKXl8mIw1B/9VFxbKFNDdi1q 10bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721676; x=1705326476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fCKTiGAerFb02Yus8CvOf0Kfco4TBiIkJ+a/N4dc5L4=; b=FMzULaPwruYyR+5rN7mI7iJ3RCto66g1p/fCyu2qBFm8m2SMqhbTfyIIcYdNmARlIh hEn1RTH6lA0sCBAzMEC2Xw0cdpLYX0dcyFFN4vW9nBa/cydRYNbRrleTdP/aFxuvf/nt OVZOv3BkVYxI0L+hdsxcgIDFV83ZgHxMaOnNKJ8RFwl+Sx2C9FUTbmWwjpX6sL7Q5dmr TKGEi/1LkW733oseu2Xeae5mEyvyHQy/PhOvLNPX7zMMbva5vz/O5VWtlWgl8kdRdO4W wcSQUlHFQiHvJhpfBDfRvnxbuWwhyIm4v8BEp+wxvI6PKYpd71crJ0RPEEVvHHOG5vEs augQ== X-Gm-Message-State: AOJu0YwD7JlWglZhGjNm0akv5Nt3+hk/L4CgcST55aXZj6V9lBCaVYN1 72y0LqyWhSvEM+acLFp9GuFgcf2qH5pFYDKr40mxr76EOpfD0lOtLxoVBio32qCYT//wbPQJd08 Sj9je2c2w1J+pH8YSGVsej7F+MqzgiuohZLVPbqclztuNXmombUcVex+PGrWmzVUkXmdJGrxZzR YO4EKL3m2JBlw= X-Received: by 2002:a17:903:1d1:b0:1d3:f0c1:6ad6 with SMTP id e17-20020a17090301d100b001d3f0c16ad6mr4724230plh.18.1704721675841; Mon, 08 Jan 2024 05:47:55 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:47:55 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 2/5] RISC-V: Relax the -march string for accept any order Date: Mon, 8 Jan 2024 21:47:35 +0800 Message-Id: <20240108134738.998804-3-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: 1787530285356947378 X-GMAIL-MSGID: 1787530292603883091 -march was require canonical order before, however it's not easy for most user when we have so many extension, so this patch is relax the constraint, -march accept the ISA string in any order, it only has few requirement: 1. Must start with rv[32|64][e|i|g]. 2. Multi-letter and single letter extension must be separated by at least one underscore(`_`). gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse_single_std_ext): New parameter. (riscv_subset_list::parse_single_multiletter_ext): Ditto. (riscv_subset_list::parse_single_ext): Ditto. (riscv_subset_list::parse): Relax the order for the input of ISA string. * config/riscv/riscv-subset.h (riscv_subset_list::parse_single_std_ext): New parameter. (riscv_subset_list::parse_single_multiletter_ext): Ditto. (riscv_subset_list::parse_single_ext): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-33.c: New. * gcc.target/riscv/arch-34.c: New. --- gcc/common/config/riscv/riscv-common.cc | 91 ++++++++++++++---------- gcc/config/riscv/riscv-subset.h | 6 +- gcc/testsuite/gcc.target/riscv/arch-33.c | 5 ++ gcc/testsuite/gcc.target/riscv/arch-34.c | 5 ++ 4 files changed, 67 insertions(+), 40 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/arch-33.c create mode 100644 gcc/testsuite/gcc.target/riscv/arch-34.c diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index f0359380451..891ecfce464 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1132,10 +1132,12 @@ riscv_subset_list::parse_std_ext (const char *p) Points to the end of extensions. Arguments: - `p`: Current parsing position. */ + `p`: Current parsing position. + `exact_single_p`: True if input string is exactly an extension and end + with '\0'. */ const char * -riscv_subset_list::parse_single_std_ext (const char *p) +riscv_subset_list::parse_single_std_ext (const char *p, bool exact_single_p) { if (*p == 'x' || *p == 's' || *p == 'z') { @@ -1146,6 +1148,11 @@ riscv_subset_list::parse_single_std_ext (const char *p) return nullptr; } + if (exact_single_p && strlen (p) > 1) + { + return nullptr; + } + unsigned major_version = 0; unsigned minor_version = 0; bool explicit_version_p = false; @@ -1296,13 +1303,16 @@ riscv_subset_list::check_conflict_ext () Arguments: `p`: Current parsing position. `ext_type`: What kind of extensions, 's', 'z' or 'x'. - `ext_type_str`: Full name for kind of extension. */ + `ext_type_str`: Full name for kind of extension. + `exact_single_p`: True if input string is exactly an extension and end + with '\0'. */ const char * riscv_subset_list::parse_single_multiletter_ext (const char *p, const char *ext_type, - const char *ext_type_str) + const char *ext_type_str, + bool exact_single_p) { unsigned major_version = 0; unsigned minor_version = 0; @@ -1314,6 +1324,7 @@ riscv_subset_list::parse_single_multiletter_ext (const char *p, char *subset = xstrdup (p); const char *end_of_version; bool explicit_version_p = false; + char *q = subset; char *ext; char backup; size_t len = strlen (p); @@ -1321,6 +1332,17 @@ riscv_subset_list::parse_single_multiletter_ext (const char *p, bool found_any_number = false; bool found_minor_version = false; + if (!exact_single_p) + { + /* Extension may not ended with '\0', may come with another extension + which concat by '_' */ + /* Parse until end of this extension including version number. */ + while (*++q != '\0' && *q != '_') + ; + + len = q - subset; + } + end_of_version_pos = len; /* Find the begin of version string. */ for (i = len -1; i > 0; --i) @@ -1505,21 +1527,26 @@ riscv_subset_list::parse_multiletter_ext (const char *p, Points to the end of extensions. Arguments: - `p`: Current parsing position. */ + `p`: Current parsing position. + `exact_single_p`: True if input string is exactly an extension and end + with '\0'. */ const char * -riscv_subset_list::parse_single_ext (const char *p) +riscv_subset_list::parse_single_ext (const char *p, bool exact_single_p) { switch (p[0]) { case 'x': - return parse_single_multiletter_ext (p, "x", "non-standard extension"); + return parse_single_multiletter_ext (p, "x", "non-standard extension", + exact_single_p); case 'z': - return parse_single_multiletter_ext (p, "z", "sub-extension"); + return parse_single_multiletter_ext (p, "z", "sub-extension", + exact_single_p); case 's': - return parse_single_multiletter_ext (p, "s", "supervisor extension"); + return parse_single_multiletter_ext (p, "s", "supervisor extension", + exact_single_p); default: - return parse_single_std_ext (p); + return parse_single_std_ext (p, exact_single_p); } } @@ -1538,37 +1565,27 @@ riscv_subset_list::parse (const char *arch, location_t loc) if (p == NULL) goto fail; - /* Parsing standard extension. */ - p = subset_list->parse_std_ext (p); - - if (p == NULL) - goto fail; - - /* Parsing sub-extensions. */ - p = subset_list->parse_multiletter_ext (p, "z", "sub-extension"); - - if (p == NULL) - goto fail; - - /* Parsing supervisor extension. */ - p = subset_list->parse_multiletter_ext (p, "s", "supervisor extension"); - - if (p == NULL) - goto fail; - - /* Parsing non-standard extension. */ - p = subset_list->parse_multiletter_ext (p, "x", "non-standard extension"); + while (p && *p) + { + switch (*p) + { + case '_': + ++p; + continue; + case 'e': + case 'i': + case 'g': + error_at (loc, "%<-march=%s%>: 'i', 'e' or 'g' must be the first extension.", + arch); + goto fail; + default: + p = subset_list->parse_single_ext (p, /*exact_single_p=*/ false); + } + } if (p == NULL) goto fail; - if (*p != '\0') - { - error_at (loc, "%<-march=%s%>: unexpected ISA string at end: %qs", - arch, p); - goto fail; - } - for (itr = subset_list->m_head; itr != NULL; itr = itr->next) { subset_list->handle_implied_ext (itr->name.c_str ()); diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index c8117d8daf2..a80f9138e5c 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -71,12 +71,12 @@ private: const char *parse_std_ext (const char *); - const char *parse_single_std_ext (const char *); + const char *parse_single_std_ext (const char *, bool); const char *parse_multiletter_ext (const char *, const char *, const char *); const char *parse_single_multiletter_ext (const char *, const char *, - const char *); + const char *, bool); void handle_implied_ext (const char *); bool check_implied_ext (); @@ -101,7 +101,7 @@ public: riscv_subset_list *clone () const; static riscv_subset_list *parse (const char *, location_t); - const char *parse_single_ext (const char *); + const char *parse_single_ext (const char *, bool exact_single_p = true); const riscv_subset_t *begin () const {return m_head;}; const riscv_subset_t *end () const {return NULL;}; diff --git a/gcc/testsuite/gcc.target/riscv/arch-33.c b/gcc/testsuite/gcc.target/riscv/arch-33.c new file mode 100644 index 00000000000..3fac9285ca3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-33.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64i_zba____zbs_mac_d -mabi=lp64d" } */ +int foo() +{ +} diff --git a/gcc/testsuite/gcc.target/riscv/arch-34.c b/gcc/testsuite/gcc.target/riscv/arch-34.c new file mode 100644 index 00000000000..9b9f1a7a439 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-34.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64i_xtheadbs_zba_fcd -mabi=lp64d" } */ +int foo() +{ +} From patchwork Mon Jan 8 13:47:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 186008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1028508dyq; Mon, 8 Jan 2024 05:49:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHG2duZmfhAa0SilPDalN3DepVQj/u/ejamyTHgoR7YL2dg3s5zl0F9H5YWSJLcg+KyeHWE X-Received: by 2002:a05:620a:4553:b0:783:22b2:7c05 with SMTP id u19-20020a05620a455300b0078322b27c05mr2113315qkp.58.1704721783047; Mon, 08 Jan 2024 05:49:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704721783; cv=pass; d=google.com; s=arc-20160816; b=kXbD2OHAXjZ6RjRh2B0Qc3oxupb6witNqXzQTOW3EiUBUu8goVtfFNXet7gfed9Ax6 7SVHgmqB5gjspHO9AtOGuqPb6hr7Kx5YaEziXkCoCO3zsNvshqv58AiI5C/UUZzxCa5A 9H9gu+tbUhm7dinNaCtnvVucrg3T268HyEVBj0Rzwe1bilxtYd43TI66Wp+VShYMEeTJ KVBLis1fyDRm8i2K+JMzbsZfMDt6TxrRBfCsQbb2U+Yth7E/s5ODFzGzc5KeXzhgWmWt waGtfCHF/fiq6aeh5q4cef8b7bIMERP5HC/faoIZk6e4f2zrFN4JfOf8MJOLa9YNIGf9 oRMA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=Rt7HzghrshgjW161HpW6l1W9rlKbGCI2omGm/vfGnvA=; fh=3Ck16crQUxNabL1wC/NAUZY2nAVZpSKeVH/lwIj1XIE=; b=HXkklsdLJt4vpQbXCVRWdWR+x3uCeHCf5gDTWc/RQUmmCe1j9eW6+k7z/er4FezA7g kj2Q385tu42uL1cFEzSx28/0bCvdr5lPtMK262oh9+CRqFOb0SWs161LzrolZIyISkkT Angm7Fpgc/fcmGsa8adAStZz8eCo/H5jQhm/T7uJTnqOLi5r9QHkd9Vd7e0vZarUb9J/ wH3YAUzBd3ONjRELwUtFuF9g6DWzbDq4DRwC28sFsQcpnoZrZbJg1GlJvBHuWTRxJS3o hWhgP2JqkrMQXBlAbicAdSeFep4pArmEpM6raaPdn7Ln6QYGbE9cLEDmOYXqR+ElUy4v iGbg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=aVcCtW5M; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m8-20020a05620a290800b0077f0c19e400si8148234qkp.610.2024.01.08.05.49.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:49:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=aVcCtW5M; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDBFD385828C for ; Mon, 8 Jan 2024 13:49:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 5394D38582AD for ; Mon, 8 Jan 2024 13:48:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5394D38582AD Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5394D38582AD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721683; cv=none; b=ROEfJCzdjv4YJk2H5Dx4SPRSSm+Q0/ByNYBj0mWLXgca/bCr5FcIMe1rCWZKTZsjkN8e41VPughPv2b/b++Y/63CwZ1Clz/luVTfBTg+hcg412quc4adJvg5zgkIL/cu+ozROlN+gCT3/ItV9pL3etd61eP9UxKFk4734eslJRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721683; c=relaxed/simple; bh=Tz2aaM4jUsY/4p2m3Xr2inMf1CleJ0Wv2hFlLQjFcq0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=S/5vM284N2OkWpCRGUwm7J9LiT3hHzbpw3STOUvxe85WgY0PT8GW7wuPtmVBG/9jsZzwnvWdozLPsnY6d8C1vruAMQqcK/kpcXK/paeoVxlWmvGeUaCX4patQ7hupzt34ObWDAzRQ4zCgEWnpjww96quZuMhh+kCzXGVkhoicqc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6d9b1589a75so493084b3a.3 for ; Mon, 08 Jan 2024 05:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721679; x=1705326479; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rt7HzghrshgjW161HpW6l1W9rlKbGCI2omGm/vfGnvA=; b=aVcCtW5MdeZViyTFgOF18LUkqZHAi8JfcFUHwauVaGguwsKoEwI+gbd8CB5xGaFGR+ 9F1FVPQ2xhjz6TTqoiX8TnkqKkP4BaMt7OrTT5Sn19FB7oJz2QobniVXx0OYqFjjkHxC SsyQ3SqdN68yy6nDWlRBZHLcWw6BkhFnHHJ3M4PgKCOiIeVSuf0UCyfT9Zr8ntFKa/64 pGYj0HreMbsSZRpCre+q+JIObEhJ/R6v/0e9Lt8mEICp42uW/Saa3axGWknNoGUdTbRo 36vYxFLGFYoka2uN7dLXGjxW3TxAYR8EhOu0fNYBNnZ8SaD2k2mHd3zYBrqiUEge7bqQ HxYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721679; x=1705326479; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rt7HzghrshgjW161HpW6l1W9rlKbGCI2omGm/vfGnvA=; b=K98fmF4Kbv44CTYM3vfTFjbi3FNAJZxYkMCPjNdl5lCFjNQcYzUSmkpluLsW8HnBB7 TDuYq+rFbRITp9zI2Q+rMMgtvlZRKwe4p05n9hrsibCqPZCp78ZEzzd9jE0Cz7C+wEUy m/x9FgWONyrkOeNF76X0nAZ8EohaSBLhiRuFl4aqiVJ2/rrVwpCiPmgZbyy2TESERB8h 0bcA4EA2Ev+Rdnu/wiqzuFvSqWYRBccX1tPRaMC3R1sbKThK4yIpC4tJYVGsAWJh4Oaf z+P2lo9Pdt4T4+qepUG5nuZ6QJhfSNMUb2ioU59VCFIontSsf/h8/CxZtm0zK6rLoXJB vRIA== X-Gm-Message-State: AOJu0YydjFKe6ICvEUmNVvt0Dnp2blRdytfE2Yg+oTQNpXr3xYBey2jD A2o16NvLSxbdu71GMCAvX8j5SNQ2g/aX+OtPlmyk7mE+OuuGzSQwrU31YpLohNYiAcSQUb0iUrg ucEvJmlEO76sKdLwsyw+qOzk8C0iE0sz0zwd07BT3iKKZcDJCDfP0TImAPI7gfMb4DNbWlJpCBl PdOAy8CmgCF+0= X-Received: by 2002:a17:902:e845:b0:1d4:e203:3781 with SMTP id t5-20020a170902e84500b001d4e2033781mr1692783plg.101.1704721678725; Mon, 08 Jan 2024 05:47:58 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:47:58 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 3/5] RISC-V: Remove unused function in riscv_subset_list [NFC] Date: Mon, 8 Jan 2024 21:47:36 +0800 Message-Id: <20240108134738.998804-4-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: 1787530348528586277 X-GMAIL-MSGID: 1787530348528586277 gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse_std_ext): Remove. (riscv_subset_list::parse_multiletter_ext): Remove. * config/riscv/riscv-subset.h (riscv_subset_list::parse_std_ext): Remove. (riscv_subset_list::parse_multiletter_ext): Remove. --- gcc/common/config/riscv/riscv-common.cc | 179 ------------------------ gcc/config/riscv/riscv-subset.h | 4 - 2 files changed, 183 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 891ecfce464..cf1c82c9f5e 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1059,73 +1059,6 @@ riscv_subset_list::parse_base_ext (const char *p) return p; } - -/* Parsing function for standard extensions. - - Return Value: - Points to the end of extensions. - - Arguments: - `p`: Current parsing position. */ - -const char * -riscv_subset_list::parse_std_ext (const char *p) -{ - const char *all_std_exts = riscv_supported_std_ext (); - const char *std_exts = all_std_exts; - - unsigned major_version = 0; - unsigned minor_version = 0; - char std_ext = '\0'; - bool explicit_version_p = false; - - while (p != NULL && *p) - { - char subset[2] = {0, 0}; - - if (*p == 'x' || *p == 's' || *p == 'z') - break; - - if (*p == '_') - { - p++; - continue; - } - - std_ext = *p; - - /* Checking canonical order. */ - const char *prior_std_exts = std_exts; - - while (*std_exts && std_ext != *std_exts) - std_exts++; - - subset[0] = std_ext; - if (std_ext != *std_exts && standard_extensions_p (subset)) - { - error_at (m_loc, - "%<-march=%s%>: ISA string is not in canonical order. " - "%<%c%>", - m_arch, *p); - /* Extension ordering is invalid. Ignore this extension and keep - searching for other issues with remaining extensions. */ - std_exts = prior_std_exts; - p++; - continue; - } - - std_exts++; - - p++; - - p = parsing_subset_version (subset, p, &major_version, &minor_version, - /* std_ext_p= */ true, &explicit_version_p); - - add (subset, major_version, minor_version, explicit_version_p, false); - } - return p; -} - /* Parsing function for one standard extensions. Return Value: @@ -1409,118 +1342,6 @@ riscv_subset_list::parse_single_multiletter_ext (const char *p, } -/* Parsing function for multi-letter extensions. - - Return Value: - Points to the end of extensions. - - Arguments: - `p`: Current parsing position. - `ext_type`: What kind of extensions, 's', 'z' or 'x'. - `ext_type_str`: Full name for kind of extension. */ - -const char * -riscv_subset_list::parse_multiletter_ext (const char *p, - const char *ext_type, - const char *ext_type_str) -{ - unsigned major_version = 0; - unsigned minor_version = 0; - size_t ext_type_len = strlen (ext_type); - - while (*p) - { - if (*p == '_') - { - p++; - continue; - } - - if (strncmp (p, ext_type, ext_type_len) != 0) - break; - - char *subset = xstrdup (p); - char *q = subset; - const char *end_of_version; - bool explicit_version_p = false; - char *ext; - char backup; - size_t len; - size_t end_of_version_pos, i; - bool found_any_number = false; - bool found_minor_version = false; - - /* Parse until end of this extension including version number. */ - while (*++q != '\0' && *q != '_') - ; - - backup = *q; - *q = '\0'; - len = q - subset; - *q = backup; - - end_of_version_pos = len; - /* Find the begin of version string. */ - for (i = len -1; i > 0; --i) - { - if (ISDIGIT (subset[i])) - { - found_any_number = true; - continue; - } - /* Might be version seperator, but need to check one more char, - we only allow p, so we could stop parsing if found - any more `p`. */ - if (subset[i] == 'p' && - !found_minor_version && - found_any_number && ISDIGIT (subset[i-1])) - { - found_minor_version = true; - continue; - } - - end_of_version_pos = i + 1; - break; - } - - backup = subset[end_of_version_pos]; - subset[end_of_version_pos] = '\0'; - ext = xstrdup (subset); - subset[end_of_version_pos] = backup; - - end_of_version - = parsing_subset_version (ext, subset + end_of_version_pos, &major_version, &minor_version, - /* std_ext_p= */ false, &explicit_version_p); - free (ext); - - if (end_of_version == NULL) - return NULL; - - subset[end_of_version_pos] = '\0'; - - if (strlen (subset) == 1) - { - error_at (m_loc, "%<-march=%s%>: name of %s must be more than 1 letter", - m_arch, ext_type_str); - free (subset); - return NULL; - } - - add (subset, major_version, minor_version, explicit_version_p, false); - p += end_of_version - subset; - free (subset); - - if (*p != '\0' && *p != '_') - { - error_at (m_loc, "%<-march=%s%>: %s must separate with %<_%>", - m_arch, ext_type_str); - return NULL; - } - } - - return p; -} - /* Parsing function for a single-letter or multi-letter extensions. Return Value: diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index a80f9138e5c..ae849e2a302 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -69,12 +69,8 @@ private: const char *parse_base_ext (const char *); - const char *parse_std_ext (const char *); - const char *parse_single_std_ext (const char *, bool); - const char *parse_multiletter_ext (const char *, const char *, - const char *); const char *parse_single_multiletter_ext (const char *, const char *, const char *, bool); From patchwork Mon Jan 8 13:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 186012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1029064dyq; Mon, 8 Jan 2024 05:50:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEj9/UJ5eIXlFKoRennIS9QHGV3OxJLRxyv68lQdl7OUjSN5nP1watJHAv8iyGAvapl5osi X-Received: by 2002:a05:6358:904c:b0:175:89b8:b5ad with SMTP id f12-20020a056358904c00b0017589b8b5admr3275036rwf.15.1704721846374; Mon, 08 Jan 2024 05:50:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704721846; cv=pass; d=google.com; s=arc-20160816; b=g3zUW/bP0tOtWD9izagKp+OpGqX1NA3XR8M2BpoSFswXvYYGnsFYaQ/ZpaTVWXBas0 8QmrvYxXKR8687naiw8k59tFi/RjvsKYsbzuLo4wkCqTqP6yUTPVOBmeg73qfdc9VSUo EuT6QBxIX8FcRoj8ocp6IWihR9Jwnt9L740g85eSd6R8RngtkfAyRpvpomF9w7Z8rx9X 7ikmqzvEW4XmoU5AFy+x6R8UKwmFoXC0FNekD29QIcsbbxXM+hcrZ4oz9KIs9Z7PhOhP t++Uwycvq/KIYTrxe4xL39fcfa/BE5pGr4KVM/Pg3ptI0SgGSdz+u6LXjkQlQdITnfRG ezFw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=haTrwFBvIcBEmhUjTut561vOIc/lrVHHHJAUZxIu7fU=; fh=3Ck16crQUxNabL1wC/NAUZY2nAVZpSKeVH/lwIj1XIE=; b=BGyu8xP3TZkFZFYVf87BY69Bp4xths76UwBP1IEcIpNLIelHn9dqJ2b1bd+u5RanpI ZLzNDaBVIALRa195uuMxzNaF8HkYDfzy7iymLp3oOEF4nU/WXw4AF/u5pV6VdOudFclR oanqvE3zxbr0x+UKG4vSNephjUL2BOeAb/jKR9JQrsv/RIdaoCDTYawrhL2blpVGGsnG suJxDQznXc9dBorhtrU/zwsrSaNzzjKSH4xwkEa081zcRN0vW9YOMtUhJEHiO529aUvm 18dEyzKXEdBFro/+p6Kf3/e/jPKj+SEQGbt5B/whEdVdCKqPuCOQzvZenyDJTddWz93h b07A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bw8hX0nM; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v7-20020ac85787000000b004277d662d67si7985746qta.512.2024.01.08.05.50.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:50:46 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bw8hX0nM; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 180AF385E007 for ; Mon, 8 Jan 2024 13:50:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 41C2C385841B for ; Mon, 8 Jan 2024 13:48:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41C2C385841B Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 41C2C385841B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721688; cv=none; b=DE+3CpYNwPNj1LsvlYcUU7M5BeWRRhktvKZtDEH3nIM73V+INKo05Ysh/R6ls5YPkOppSDBEyzX3eACLEMLEncI/mlReRNjWEtVNMsVsCLD0uK3/wOkFs3QcUsgcXAdMJgbJSgijp2KrcU/Md4XDbgYNu/nSeOwokpUvQk2zz00= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721688; c=relaxed/simple; bh=6YtYFsxVkhY5+e15p3MN5Np8EaYDQ5dDUNwO009tVz8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=hhPrenUbqf56UDV6XsIairYfgXv/bqwmC5kbk7dCOXKwHRFbIRl6S74o6OSDTOrgklRwl4No3RGauHvmexMzBXG6doLweftgwnlcjSQ2hcaxoogzVMAp1VjoHhKc5AKIXPkKh0k9dbw8Aq9y8tcIZsc/Re77363PwvgpGB8MPLM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1d3e8a51e6bso14360515ad.3 for ; Mon, 08 Jan 2024 05:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721682; x=1705326482; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=haTrwFBvIcBEmhUjTut561vOIc/lrVHHHJAUZxIu7fU=; b=bw8hX0nM7Q/DMzPtERXpXJMtS3IRfbfj7j3JifD3V6r1CNmYlLmRqvmGBJqGnFhbfC hCBNLgTB+frLypO+HhyJyxUWK9vTrNQU4jEOQOCGv8GhdCDZKOBh+vZQabuA7bqGHMl8 HZoQQZqSZb6hpyeCOG4bh1xtpjfqr+u18efv2KTAuId6WuLtr8+HDSydnx6DdJtpOUTY 5UOUgZgY6h9TifSmYVL4HlimbQVZWrVEtHd7EgN98zuii496fAzcSIewAzWnYD+yf4Gk 3u3T2eGxC/e2/dc4DISLCIkNl/BUfwtB53pJMOI/gV1vdLt07xTLl1X2jdN42H7+7zAM p6Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721682; x=1705326482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=haTrwFBvIcBEmhUjTut561vOIc/lrVHHHJAUZxIu7fU=; b=e1wIsoPk6Tf712VSwcK16cPYew2Dt7jHbsBIJKJ3H2vlmlHEbwuolduzZr6Iu7nCBt tdaKnJgCfIrf3fS/BK+aoB3q4nNLKeZOZCzAotZc+qd+NDz3f30PBE/1MuY3PcqJwrmB 5cOEq232QGNtCPSA4frnJ/3onOJEmRaWM12LKSB/mN+raz4an1nlGZEDzMunnuAZTj/r pVU5wxCh4OmNz4V6C39Sv0dgUj2z358Pg232/l5Yltm/Jn/D1dnzo+anZYHTMktap4DK 3goIOxolkJej+W0sScqHSEDX9yvs6KwAhEukb+CbvICZ+JrKxPczMw3hEBfMy+OePo8K 3OWA== X-Gm-Message-State: AOJu0YwJQ7AqOAzxY8KSUb9hyYt/fnlUsOnpQHhdtNC6BRvF/j7LP12W XfDZmEusyAXL1oYQk03vqGN1+Q1QLq3Ep6Y9Dw/Sj7X4kTAMZcr0cEfobQEnp3mAg+PGxTuz7QP cVGqMtg1zwLgfYI139jNcMQjkt6sY+Onnm07unrDckX7LY9pDA51Y8gDZ3up8rCX8PpkM0Q05ZA 7ox4y4vHDY5pQ= X-Received: by 2002:a17:903:32c4:b0:1d4:ef61:2407 with SMTP id i4-20020a17090332c400b001d4ef612407mr4735771plr.74.1704721681669; Mon, 08 Jan 2024 05:48:01 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:48:01 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 4/5] RISC-V: Update testsuite due to -march string relaxation Date: Mon, 8 Jan 2024 21:47:37 +0800 Message-Id: <20240108134738.998804-5-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: 1787530415204865585 X-GMAIL-MSGID: 1787530415204865585 We has relaxed -march string, it no longer require canonical order, so we need update some of those testcase. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-23.c: Update test. * gcc.target/riscv/arch-27.c: Ditto. * gcc.target/riscv/arch-28.c: Ditto. * gcc.target/riscv/attribute-10.c: Ditto. --- gcc/testsuite/gcc.target/riscv/arch-23.c | 1 - gcc/testsuite/gcc.target/riscv/arch-27.c | 2 +- gcc/testsuite/gcc.target/riscv/arch-28.c | 2 +- gcc/testsuite/gcc.target/riscv/attribute-10.c | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.target/riscv/arch-23.c b/gcc/testsuite/gcc.target/riscv/arch-23.c index fca5425790c..aacfc451043 100644 --- a/gcc/testsuite/gcc.target/riscv/arch-23.c +++ b/gcc/testsuite/gcc.target/riscv/arch-23.c @@ -4,7 +4,6 @@ int foo() { } -/* { dg-error "ISA string is not in canonical order. 'c'" "" { target *-*-* } 0 } */ /* { dg-error "extension 'w' is unsupported standard single letter extension" "" { target *-*-* } 0 } */ /* { dg-error "extension 'zvl' starts with 'z' but is unsupported standard extension" "" { target *-*-* } 0 } */ /* { dg-error "extension 's123' starts with 's' but is unsupported standard supervisor extension" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/riscv/arch-27.c b/gcc/testsuite/gcc.target/riscv/arch-27.c index 70143b2156f..03f07deedd1 100644 --- a/gcc/testsuite/gcc.target/riscv/arch-27.c +++ b/gcc/testsuite/gcc.target/riscv/arch-27.c @@ -4,4 +4,4 @@ int foo() { } -/* { dg-error "ISA string is not in canonical order. 'e'" "" { target *-*-* } 0 } */ +/* { dg-error "'i', 'e' or 'g' must be the first extension" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/riscv/arch-28.c b/gcc/testsuite/gcc.target/riscv/arch-28.c index 934399a7b3a..0f83c03ad3d 100644 --- a/gcc/testsuite/gcc.target/riscv/arch-28.c +++ b/gcc/testsuite/gcc.target/riscv/arch-28.c @@ -4,4 +4,4 @@ int foo() { } -/* { dg-error "ISA string is not in canonical order. 'e'" "" { target *-*-* } 0 } */ +/* { dg-error "'i', 'e' or 'g' must be the first extension" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/riscv/attribute-10.c b/gcc/testsuite/gcc.target/riscv/attribute-10.c index 868adef6ab7..8a7f0a8ac49 100644 --- a/gcc/testsuite/gcc.target/riscv/attribute-10.c +++ b/gcc/testsuite/gcc.target/riscv/attribute-10.c @@ -3,4 +3,6 @@ int foo() { } -/* { dg-error "unexpected ISA string at end:" "" { target { "riscv*-*-*" } } 0 } */ +/* { dg-error "extension 'u' is unsupported standard single letter extension" "" { target { "riscv*-*-*" } } 0 } */ +/* { dg-error "extension 'n' is unsupported standard single letter extension" "" { target { "riscv*-*-*" } } 0 } */ +/* { dg-error "'i', 'e' or 'g' must be the first extension" "" { target { "riscv*-*-*" } } 0 } */ From patchwork Mon Jan 8 13:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 186015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1029522dyq; Mon, 8 Jan 2024 05:51:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGsU15IfdOr2v8tijgiNVNTTjlXMepa2S+OrgW1WCCwHCltgWpaZxyGyCb9jnRZLETLut4 X-Received: by 2002:ad4:5bcd:0:b0:681:101:ec40 with SMTP id t13-20020ad45bcd000000b006810101ec40mr3465668qvt.62.1704721901047; Mon, 08 Jan 2024 05:51:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704721901; cv=pass; d=google.com; s=arc-20160816; b=IF/5gb+nfRcE0FKHe+Cp6Y6fF1DdqsdW/5V9DQrLtEwxpCpL6j2NfrFA6iqbtHDyyt SsiBzgLczwirDZ481LaDvErZ5/ubKqBQIXPfmtGEdjaSFdoR16r2/nKYB0i56NBHuVK9 qYNa0UgEOKYvhead0GUOxZGaV0Thip2gi1UrURosHonTSbRf5LfxgJznGdSEAZTnvISn M3lziR98wxAZcjSd7nxbY9x4zl+i0BCm9+GbKXpnnNwBNpm5UJueR70eGZQBNtqHghuE mvGcxQDmRsfwcIqwICLNo7fR2cL2XjjDiznSTvhjwrBS/w/zdZQkVQg0SFVRT0uMFRGf y+qA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=Iz3CLQi3Dhf+fSZ4g/BiG9LD69+jGQx82H0+qMqQpO8=; fh=3Ck16crQUxNabL1wC/NAUZY2nAVZpSKeVH/lwIj1XIE=; b=dMTs889dP8syfkzVSIIHyqbcb07xG6iR1Spl+j59HuzI80054sPFuO9w6mUyHniLFT rpET0vGYmfu19J2YCuGK4X2FRQKHSz6VbvwIfBRV0pQMEPqYL6P2u9efi/CgIn8aKJjy avyosf5G99kFxTna6RyToWqbm43xoYWzlDpcTVDTn1/w2DXJUjDRMoNtlyZTWpiRmZsm T5IJ1zEKECq0KnTnexLpYj0oRK/47fG3+zkI9tl9dfZC16beyBsukqpKBrAfXsCOJdwg KLHOltWhabN9nPNvi9fRrRjc5qrKIGzlxcC4G7DFUwIcpZZ2K63sDHDlrUPc37WoE4dV 9R/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="jyXFmS/s"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h10-20020a0cf20a000000b0068069f398dcsi3941453qvk.90.2024.01.08.05.51.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:51:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="jyXFmS/s"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB0CF385E00F for ; Mon, 8 Jan 2024 13:51:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 11670385E459 for ; Mon, 8 Jan 2024 13:48:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11670385E459 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 11670385E459 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721688; cv=none; b=MrSCfPTewWaHltFlgvjlN0yLoh747h03X8q0PfnYdJAiWjjOxNSdjzK4Ya1wsAFld7YfrXhED+D/bIejF/rA6B5o4G5QFqTYU/BT/M8KfkKks9SKo1t43rvNhpnpSjBRIrot1ooEaXFTM4G6oBKaZsHBkkChNIn8duWAPGv0sAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721688; c=relaxed/simple; bh=Wn/jWrxlhGRYKUvHBSKpFirEFWEjWodzvWgvaWDajVY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=pNaD2/+LJPiAXMLrLQiHCBcDgWkm3bLBQIYx8GhkLWwFykNySS+D4yRMvwM006X4pEAkbLFugkbOJmqaa1/3HfsQOmbdtdM1AGqcPriGk8j7KFVLlC3cgjv1fq6LgN+CAKAf8k6HTizFlxYjfvxh8v/p1azS7Xgpz5XmgtoXw88= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1d4df66529bso4589525ad.1 for ; Mon, 08 Jan 2024 05:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721685; x=1705326485; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Iz3CLQi3Dhf+fSZ4g/BiG9LD69+jGQx82H0+qMqQpO8=; b=jyXFmS/sXRymtNQmk2+ZUQyCB0tCQC/K5HGoaWS5jX2tvRH9sGjzGc/rII3RkNU9s0 HOx1goVk96Cq0aREvLRl8o82hE5+A2f3H5UBHqVzqLreJK4JVkqs0FGioDvL7HqoP7hV ohU8GZtcfnJGP/Y1DAzaF+/W5My+aGqg2R5xg8fqQrbj8lGQtXzkTZxmNBto6xypL0kb uCS/YV3O60lk7u/HOZdFoveoGI8OjXMUtz6L6+1+FTgpVMHdxfHD/vokw1MCD2zNRkfu 95G1w4nMB/1LgI0k5Qq7ymlyis7Hm0jjff8FfcCw0OlU4BQ9aueik/fdjYuij2PQw/SE H91g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721685; x=1705326485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iz3CLQi3Dhf+fSZ4g/BiG9LD69+jGQx82H0+qMqQpO8=; b=lULcBtHIGJ+kOF0Bd8WOs0OT76Su0OM+YDDYDKSl1TnPc9WAkozauzLIYx6tHf3zod /NjUfjGuP8IfcRuzCUfM2GyDLNHVUWalWtLbhK3Zbg8jDiusrbz795x1JExQlW5B3JMp TO+dDZ5xSybLRl5CfPARNLYygznPoD6u7oAZVWAudQyP5Y/vGYyb/o6EFDy/fPFsyNp6 bPPKHRohf6Fyv1jWk9ngJ9z2v1JhLhXdzT7nLjFsCv6WrZ17ncLotCRVV/aup36Kn4mi 15PgBtO8Ce4cRIr52+bEVBprgqRiyV76UOrXsqKQXIB3hzWDNCKie1fC7jnzAvfXHbqx oETA== X-Gm-Message-State: AOJu0YwlKHP92RCOSo9HdCaLyXRQRLVnW3AwJy8AeImlI2xWAqhMFazY Y4FmGV3jQplfNyN+SAF2d3sCCC+9wiwxVqkLp5cD3c99Nt5QkZRTogM9tHBGGJFoHN3Q9aKyOR5 6ULS1QL9CWccrj0IQxMR3EaAjWH1lA6M4fq8wWuG9qMmAqlnoLOlt3c2bV0K9JeG3fkyd3TIc9Y vGroiWv5hTM4s= X-Received: by 2002:a17:903:41c2:b0:1d4:e075:354 with SMTP id u2-20020a17090341c200b001d4e0750354mr1366114ple.24.1704721684697; Mon, 08 Jan 2024 05:48:04 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:48:04 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 5/5] RISC-V: Document the syntax of -march Date: Mon, 8 Jan 2024 21:47:38 +0800 Message-Id: <20240108134738.998804-6-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: 1787530471982606315 X-GMAIL-MSGID: 1787530471982606315 --- gcc/doc/invoke.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 68d1f364ac0..81ee7ac758a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -30037,6 +30037,22 @@ Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and @samp{rv32imaf}. +The syntax of the ISA string is defined as follows: + +@table @code +@item The string must start with @samp{rv32} or @samp{rv64}, followed by +@samp{i}, @samp{e}, or @samp{g}, referred to as the base ISA. +@item The subsequent part of the string is a list of extension names. Extension +names can be categorized as multi-letter (e.g.@: @samp{zba}) and single-letter +(e.g.@: @samp{v}). Single-letter extensions can appear consecutively, +but multi-letter extensions must be separated by underscores. +@item An underscore can appear anywhere after the base ISA. It has no specific +effect but is used to improve readability and can act as a separator. +@item Extension names may include an optional version number, following the +syntax @samp{p} or @samp{}, (e.g.@: @samp{m2p1} or +@samp{m2}). +@end table + When @option{-march=} is not specified, use the setting from @option{-mcpu}. If both @option{-march} and @option{-mcpu=} are not specified, the default for