Extend the vqwbdotau.vv and vqwbdotas.vv instructions to support both 8-bit (Zvqwbdota8i) and 16-bit (Zvqwbdota16i) batched dot-product operations.
Signed-off-by: Max Chou <[email protected]> --- target/riscv/helper.h | 4 +++- target/riscv/insn32.decode | 2 +- target/riscv/tcg/insn_trans/trans_rvv.c.inc | 5 +++-- target/riscv/tcg/vector_helper.c | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index e48b9b4edec..84571a999f4 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -1400,9 +1400,11 @@ DEF_HELPER_6(vfwdota_vv, void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_6(vfqwdota_vv, void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_6(vfqwdota_alt_vv, void, ptr, ptr, ptr, ptr, env, i32) -/* Zvqwbdota8i - 8-bit Integer Batched Dot Product */ +/* Zvqwbdota8i/Zvqwbdota16i - 8/16-bit Integer Batched Dot Product */ DEF_HELPER_7(vqwbdotau_vv_b, void, ptr, ptr, ptr, ptr, i32, env, i32) DEF_HELPER_7(vqwbdotas_vv_b, void, ptr, ptr, ptr, ptr, i32, env, i32) +DEF_HELPER_7(vqwbdotau_vv_h, void, ptr, ptr, ptr, ptr, i32, env, i32) +DEF_HELPER_7(vqwbdotas_vv_h, void, ptr, ptr, ptr, ptr, i32, env, i32) /* SiFive Custom int8 Matrix-Multiply */ DEF_HELPER_5(sf_vqmaccu_4x8x4, void, ptr, ptr, ptr, env, i32) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index bf325229100..8a06547a570 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -1109,6 +1109,6 @@ vfwdota_vv 100100 . ..... ..... 001 ..... 1110111 @r_vm vfqwdota_vv 100110 . ..... ..... 001 ..... 1110111 @r_vm vfqwdota_alt_vv 100111 . ..... ..... 001 ..... 1110111 @r_vm -# *** Zvqwbdota8i 8-bit Integer Batched Dot-Product Extension *** +# *** Zvqwbdota8i/Zvqwbdota16i Integer Batched Dot-Product Extension *** vqwbdotau_vv 101110 . ..... ..... 000 ..... 1110111 @r_vm vqwbdotas_vv 101111 . ..... ..... 000 ..... 1110111 @r_vm diff --git a/target/riscv/tcg/insn_trans/trans_rvv.c.inc b/target/riscv/tcg/insn_trans/trans_rvv.c.inc index bc12bcb9b72..650affc045b 100644 --- a/target/riscv/tcg/insn_trans/trans_rvv.c.inc +++ b/target/riscv/tcg/insn_trans/trans_rvv.c.inc @@ -4315,7 +4315,8 @@ static bool vext_vqwbdota_check(DisasContext *s, arg_rmrr *a) int32_t sew = s->sew; int32_t vd_eew = sew + 2; return vext_zvbdota_base_check(s, a, vd_eew) && - (s->cfg_ptr->ext_zvqwbdota8i && sew == MO_8); + ((s->cfg_ptr->ext_zvqwbdota8i && sew == MO_8) || + (s->cfg_ptr->ext_zvqwbdota16i && s->sew == MO_16)); } typedef void gen_helper_zvbdota_int(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr, @@ -4325,7 +4326,7 @@ typedef void gen_helper_zvbdota_int(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr, static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \ { \ static gen_helper_zvbdota_int * const fns[2] = { \ - gen_helper_##NAME##_b, NULL, \ + gen_helper_##NAME##_b, gen_helper_##NAME##_h, \ }; \ if (CHECK(s, a)) { \ TCGv_ptr dest, src1, src2, mask; \ diff --git a/target/riscv/tcg/vector_helper.c b/target/riscv/tcg/vector_helper.c index 5ea073b6d76..683b14f28f3 100644 --- a/target/riscv/tcg/vector_helper.c +++ b/target/riscv/tcg/vector_helper.c @@ -6197,3 +6197,5 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \ GEN_VEXT_ZVBDOTA_INT(vqwbdotau_vv_b, 32, 8, uint8_t, H4, H1) GEN_VEXT_ZVBDOTA_INT(vqwbdotas_vv_b, 32, 8, int8_t, H4, H1) +GEN_VEXT_ZVBDOTA_INT(vqwbdotau_vv_h, 64, 16, uint16_t, H8, H2) +GEN_VEXT_ZVBDOTA_INT(vqwbdotas_vv_h, 64, 16, int16_t, H8, H2) -- 2.56.0
