Extend existing vqwdota* instructions to support both SEW=8 (Zvqwdota8i) and SEW=16 (Zvqwdota16i).
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 767b04658b4..23d3e9b3c43 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -1387,9 +1387,11 @@ DEF_HELPER_1(ssamoswap_disabled, void, env) /* Zalrsc SC write probe */ DEF_HELPER_FLAGS_3(sc_probe_write, TCG_CALL_NO_WG, void, env, tl, tl) -/* Zvqwdota8i - 8-bit Integer Dot Product */ +/* Zvqwdota8i/Zvqwdota16i - 8/16-bit Integer Dot Product */ DEF_HELPER_6(vqwdotau_vv_b, void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_6(vqwdotas_vv_b, void, ptr, ptr, ptr, ptr, env, i32) +DEF_HELPER_6(vqwdotau_vv_h, void, ptr, ptr, ptr, ptr, env, i32) +DEF_HELPER_6(vqwdotas_vv_h, void, ptr, ptr, ptr, ptr, 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 cc7d639ab73..b8a5d0567b1 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -1098,6 +1098,6 @@ vwabda_vx 111101 . ..... ..... 100 ..... 1010111 @r_vm vwabdau_vv 111110 . ..... ..... 000 ..... 1010111 @r_vm vwabdau_vx 111110 . ..... ..... 100 ..... 1010111 @r_vm -# *** Zvqwdota8i 8-bit Integer Dot-Product Extension *** +# *** Zvqwdota8i/Zvqwdota16i Integer Dot-Product Extension *** vqwdotau_vv 100110 . ..... ..... 000 ..... 1110111 @r_vm vqwdotas_vv 100111 . ..... ..... 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 befdbf273e5..fcff472a2ea 100644 --- a/target/riscv/tcg/insn_trans/trans_rvv.c.inc +++ b/target/riscv/tcg/insn_trans/trans_rvv.c.inc @@ -4149,7 +4149,8 @@ static bool vext_zvdota_base_check(DisasContext *s, arg_rmrr * a) static bool vext_vqwdota_check(DisasContext *s, arg_rmrr *a) { return vext_zvdota_base_check(s, a) && - (s->cfg_ptr->ext_zvqwdota8i && s->sew == MO_8); + ((s->cfg_ptr->ext_zvqwdota8i && s->sew == MO_8) || + (s->cfg_ptr->ext_zvqwdota16i && s->sew == MO_16)); } typedef void gen_helper_zvdota_int(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr, @@ -4159,7 +4160,7 @@ typedef void gen_helper_zvdota_int(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr, static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \ { \ static gen_helper_zvdota_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 6d79fb5d299..57a381098f6 100644 --- a/target/riscv/tcg/vector_helper.c +++ b/target/riscv/tcg/vector_helper.c @@ -6021,3 +6021,5 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \ GEN_VEXT_ZVDOTA_INT(vqwdotau_vv_b, 32, 8, uint8_t, H4, H1) GEN_VEXT_ZVDOTA_INT(vqwdotas_vv_b, 32, 8, int8_t, H4, H1) +GEN_VEXT_ZVDOTA_INT(vqwdotau_vv_h, 64, 16, uint16_t, H8, H2) +GEN_VEXT_ZVDOTA_INT(vqwdotas_vv_h, 64, 16, int16_t, H8, H2) -- 2.56.0
