All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: Weiwei Li <liweiwei@iscas.ac.cn>,
	qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Cc: palmer@dabbelt.com, alistair.francis@wdc.com,
	bin.meng@windriver.com, zhiwei_liu@linux.alibaba.com,
	wangjunqiang@iscas.ac.cn, lazyparser@gmail.com
Subject: Re: [PATCH 3/7] disas/riscv.c: Support disas for Zcm* extensions
Date: Mon, 22 May 2023 10:00:15 -0300	[thread overview]
Message-ID: <ed91c669-a2b1-116a-669e-78f469f7c9fc@ventanamicro.com> (raw)
In-Reply-To: <20230519021926.15362-4-liweiwei@iscas.ac.cn>



On 5/18/23 23:19, Weiwei Li wrote:
> Support disas for Zcmt* instructions only when related extensions
> are supported.
> 
> Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
> ---
>   disas/riscv.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/disas/riscv.c b/disas/riscv.c
> index 729ab684da..9e01810eef 100644
> --- a/disas/riscv.c
> +++ b/disas/riscv.c
> @@ -2501,7 +2501,7 @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
>                   op = rv_op_c_sqsp;
>               } else {
>                   op = rv_op_c_fsdsp;
> -                if (((inst >> 12) & 0b01)) {
> +                if (dec->cfg->ext_zcmp && ((inst >> 12) & 0b01)) {
>                       switch ((inst >> 8) & 0b01111) {
>                       case 8:
>                           if (((inst >> 4) & 0b01111) >= 4) {
> @@ -2527,16 +2527,20 @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
>                   } else {
>                       switch ((inst >> 10) & 0b011) {
>                       case 0:
> -                        if (((inst >> 2) & 0xFF) >= 32) {
> -                            op = rv_op_cm_jalt;
> -                        } else {
> -                            op = rv_op_cm_jt;
> +                        if (dec->cfg->ext_zcmt) {
> +                            if (((inst >> 2) & 0xFF) >= 32) {
> +                                op = rv_op_cm_jalt;
> +                            } else {
> +                                op = rv_op_cm_jt;
> +                            }

In this code, since you're not doing anything if dec->cfg->ext_zcmt is not set,
you could also break earlier and avoid changing the other lines:


>                       case 0:
> +                     if (!dec->cfg->ext_zcmt) {
> +                         break;
> +                     }
>                       if (((inst >> 2) & 0xFF) >= 32) {
>                           op = rv_op_cm_jalt;
>                       } else {
>                           op = rv_op_cm_jt;
>                       }
>                       break;

     >                           }
>                           break;
>                       case 3:
> -                        switch ((inst >> 5) & 0b011) {
> -                        case 1: op = rv_op_cm_mvsa01; break;
> -                        case 3: op = rv_op_cm_mva01s; break;
> +                        if (dec->cfg->ext_zcmp) {
> +                            switch ((inst >> 5) & 0b011) {
> +                            case 1: op = rv_op_cm_mvsa01; break;
> +                            case 3: op = rv_op_cm_mva01s; break;
> +                            }


Same thing here.


These are minor stylistic comments.


Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>                           }
>                           break;
>                       }


  reply	other threads:[~2023-05-22 13:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  2:19 [PATCH 0/7] Add support for extension specific disas Weiwei Li
2023-05-19  2:19 ` [PATCH 1/7] disas: Change type of disassemble_info.target_info to pointer Weiwei Li
2023-05-22 12:49   ` Daniel Henrique Barboza
2023-05-19  2:19 ` [PATCH 2/7] target/riscv: Pass RISCVCPUConfig as target_info to disassemble_info Weiwei Li
2023-05-22 12:54   ` Daniel Henrique Barboza
2023-05-22 14:20     ` Weiwei Li
2023-05-19  2:19 ` [PATCH 3/7] disas/riscv.c: Support disas for Zcm* extensions Weiwei Li
2023-05-22 13:00   ` Daniel Henrique Barboza [this message]
2023-05-22 14:24     ` Weiwei Li
2023-05-22 13:10   ` Daniel Henrique Barboza
2023-05-22 14:27     ` Weiwei Li
2023-05-22 14:30       ` Daniel Henrique Barboza
2023-05-19  2:19 ` [PATCH 4/7] disas/riscv.c: Support disas for Z*inx extensions Weiwei Li
2023-05-22 13:02   ` Daniel Henrique Barboza
2023-05-19  2:19 ` [PATCH 5/7] disas/riscv.c: Remove unused decomp_rv32/64 value for vector instructions Weiwei Li
2023-05-22 13:06   ` Daniel Henrique Barboza
2023-05-19  2:19 ` [PATCH 6/7] disas/riscv.c: Fix lines with over 80 characters Weiwei Li
2023-05-22 13:11   ` Daniel Henrique Barboza
2023-05-19  2:19 ` [PATCH 7/7] disas/riscv.c: Remove redundant parentheses Weiwei Li
2023-05-22 13:11   ` Daniel Henrique Barboza

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=ed91c669-a2b1-116a-669e-78f469f7c9fc@ventanamicro.com \
    --to=dbarboza@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=lazyparser@gmail.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=wangjunqiang@iscas.ac.cn \
    --cc=zhiwei_liu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.