From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 9092E382DAF1 for ; Sun, 18 Sep 2022 07:24:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9092E382DAF1 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-ej1-x630.google.com with SMTP id sb3so28290958ejb.9 for ; Sun, 18 Sep 2022 00:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=HLMzkq+MlUpCu3XS9CLoDmAOfaYD4XpIH7HXF9oa2Qw=; b=Epz41SVBNYkyU2t1iHyv8fFopzwK9pPXkZMfMm/MCavTwwWayUmaXW6bGKkcRCWg7t iH1kv9asD7DytV25sJ/UFGriWbFZtBNHO/vOtPq5tHh3af5af6Eu3bHmP71iaPI/l3HS AMVzuLj+xHYrlSt4ViY1oLj81EgDTn3bI6JTpZiM8sXTc1oF/COkfVmoKk/G6/aorJ08 VuUv1ty6v8lSNnb8fob5NIqej1hNRMHuCE680u0Ej26AMb12Nlp2i6wXFOpUgxtZhSgB RAp327R+E/D0nSMmYWpUrMvEJvy69z7M1SWVT+c/aRjWiiPuOhkOEdHjbQS5bkQNG/vz c8mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=HLMzkq+MlUpCu3XS9CLoDmAOfaYD4XpIH7HXF9oa2Qw=; b=w9FcD32aAwUDQxq1pjAH3SxIRx/oxSPouqDZwTsiTLuMnyhYEvC6BdfhPZCIv1IrIy OOuDR/qQKyv/o0329gl5f8IJXhJ+GPmoGwPBxYAs5kYr7X8GBTu1JBdRfCt31u9WW6sV MGaI8rm8Z+zPw+P2bFWfY7Iler2bS2U5ReUh5Ezh7QcIykKxqUsVlZwyofkoBSJZOgOE e+HePyhMd/gm53JG7Xjbmjrv9LwkEq/kIAoQCaRQYZo15Mp1+EC3gPk2lK/oHU45ekr6 FIz2/ODow2WtdO9oOSEZ6jW2NOylEKP08D1d3wJTpxaynuM3C8RJAMapXBvuvV5bEGk7 m+2w== X-Gm-Message-State: ACrzQf2iqYXmPK4PYfZhV2f/H6pmdqb1zVnFfA3BsKGN7SiqOIm5RGcb UWdGq2+opNjOO9xLoIaF3nR9WEhKQHzIV2p3 X-Google-Smtp-Source: AMsMyM7hYSfyXjMQt1TB7qMYkqKLsvdD6mWczliCwQ2zNmY7gdOlW8Qavp1/UolFFFt0GYh6lyg/PA== X-Received: by 2002:a17:906:7311:b0:780:ada0:3a66 with SMTP id di17-20020a170906731100b00780ada03a66mr6947111ejc.541.1663485846145; Sun, 18 Sep 2022 00:24:06 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id e24-20020a170906315800b0073d15dfdc09sm13754108eje.11.2022.09.18.00.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Sep 2022 00:24:05 -0700 (PDT) From: Christoph Muellner To: binutils@sourceware.org, Nelson Chu , Kito Cheng , Jim Wilson , Philipp Tomsich , Palmer Dabbelt , Cooper Qu , Lifang Xia , Yunhai Shang , Zhiwei Liu Cc: =?UTF-8?q?Christoph=20M=C3=BCllner?= Subject: [PATCH v2 06/11] RISC-V: Add T-Head CondMov vendor extension Date: Sun, 18 Sep 2022 09:23:51 +0200 Message-Id: <20220918072356.2496130-7-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220918072356.2496130-1-christoph.muellner@vrull.eu> References: <20220918072356.2496130-1-christoph.muellner@vrull.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_MANYTO,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: From: Christoph Müllner T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the XTheadCondMov extension, a collection of T-Head-specific conditional move instructions. The 'th' prefix and the "XTheadCondMov" extension are documented in a PR for the RISC-V toolchain conventions ([1]). [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 Signed-off-by: Christoph Müllner --- bfd/elfxx-riscv.c | 5 +++++ gas/doc/c-riscv.texi | 5 +++++ gas/testsuite/gas/riscv/x-thead-condmov.d | 11 +++++++++++ gas/testsuite/gas/riscv/x-thead-condmov.s | 3 +++ include/opcode/riscv-opc.h | 8 ++++++++ include/opcode/riscv.h | 1 + opcodes/riscv-opc.c | 4 ++++ 7 files changed, 37 insertions(+) create mode 100644 gas/testsuite/gas/riscv/x-thead-condmov.d create mode 100644 gas/testsuite/gas/riscv/x-thead-condmov.s diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index d8ccc694cff..6bb8d6b2dc9 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1227,6 +1227,7 @@ static struct riscv_supported_ext riscv_supported_vendor_x_ext[] = {"xtheadbb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"xtheadbs", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"xtheadcmo", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"xtheadcondmov", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"xtheadsync", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {NULL, 0, 0, 0, 0} }; @@ -2398,6 +2399,8 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps, return riscv_subset_supports (rps, "xtheadbs"); case INSN_CLASS_XTHEADCMO: return riscv_subset_supports (rps, "xtheadcmo"); + case INSN_CLASS_XTHEADCONDMOV: + return riscv_subset_supports (rps, "xtheadcondmov"); case INSN_CLASS_XTHEADSYNC: return riscv_subset_supports (rps, "xtheadsync"); default: @@ -2535,6 +2538,8 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps, return "xtheadbs"; case INSN_CLASS_XTHEADCMO: return "xtheadcmo"; + case INSN_CLASS_XTHEADCONDMOV: + return "xtheadcondmov"; case INSN_CLASS_XTHEADSYNC: return "xtheadsync"; default: diff --git a/gas/doc/c-riscv.texi b/gas/doc/c-riscv.texi index 570a4f467f8..b1462ce213b 100644 --- a/gas/doc/c-riscv.texi +++ b/gas/doc/c-riscv.texi @@ -724,6 +724,11 @@ The XTheadCmo extension provides instructions for cache management. It is documented in @url{https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.0.0/xthead-2022-09-05-2.0.0.pdf}. +@item XTheadCondMov +The XTheadCondMov extension provides instructions for conditional moves. + +It is documented in @url{https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.0.0/xthead-2022-09-05-2.0.0.pdf}. + @item XTheadSync The XTheadSync extension provides instructions for multi-processor synchronization. diff --git a/gas/testsuite/gas/riscv/x-thead-condmov.d b/gas/testsuite/gas/riscv/x-thead-condmov.d new file mode 100644 index 00000000000..5972d09ec99 --- /dev/null +++ b/gas/testsuite/gas/riscv/x-thead-condmov.d @@ -0,0 +1,11 @@ +#as: -march=rv64i_xtheadcondmov +#source: x-thead-condmov.s +#objdump: -dr + +.*:[ ]+file format .* + +Disassembly of section .text: + +0+000 : +[ ]+[0-9a-f]+:[ ]+40c5950b[ ]+th.mveqz[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+42c5950b[ ]+th.mvnez[ ]+a0,a1,a2 diff --git a/gas/testsuite/gas/riscv/x-thead-condmov.s b/gas/testsuite/gas/riscv/x-thead-condmov.s new file mode 100644 index 00000000000..f71191d110b --- /dev/null +++ b/gas/testsuite/gas/riscv/x-thead-condmov.s @@ -0,0 +1,3 @@ +target: + th.mveqz a0, a1, a2 + th.mvnez a0, a1, a2 diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h index 9ed5cb455f2..5c0f6100e29 100644 --- a/include/opcode/riscv-opc.h +++ b/include/opcode/riscv-opc.h @@ -2181,6 +2181,11 @@ #define MASK_TH_L2CACHE_CIALL 0xffffffff #define MATCH_TH_L2CACHE_IALL 0x0160000b #define MASK_TH_L2CACHE_IALL 0xffffffff +/* Vendor-specific (T-Head) XTheadCondMov instructions. */ +#define MATCH_TH_MVEQZ 0x4000100b +#define MASK_TH_MVEQZ 0xfe00707f +#define MATCH_TH_MVNEZ 0x4200100b +#define MASK_TH_MVNEZ 0xfe00707f /* Vendor-specific (T-Head) XTheadSync instructions. */ #define MATCH_TH_SFENCE_VMAS 0x0400000b #define MASK_TH_SFENCE_VMAS 0xfe007fff @@ -2967,6 +2972,9 @@ DECLARE_INSN(th_icache_iva, MATCH_TH_ICACHE_IVA, MASK_TH_ICACHE_IVA) DECLARE_INSN(th_l2cache_call, MATCH_TH_L2CACHE_CALL, MASK_TH_L2CACHE_CALL) DECLARE_INSN(th_l2cache_ciall, MATCH_TH_L2CACHE_CIALL, MASK_TH_L2CACHE_CIALL) DECLARE_INSN(th_l2cache_iall, MATCH_TH_L2CACHE_IALL, MASK_TH_L2CACHE_IALL) +/* Vendor-specific (T-Head) XTheadCondMov instructions. */ +DECLARE_INSN(th_mveqz, MATCH_TH_MVEQZ, MASK_TH_MVEQZ) +DECLARE_INSN(th_mvnez, MATCH_TH_MVNEZ, MASK_TH_MVNEZ) /* Vendor-specific (T-Head) XTheadSync instructions. */ DECLARE_INSN(th_sfence_vmas, MATCH_TH_SFENCE_VMAS, MASK_TH_SFENCE_VMAS) DECLARE_INSN(th_sync, MATCH_TH_SYNC, MASK_TH_SYNC) diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h index 53b5b3c5aaf..d0ff929f84b 100644 --- a/include/opcode/riscv.h +++ b/include/opcode/riscv.h @@ -419,6 +419,7 @@ enum riscv_insn_class INSN_CLASS_XTHEADBB, INSN_CLASS_XTHEADBS, INSN_CLASS_XTHEADCMO, + INSN_CLASS_XTHEADCONDMOV, INSN_CLASS_XTHEADSYNC, }; diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c index 6f4a3f8236c..111308686fc 100644 --- a/opcodes/riscv-opc.c +++ b/opcodes/riscv-opc.c @@ -1867,6 +1867,10 @@ const struct riscv_opcode riscv_opcodes[] = {"th.l2cache.ciall", 0, INSN_CLASS_XTHEADCMO, "", MATCH_TH_L2CACHE_CIALL, MASK_TH_L2CACHE_CIALL, match_opcode, 0}, {"th.l2cache.iall", 0, INSN_CLASS_XTHEADCMO, "", MATCH_TH_L2CACHE_IALL, MASK_TH_L2CACHE_IALL, match_opcode, 0}, +/* Vendor-specific (T-Head) XTheadCondMov instructions. */ +{"th.mveqz", 0, INSN_CLASS_XTHEADCONDMOV, "d,s,t", MATCH_TH_MVEQZ, MASK_TH_MVEQZ, match_opcode, 0}, +{"th.mvnez", 0, INSN_CLASS_XTHEADCONDMOV, "d,s,t", MATCH_TH_MVNEZ, MASK_TH_MVNEZ, match_opcode, 0}, + /* Vendor-specific (T-Head) XTheadSync instructions. */ {"th.sfence.vmas", 0, INSN_CLASS_XTHEADSYNC, "s,t",MATCH_TH_SFENCE_VMAS, MASK_TH_SFENCE_VMAS, match_opcode, 0}, {"th.sync", 0, INSN_CLASS_XTHEADSYNC, "", MATCH_TH_SYNC, MASK_TH_SYNC, match_opcode, 0}, -- 2.37.2