public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: Jin Ma <jinma@linux.alibaba.com>
Cc: binutils@sourceware.org, christoph.muellner@vrull.eu,
	 lifang_xia@linux.alibaba.com, jinma.contrib@gmail.com
Subject: Re: [PATCH 03/12] RISC-V: Add configuration-setting instructions for T-Head VECTOR vendor extension
Date: Fri, 17 Nov 2023 11:18:32 +0800	[thread overview]
Message-ID: <CAPpQWtAMmafa8DVUoSKxyoi74+5mNZ7ezg6pjTekDd_LhoH-tQ@mail.gmail.com> (raw)
In-Reply-To: <20231110072224.1735-1-jinma@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 4322 bytes --]

On Fri, Nov 10, 2023 at 3:22 PM Jin Ma <jinma@linux.alibaba.com> wrote:

> 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 configuration-setting instructions for the "XTheadVector"
> extension. The 'th' prefix and the "XTheadVector" 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
>
> Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
> Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu>
>
> gas/ChangeLog:
>
>         * testsuite/gas/riscv/x-thead-vector.d: New test.
>         * testsuite/gas/riscv/x-thead-vector.s: New test.
>
> include/ChangeLog:
>
>         * opcode/riscv-opc.h (MATCH_TH_VSETVL): New.
>
> opcodes/ChangeLog:
>
>         * riscv-opc.c: Likewise..
> ---
>  gas/testsuite/gas/riscv/x-thead-vector.d | 12 ++++++++++++
>  gas/testsuite/gas/riscv/x-thead-vector.s |  3 +++
>  include/opcode/riscv-opc.h               |  5 +++++
>  opcodes/riscv-opc.c                      |  4 ++++
>  4 files changed, 24 insertions(+)
>  create mode 100644 gas/testsuite/gas/riscv/x-thead-vector.d
>
> diff --git a/gas/testsuite/gas/riscv/x-thead-vector.d
> b/gas/testsuite/gas/riscv/x-thead-vector.d
> new file mode 100644
> index 00000000000..e509ed0971b
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/x-thead-vector.d
> @@ -0,0 +1,12 @@
> +#as: -march=rv32if_xtheadvector
> +#objdump: -dr
> +
> +.*:[   ]+file format .*
> +
> +
> +Disassembly of section .text:
> +
> +0+000 <.text>:
> +[      ]+[0-9a-f]+:[   ]+80c5f557[     ]+th.vsetvl[    ]+a0,a1,a2
> +[      ]+[0-9a-f]+:[   ]+0005f557[     ]+th.vsetvli[   ]+a0,a1,e8,m1,tu,mu
> +[      ]+[0-9a-f]+:[   ]+7ff5f557[     ]+th.vsetvli[   ]+a0,a1,2047
> diff --git a/gas/testsuite/gas/riscv/x-thead-vector.s
> b/gas/testsuite/gas/riscv/x-thead-vector.s
> index e69de29bb2d..ffea0a6f9f9 100644
> --- a/gas/testsuite/gas/riscv/x-thead-vector.s
> +++ b/gas/testsuite/gas/riscv/x-thead-vector.s
> @@ -0,0 +1,3 @@
> +       th.vsetvl a0, a1, a2
> +       th.vsetvli a0, a1, 0
> +       th.vsetvli a0, a1, 0x7ff
> diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
> index ed29384e825..dc18dd9f04c 100644
> --- a/include/opcode/riscv-opc.h
> +++ b/include/opcode/riscv-opc.h
> @@ -2648,6 +2648,11 @@
>  #define MASK_TH_SYNC_IS 0xffffffff
>  #define MATCH_TH_SYNC_S 0x0190000b
>  #define MASK_TH_SYNC_S 0xffffffff
> +/* Vendor-specific (T-Head) XTheadVector instructions.  */
> +#define MATCH_TH_VSETVL  0x80007057
> +#define MASK_TH_VSETVL   0xfe00707f
> +#define MATCH_TH_VSETVLI 0x00007057
> +#define MASK_TH_VSETVLI  0x8000707f
>

