diff mbox series

[v2,5/8] disas/riscv.c: Support disas for Z*inx extensions

Message ID 20230523093539.203909-6-liweiwei@iscas.ac.cn (mailing list archive)
State New, archived
Headers show
Series Add support for extension specific disas | expand

Commit Message

Weiwei Li May 23, 2023, 9:35 a.m. UTC
Support disas for Z*inx instructions only when Zfinx extension is supported.

Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 disas/riscv.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Comments

Alistair Francis May 26, 2023, 1:24 a.m. UTC | #1
On Tue, May 23, 2023 at 7:37 PM Weiwei Li <liweiwei@iscas.ac.cn> wrote:
>
> Support disas for Z*inx instructions only when Zfinx extension is supported.
>
> Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  disas/riscv.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/disas/riscv.c b/disas/riscv.c
> index 49a3eb6ac4..108bc2127d 100644
> --- a/disas/riscv.c
> +++ b/disas/riscv.c
> @@ -4592,16 +4592,24 @@ static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec)
>              append(buf, rv_ireg_name_sym[dec->rs2], buflen);
>              break;
>          case '3':
> -            append(buf, rv_freg_name_sym[dec->rd], buflen);
> +            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rd] :
> +                                              rv_freg_name_sym[dec->rd],
> +                   buflen);
>              break;
>          case '4':
> -            append(buf, rv_freg_name_sym[dec->rs1], buflen);
> +            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs1] :
> +                                              rv_freg_name_sym[dec->rs1],
> +                   buflen);
>              break;
>          case '5':
> -            append(buf, rv_freg_name_sym[dec->rs2], buflen);
> +            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs2] :
> +                                              rv_freg_name_sym[dec->rs2],
> +                   buflen);
>              break;
>          case '6':
> -            append(buf, rv_freg_name_sym[dec->rs3], buflen);
> +            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs3] :
> +                                              rv_freg_name_sym[dec->rs3],
> +                   buflen);
>              break;
>          case '7':
>              snprintf(tmp, sizeof(tmp), "%d", dec->rs1);
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/disas/riscv.c b/disas/riscv.c
index 49a3eb6ac4..108bc2127d 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -4592,16 +4592,24 @@  static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec)
             append(buf, rv_ireg_name_sym[dec->rs2], buflen);
             break;
         case '3':
-            append(buf, rv_freg_name_sym[dec->rd], buflen);
+            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rd] :
+                                              rv_freg_name_sym[dec->rd],
+                   buflen);
             break;
         case '4':
-            append(buf, rv_freg_name_sym[dec->rs1], buflen);
+            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs1] :
+                                              rv_freg_name_sym[dec->rs1],
+                   buflen);
             break;
         case '5':
-            append(buf, rv_freg_name_sym[dec->rs2], buflen);
+            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs2] :
+                                              rv_freg_name_sym[dec->rs2],
+                   buflen);
             break;
         case '6':
-            append(buf, rv_freg_name_sym[dec->rs3], buflen);
+            append(buf, dec->cfg->ext_zfinx ? rv_ireg_name_sym[dec->rs3] :
+                                              rv_freg_name_sym[dec->rs3],
+                   buflen);
             break;
         case '7':
             snprintf(tmp, sizeof(tmp), "%d", dec->rs1);