disas/riscv: Add disassembler support for Xsfvqmaccdod/Xsfvqmaccqoq

Add disassembler support for all SiFive custom int8 matrix-multiply
instructions: sf.vqmacc{u,,us,su}.4x8x4 and sf.vqmacc{u,,us,su}.2x8x2.

These instructions share opcode 0b1011011 and funct3 0b010, and are
distinguished by funct6: 60-63 for the 4x8x4 (Xsfvqmaccqoq) tile and
44-47 for the 2x8x2 (Xsfvqmaccdod) tile.

Signed-off-by: Jason Chien <jason.chien@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Max Chou <max.chou@sifive.com>
Reviewed-by: Chao Liu <chao.liu@processmission.com>
Message-ID: <20260927082534.3228237-6-max.chou@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Jason Chien authored and Alistair Francis committed 2026-10-16 10:40:38 +10:00
1 parent 2eb9d17edc
commit 86b14980dc
7 files changed
+82 -1

No files matched your search

+1
View File
@@ -405,6 +405,7 @@ S: Supported
F: target/riscv/xsf.decode
F: target/riscv/tcg/insn_trans/trans_xsf.c.inc
F: target/riscv/tcg/xsf_helper.c
F: disas/riscv-xsf*
RENESAS RX CPUs
R: Yoshinori Sato <yoshinori.sato@nifty.com>
+2 -1
View File
@@ -8,7 +8,8 @@ common_ss.add(when: 'CONFIG_RISCV_DIS', if_true: files(
'riscv.c',
'riscv-xthead.c',
'riscv-xventana.c',
'riscv-xlrbr.c'
'riscv-xlrbr.c',
'riscv-xsf.c'
))
common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c'))
+11
View File
@@ -0,0 +1,11 @@
/* Xsfvqmaccqoq */
OP(sf_vqmaccu_4x8x4, "sf.vqmaccu.4x8x4", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmacc_4x8x4, "sf.vqmacc.4x8x4", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmaccus_4x8x4, "sf.vqmaccus.4x8x4", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmaccsu_4x8x4, "sf.vqmaccsu.4x8x4", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
/* Xsfvqmaccdod */
OP(sf_vqmaccu_2x8x2, "sf.vqmaccu.2x8x2", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmacc_2x8x2, "sf.vqmacc.2x8x2", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmaccus_2x8x2, "sf.vqmaccus.2x8x2", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
OP(sf_vqmaccsu_2x8x2, "sf.vqmaccsu.2x8x2", rv_codec_v_r, rv_fmt_vd_vs1_vs2)
+49
View File
@@ -0,0 +1,49 @@
/*
* QEMU RISC-V Disassembler for xsf (SiFive vendor extensions).
*
* Copyright (c) 2023 SiFive, Inc.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "disas/riscv.h"
#include "disas/riscv-xsf.h"
#define OP(N, ...) static const rv_opcode_data op_##N = { __VA_ARGS__ };
#include "riscv-xsf-op.c.inc"
#undef OP
const rv_opcode_data *decode_xsf(rv_decode *dec, rv_isa isa)
{
rv_inst inst = dec->inst;
switch ((inst >> 0) & 0b1111111) {
case 0b1011011:
switch ((inst >> 12) & 0b111) {
case 0b010:
switch ((inst >> 26) & 0b111111) {
case 0b101100:
return &op_sf_vqmaccu_2x8x2;
case 0b101101:
return &op_sf_vqmacc_2x8x2;
case 0b101110:
return &op_sf_vqmaccus_2x8x2;
case 0b101111:
return &op_sf_vqmaccsu_2x8x2;
case 0b111100:
return &op_sf_vqmaccu_4x8x4;
case 0b111101:
return &op_sf_vqmacc_4x8x4;
case 0b111110:
return &op_sf_vqmaccus_4x8x4;
case 0b111111:
return &op_sf_vqmaccsu_4x8x4;
}
break;
}
break;
}
return NULL;
}
+16
View File
@@ -0,0 +1,16 @@
/*
* QEMU disassembler -- RISC-V specific header (xsf*).
*
* Copyright (c) 2023 SiFive, Inc.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef DISAS_RISCV_XSF_H
#define DISAS_RISCV_XSF_H
#include "disas/riscv.h"
const rv_opcode_data *decode_xsf(rv_decode *, rv_isa);
#endif /* DISAS_RISCV_XSF_H */
+2
View File
@@ -27,6 +27,7 @@
#include "disas/riscv-xthead.h"
#include "disas/riscv-xventana.h"
#include "disas/riscv-xlrbr.h"
#include "disas/riscv-xsf.h"
/* register names */
@@ -3456,6 +3457,7 @@ static GString *disasm_inst(rv_isa isa, uint64_t pc, rv_inst inst,
{ has_xtheadsync_p, decode_xtheadsync },
{ has_XVentanaCondOps_p, decode_xventanacondops },
{ has_xlrbr_p, decode_xlrbr },
{ has_xsf_p, decode_xsf },
};
for (size_t i = 0; i < ARRAY_SIZE(decoders); i++) {
+1
View File
@@ -262,6 +262,7 @@ typedef struct {
#define rv_fmt_vd_vs2_imm_vm "O\tD,F,im"
#define rv_fmt_vd_vs2_uimm "O\tD,F,u"
#define rv_fmt_vd_vs2_uimm_vm "O\tD,F,um"
#define rv_fmt_vd_vs1_vs2 "O\tD,E,F"
#define rv_fmt_vd_vs1_vs2_vm "O\tD,E,Fm"
#define rv_fmt_vd_rs1_vs2_vm "O\tD,1,Fm"
#define rv_fmt_vd_fs1_vs2_vm "O\tD,4,Fm"