Seems like the whole t-head vector instructions will have the same
encodings as standard vector ones.  Could we just use MATCH/MASK_VSETVL to
replace MATCH/MASK_TH_VSETVL, and for all related vendor instructions?

Thanks
Nelson


>  /* Vendor-specific (Ventana Microsystems) XVentanaCondOps instructions */
>  #define MATCH_VT_MASKC 0x607b
>  #define MASK_VT_MASKC 0xfe00707f
> diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
> index 72d727cd77e..2fb7cf1e14a 100644
> --- a/opcodes/riscv-opc.c
> +++ b/opcodes/riscv-opc.c
> @@ -2234,6 +2234,10 @@ const struct riscv_opcode riscv_opcodes[] =
>  {"th.sync.is",       0, INSN_CLASS_XTHEADSYNC,  "",   MATCH_TH_SYNC_IS,
>      MASK_TH_SYNC_IS,       match_opcode, 0},
>  {"th.sync.s",        0, INSN_CLASS_XTHEADSYNC,  "",   MATCH_TH_SYNC_S,
>     MASK_TH_SYNC_S,        match_opcode, 0},
>
> +/* Vendor-specific (T-Head) XTheadVector instructions.  */
> +{"th.vsetvl",     0, INSN_CLASS_XTHEADVECTOR,  "d,s,t", MATCH_TH_VSETVL,
> MASK_TH_VSETVL, match_opcode, 0},
> +{"th.vsetvli",    0, INSN_CLASS_XTHEADVECTOR,  "d,s,Vc",
> MATCH_TH_VSETVLI, MASK_TH_VSETVLI, match_opcode, 0},
> +
>  /* Vendor-specific (Ventana Microsystems) XVentanaCondOps instructions */
>  {"vt.maskc",   64, INSN_CLASS_XVENTANACONDOPS, "d,s,t", MATCH_VT_MASKC,
> MASK_VT_MASKC, match_opcode, 0 },
>  {"vt.maskcn",  64, INSN_CLASS_XVENTANACONDOPS, "d,s,t", MATCH_VT_MASKCN,
> MASK_VT_MASKCN, match_opcode, 0 },
> --
> 2.17.1
>
>

  reply	other threads:[~2023-11-17  3:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10  7:17 [PATCH 01/12] RISC-V: Add " Jin Ma
2023-11-10  7:20 ` [PATCH 02/12] RISC-V: Add CSRs for " Jin Ma
2023-11-10  7:22 ` [PATCH 03/12] RISC-V: Add configuration-setting instructions " Jin Ma
2023-11-17  3:18   ` Nelson Chu [this message]
2023-11-17  9:53     ` Jin Ma
2023-11-10  7:23 ` [PATCH 04/12] RISC-V: Add load/store " Jin Ma
2023-11-10  7:24 ` [PATCH 05/12] RISC-V: Add the sub-extension "XTheadZvlsseg" " Jin Ma
2023-11-10  7:25 ` [PATCH 06/12] RISC-V: Add sub-extension XTheadZvamo " Jin Ma
2023-11-10  7:31 ` [PATCH 07/12] RISC-V: Add integer arithmetic instructions " Jin Ma
2023-11-10  7:31 ` [PATCH 08/12] RISC-V: Add fixed-point " Jin Ma
2023-11-10  7:32 ` [PATCH 09/12] RISC-V: Add floating-point " Jin Ma
2023-11-10  7:33 ` [PATCH 10/12] RISC-V: Add reductions " Jin Ma
2023-11-10  7:34 ` [PATCH 11/12] RISC-V: Add vector mask " Jin Ma
2023-11-10  7:35 ` [PATCH 12/12] RISC-V: Add vector permutation " Jin Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPpQWtAMmafa8DVUoSKxyoi74+5mNZ7ezg6pjTekDd_LhoH-tQ@mail.gmail.com \
    --to=nelson@rivosinc.com \
    --cc=binutils@sourceware.org \
    --cc=christoph.muellner@vrull.eu \
    --cc=jinma.contrib@gmail.com \
    --cc=jinma@linux.alibaba.com \
    --cc=lifang_xia@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).