From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 7E74338555AF for ; Sat, 29 Jul 2023 01:56:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E74338555AF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 4B34D300089; Sat, 29 Jul 2023 01:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1690595815; bh=XzSFHtN8gxcGT2WleCXzYbCAtMevue4z1HMXZNHW6Lc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=a2XuXWSW+mO/HtsfEh5ho88TFyeuvMBRgebv+B7CWOmAs3gg+JmRR1zPtU7De6sgM QcNBIoOKTyJ/2Y1Yquuz+VVTNUvWB2Q/Il9/9a+e44ok42SXPJ6vcNvghjq9j+qqPc ZjBqK7zy5aIccC4KcE9H5yJ4kzLbpnvGL+dKHbDg= From: Tsukasa OI To: Tsukasa OI , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu , Kito Cheng , Jiawei Cc: binutils@sourceware.org Subject: [REVIEW ONLY 2/3] MOCK: RISC-V: Add 'Zce' extension support Date: Sat, 29 Jul 2023 01:56:19 +0000 Message-ID: <8d7e2380a4ebb6795b33559ab98c5ca4e3881dcb.1690595772.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_MANYTO,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 List-Id: From: Tsukasa OI It adds a support for the 'Zce' superset compressed instruction extension for embedded systems. **THIS IS A MOCKUP** Since 'Zcmp' and 'Zcmt' are not added to GNU Binutils yet, this commit is just a mockup. However, it outlines what will be required on the 'Zce' support along with new complex implication design. bfd/ChangeLog: * elfxx-riscv.c (check_implicit_for_f_zce): New function to check whether adding implication 'F' -> 'Zcf' is appropriate. (riscv_implicit_subsets): Add conditional implication from 'F' -> 'Zcf'. (riscv_supported_std_z_ext): [MOCK] Add 'Zce' to the supported 'Z' extension list. --- bfd/elfxx-riscv.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 06ac521bdf27..94487306fae5 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1099,6 +1099,20 @@ check_implicit_for_i (const riscv_parse_subset_t *rps ATTRIBUTE_UNUSED, && subset->minor_version < 1)); } +/* Add the IMPLICIT only when the 'Zce' extension is also available + and XLEN is 32. */ + +static bool +check_implicit_for_f_zce (const riscv_parse_subset_t *rps, + const riscv_implicit_subset_t *implicit + ATTRIBUTE_UNUSED, + const riscv_subset_t *subset ATTRIBUTE_UNUSED) +{ + riscv_subset_t *tmp = NULL; + return *rps->xlen == 32 + && riscv_lookup_subset (rps->subset_list, "zce", &tmp); +} + /* All extension implications. */ static riscv_implicit_subset_t riscv_implicit_subsets[] = @@ -1184,6 +1198,10 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] = {"zvksg", "zvkg", check_implicit_always}, {"zvksc", "zvks", check_implicit_always}, {"zvksc", "zvbc", check_implicit_always}, + {"zce", "zca", check_implicit_always}, + {"zce", "zcb", check_implicit_always}, + {"zce", "zcmp", check_implicit_always}, + {"zce", "zcmt", check_implicit_always}, {"zcf", "zca", check_implicit_always}, {"zcd", "zca", check_implicit_always}, {"zcb", "zca", check_implicit_always}, @@ -1194,6 +1212,9 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] = {"sscofpmf", "zicsr", check_implicit_always}, {"ssstateen", "zicsr", check_implicit_always}, {"sstc", "zicsr", check_implicit_always}, + /* Complex implications (that should be checked after others). */ + {"f", "zcf", check_implicit_for_f_zce}, + /* Tail of the list. */ {NULL, NULL, NULL} }; @@ -1325,6 +1346,10 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] = {"zcb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zcf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zcd", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + /* MOCK: uncomment those lines once ready. */ + // {"zce", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + // {"zcmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + // {"zcmt", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {NULL, 0, 0, 0, 0} }; -- 2.41.0