Add the Zvdota integer, BF16 and FP8 intrinsics, including distinct
FP8 vector types. Select static instruction patterns for each source
type combination and preserve the generated type-index mappings.
gcc/ChangeLog:
* config/riscv/genrvv-type-indexer.cc (float8type): New helper.
(emit_zvdota_type_indexes, emit_float8_type_index): New functions.
(main): Emit accumulator and FP8 type indexes.
* config/riscv/riscv-vector-builtins-bases.cc (zvdota_vs2_argno,
zvdota_unsigned_vs2_p, zvdota_e5m2_vs2_p): New helpers.
(vqwdota, vfwdota, vfqwdota): New expanders.
(BASE): Register them.
* config/riscv/riscv-vector-builtins-bases.h: Declare new bases.
* config/riscv/riscv-vector-builtins-functions.def: Add intrinsics.
* config/riscv/riscv-vector-builtins-shapes.cc (supports_vectype_p):
Allow Zvdota BF16 types.
(zvdota_def): New shape.
(SHAPE): Register it.
* config/riscv/riscv-vector-builtins-shapes.h: Declare it.
* config/riscv/riscv-vector-builtins.cc: Add operand type tables.
(DEF_RVV_TYPE_INDEX): Add accumulator and FP8 indexes.
(get_builtin_partition): Handle Zvdota extensions.
(register_builtin_types_on_null): Register FP8 scalar types.
(mangle_fp8_type): New helper.
(registered_function::overloaded_hash): Hash FP8 formats separately.
* config/riscv/riscv-vector-builtins.def: Add FP8 and base types.
* config/riscv/riscv-vector-builtins.h (required_ext,
rvv_builtin_partition): Add Zvdota extensions.
(required_ext_to_isa_name, required_extensions_specified): Handle them.
* config/riscv/riscv.cc (riscv_vector_element_bitsize): Handle FP8.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/zvdota-altfmt-chain.c: New test.
* gcc.target/riscv/rvv/base/zvdota-bf16-elen-fail.c: New test.
* gcc.target/riscv/rvv/base/zvdota-elen-dependency.c: New test.
* gcc.target/riscv/rvv/base/zvdota-fp8-mode-fail.c: New test.
* gcc.target/riscv/rvv/base/zvdota-fp8-overloaded-fixed.c: New test.
* gcc.target/riscv/rvv/base/zvdota-fp8-overloaded.c: New test.
* gcc.target/riscv/rvv/base/zvdota-i16-require-extension.c: New test.
* gcc.target/riscv/rvv/base/zvdota-intrinsic.c: New test.
* gcc.target/riscv/rvv/base/zvdota-lmul.c: New test.
* gcc.target/riscv/rvv/base/zvdota-no-rm-fail.c: New test.
* gcc.target/riscv/rvv/base/zvdota-require-extension.c: New test.
---
gcc/config/riscv/genrvv-type-indexer.cc | 114 +++++++++
.../riscv/riscv-vector-builtins-bases.cc | 107 ++++++++
.../riscv/riscv-vector-builtins-bases.h | 4 +
.../riscv/riscv-vector-builtins-functions.def | 32 +++
.../riscv/riscv-vector-builtins-shapes.cc | 41 ++-
.../riscv/riscv-vector-builtins-shapes.h | 1 +
gcc/config/riscv/riscv-vector-builtins.cc | 235 +++++++++++++++++-
gcc/config/riscv/riscv-vector-builtins.def | 36 ++-
gcc/config/riscv/riscv-vector-builtins.h | 24 ++
gcc/config/riscv/riscv.cc | 2 +-
.../riscv/rvv/base/zvdota-altfmt-chain.c | 17 ++
.../riscv/rvv/base/zvdota-bf16-elen-fail.c | 10 +
.../riscv/rvv/base/zvdota-elen-dependency.c | 18 ++
.../riscv/rvv/base/zvdota-fp8-mode-fail.c | 27 ++
.../rvv/base/zvdota-fp8-overloaded-fixed.c | 8 +
.../riscv/rvv/base/zvdota-fp8-overloaded.c | 35 +++
.../rvv/base/zvdota-i16-require-extension.c | 10 +
.../riscv/rvv/base/zvdota-intrinsic.c | 106 ++++++++
.../gcc.target/riscv/rvv/base/zvdota-lmul.c | 21 ++
.../riscv/rvv/base/zvdota-no-rm-fail.c | 25 ++
.../riscv/rvv/base/zvdota-require-extension.c | 10 +
21 files changed, 878 insertions(+), 5 deletions(-)
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-altfmt-chain.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-bf16-elen-fail.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-elen-dependency.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-mode-fail.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded-fixed.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-i16-require-extension.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-lmul.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-no-rm-fail.c
create mode 100644
gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-require-extension.c
diff --git a/gcc/config/riscv/genrvv-type-indexer.cc
b/gcc/config/riscv/genrvv-type-indexer.cc
index
413ca19a1719265e621a476dd43314137623647a..b1b708551ecc4590348e6060500c823eb9b7cde8
100644
--- a/gcc/config/riscv/genrvv-type-indexer.cc
+++ b/gcc/config/riscv/genrvv-type-indexer.cc
@@ -133,6 +133,17 @@ bfloat16_type (int lmul_log2)
return mode.str ();
}
+std::string
+float8type (const char *format, int lmul_log2)
+{
+ if (!valid_type (8, lmul_log2, /* float_t = */ false))
+ return "INVALID";
+
+ std::stringstream mode;
+ mode << "vfloat8" << format << to_lmul (lmul_log2) << "_t";
+ return mode.str ();
+}
+
std::string
bfloat16_wide_type (int lmul_log2)
{
@@ -244,6 +255,90 @@ same_ratio_eew_bf16_type (unsigned sew, int lmul_log2)
return bfloat16_type (elmul_log2);
}
+static void
+emit_zvdota_type_indexes (FILE *fp, const char *acc = "INVALID",
+ const char *uacc = "INVALID",
+ const char *f32_acc = "INVALID",
+ const char *fp8e4m3 = "INVALID",
+ const char *fp8e5m2 = "INVALID")
+{
+ fprintf (fp, " /* ZVDOTA_ACC. */ %s,\n", acc);
+ fprintf (fp, " /* ZVDOTA_UACC. */ %s,\n", uacc);
+ fprintf (fp, " /* ZVDOTA_F32_ACC. */ %s,\n", f32_acc);
+ fprintf (fp, " /* FP8E4M3. */ %s,\n", fp8e4m3);
+ fprintf (fp, " /* FP8E5M2. */ %s,\n", fp8e5m2);
+}
+
+static void
+emit_float8_type_index (FILE *fp, const char *format, int lmul_log2)
+{
+ fprintf (fp, "DEF_RVV_TYPE_INDEX (\n");
+ fprintf (fp, " /* VECTOR. */ %s,\n",
+ float8type (format, lmul_log2).c_str ());
+ fprintf (fp, " /* MASK. */ %s,\n", maskmode (8, lmul_log2).c_str ());
+ fprintf (fp, " /* SIGNED. */ %s,\n",
+ inttype (8, lmul_log2, /* unsigned_p = */ false).c_str ());
+ fprintf (fp, " /* UNSIGNED. */ %s,\n",
+ inttype (8, lmul_log2, /* unsigned_p = */ true).c_str ());
+ fprintf (fp, " /* SIGNED_EEW8_INDEX. */ %s,\n",
+ inttype (8, lmul_log2, /* unsigned_p = */ false).c_str ());
+ for (unsigned eew : {8, 16, 32, 64})
+ fprintf (fp, " /* EEW%d_INDEX. */ %s,\n", eew,
+ same_ratio_eew_type (8, lmul_log2, eew,
+ /* unsigned_p = */ true, false)
+ .c_str ());
+ fprintf (fp, " /* SHIFT. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_TRUNC. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_EMUL. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_EMUL_SIGNED. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_EMUL_UNSIGNED. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_FIX. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_FIX_SIGNED. */ INVALID,\n");
+ fprintf (fp, " /* QUAD_FIX_UNSIGNED. */ INVALID,\n");
+ fprintf (fp, " /* OCT_TRUNC. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_SCALAR. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_SIGNED. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_UNSIGNED. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_UNSIGNED_SCALAR. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_BFLOAT_SCALAR. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_BFLOAT. */ INVALID,\n");
+ fprintf (fp, " /* DOUBLE_TRUNC_FLOAT. */ INVALID,\n");
+ fprintf (fp, " /* FLOAT. */ INVALID,\n");
+ fprintf (fp, " /* LMUL1. */ %s,\n", float8type (format, 0).c_str ());
+ fprintf (fp, " /* WLMUL1. */ INVALID,\n");
+ fprintf (fp, " /* QLMUL1. */ INVALID,\n");
+ fprintf (fp, " /* QLMUL1_SIGNED. */ INVALID,\n");
+ fprintf (fp, " /* QLMUL1_UNSIGNED. */ INVALID,\n");
+ fprintf (fp, " /* XFQF. */ INVALID,\n");
+ for (unsigned eew : {8, 16, 32, 64})
+ fprintf (fp, " /* EEW%d_INTERPRET. */ INVALID,\n", eew);
+
+ for (unsigned boolsize : BOOL_SIZE_LIST)
+ fprintf (fp, " /* BOOL%d_INTERPRET. */ INVALID,\n", boolsize);
+
+ for (unsigned eew : EEW_SIZE_LIST)
+ fprintf (fp, " /* SIGNED_EEW%d_LMUL1_INTERPRET. */ INVALID,\n", eew);
+
+ for (unsigned eew : EEW_SIZE_LIST)
+ fprintf (fp, " /* UNSIGNED_EEW%d_LMUL1_INTERPRET. */ INVALID,\n", eew);
+
+ fprintf (fp, " /* X2. */ INVALID,\n");
+
+ for (unsigned lmul_log2_offset : {1, 2, 3, 4, 5, 6})
+ {
+ unsigned multiple_of_lmul = 1 << lmul_log2_offset;
+ fprintf (fp, " /* X%d_VLMUL_EXT. */ INVALID,\n", multiple_of_lmul);
+ }
+
+ emit_zvdota_type_indexes (fp, "INVALID", "INVALID", "vfloat32m1_t",
+ float8type ("e4m3", lmul_log2).c_str (),
+ float8type ("e5m2", lmul_log2).c_str ());
+ fprintf (fp, " /* TUPLE_SUBPART. */ %s\n",
+ float8type (format, lmul_log2).c_str ());
+ fprintf (fp, ")\n");
+}
+
int
main (int argc, const char **argv)
{
@@ -315,6 +410,7 @@ main (int argc, const char **argv)
unsigned multiple_of_lmul = 1 << lmul_log2_offset;
fprintf (fp, " /*X%d_INTERPRET*/ INVALID,\n", multiple_of_lmul);
}
+ emit_zvdota_type_indexes (fp);
fprintf (fp, " /*TUPLE_SUBPART*/ INVALID\n");
fprintf (fp, ")\n");
}
@@ -447,9 +543,24 @@ main (int argc, const char **argv)
inttype (sew, lmul_log2 + lmul_log2_offset, unsigned_p)
.c_str ());
}
+ if (nf == 1 && sew == 8)
+ emit_zvdota_type_indexes (
+ fp, inttype (32, LMUL1_LOG2, /* unsigned_p = */ false).c_str (),
+ inttype (32, LMUL1_LOG2, /* unsigned_p = */ true).c_str ());
+ else if (nf == 1 && sew == 16)
+ emit_zvdota_type_indexes (
+ fp, inttype (64, LMUL1_LOG2, /* unsigned_p = */ false).c_str (),
+ inttype (64, LMUL1_LOG2, /* unsigned_p = */ true).c_str ());
+ else
+ emit_zvdota_type_indexes (fp);
fprintf (fp, " /*TUPLE_SUBPART*/ %s\n",
inttype (sew, lmul_log2, 1, unsigned_p).c_str ());
fprintf (fp, ")\n");
+ if (sew == 8 && nf == 1 && unsigned_p)
+ {
+ emit_float8_type_index (fp, "e4m3", lmul_log2);
+ emit_float8_type_index (fp, "e5m2", lmul_log2);
+ }
}
// Build for vbfloat16
for (int lmul_log2 : {-2, -1, 0, 1, 2, 3})
@@ -523,6 +634,8 @@ main (int argc, const char **argv)
fprintf (fp, " /*X%d_VLMUL_EXT*/ %s,\n", multiple_of_lmul,
bfloat16_type (lmul_log2 + lmul_log2_offset).c_str ());
}
+ emit_zvdota_type_indexes (fp, "INVALID", "INVALID",
+ nf == 1 ? "vfloat32m1_t" : "INVALID");
fprintf (fp, " /*TUPLE_SUBPART*/ %s\n",
bfloat16_type (lmul_log2, 1U).c_str ());
fprintf (fp, ")\n");
@@ -612,6 +725,7 @@ main (int argc, const char **argv)
fprintf (fp, " /*X%d_VLMUL_EXT*/ %s,\n", multiple_of_lmul,
floattype (sew, lmul_log2 + lmul_log2_offset).c_str ());
}
+ emit_zvdota_type_indexes (fp);
fprintf (fp, " /*TUPLE_SUBPART*/ %s\n",
floattype (sew, lmul_log2, 1).c_str ());
fprintf (fp, ")\n");
diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc
b/gcc/config/riscv/riscv-vector-builtins-bases.cc
index
3bbec005facfe088ad3d09e58f2244a2525c8455..642af8213b9a131edc527e5a3aee023b72635cb0
100644
--- a/gcc/config/riscv/riscv-vector-builtins-bases.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc
@@ -2497,6 +2497,104 @@ public:
}
};
+static unsigned
+zvdota_vs2_argno (const function_expander &e)
+{
+ return e.pred == PRED_TYPE_m || e.pred == PRED_TYPE_tum ? 2 : 1;
+}
+
+static bool
+zvdota_unsigned_vs2_p (vector_type_index type_idx)
+{
+ switch (type_idx)
+ {
+ case VECTOR_TYPE_vuint8mf8_t:
+ case VECTOR_TYPE_vuint8mf4_t:
+ case VECTOR_TYPE_vuint8mf2_t:
+ case VECTOR_TYPE_vuint8m1_t:
+ case VECTOR_TYPE_vuint8m2_t:
+ case VECTOR_TYPE_vuint8m4_t:
+ case VECTOR_TYPE_vuint8m8_t:
+ case VECTOR_TYPE_vuint16mf4_t:
+ case VECTOR_TYPE_vuint16mf2_t:
+ case VECTOR_TYPE_vuint16m1_t:
+ case VECTOR_TYPE_vuint16m2_t:
+ case VECTOR_TYPE_vuint16m4_t:
+ case VECTOR_TYPE_vuint16m8_t:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool
+zvdota_e5m2_vs2_p (vector_type_index type_idx)
+{
+ switch (type_idx)
+ {
+ case VECTOR_TYPE_vfloat8e5m2mf8_t:
+ case VECTOR_TYPE_vfloat8e5m2mf4_t:
+ case VECTOR_TYPE_vfloat8e5m2mf2_t:
+ case VECTOR_TYPE_vfloat8e5m2m1_t:
+ case VECTOR_TYPE_vfloat8e5m2m2_t:
+ case VECTOR_TYPE_vfloat8e5m2m4_t:
+ case VECTOR_TYPE_vfloat8e5m2m8_t:
+ return true;
+ default:
+ return false;
+ }
+}
+
+class vqwdota : public function_base
+{
+public:
+ bool has_merge_operand_p () const override { return false; }
+
+ rtx expand (function_expander &e) const override
+ {
+ machine_mode mode = e.arg_mode (zvdota_vs2_argno (e));
+ bool vs2_unsigned_p = zvdota_unsigned_vs2_p (e.type.index);
+ bool vs1_unsigned_p
+ = e.op_info->args[2].base_type == RVV_BASE_unsigned_vector;
+ int unspec = vs2_unsigned_p
+ ? (vs1_unsigned_p ? UNSPEC_VQWDOTA_UU : UNSPEC_VQWDOTA_US)
+ : (vs1_unsigned_p ? UNSPEC_VQWDOTA_SU : UNSPEC_VQWDOTA_SS);
+ return e.use_widen_ternop_insn (code_for_pred_vv_zvdota (unspec, mode));
+ }
+};
+
+class vfwdota : public function_base
+{
+public:
+ bool has_merge_operand_p () const override { return false; }
+
+ rtx expand (function_expander &e) const override
+ {
+ return e.use_widen_ternop_insn (
+ code_for_pred_vfwdota_vv_zvdota (e.arg_mode (zvdota_vs2_argno (e))));
+ }
+};
+
+class vfqwdota : public function_base
+{
+public:
+ bool has_merge_operand_p () const override { return false; }
+
+ rtx expand (function_expander &e) const override
+ {
+ machine_mode mode = e.arg_mode (zvdota_vs2_argno (e));
+ bool vs2_e5m2_p = zvdota_e5m2_vs2_p (e.type.index);
+ bool vs1_e5m2_p
+ = e.op_info->args[2].base_type == RVV_BASE_fp8e5m2_vector;
+ int unspec = vs2_e5m2_p
+ ? (vs1_e5m2_p ? UNSPEC_VFQWDOTA_E5M2_E5M2
+ : UNSPEC_VFQWDOTA_E5M2_E4M3)
+ : (vs1_e5m2_p ? UNSPEC_VFQWDOTA_E4M3_E5M2
+ : UNSPEC_VFQWDOTA_E4M3_E4M3);
+ return e.use_widen_ternop_insn (code_for_pred_vv_zvdota (unspec, mode));
+ }
+};
+
static constexpr const vsetvl<false> vsetvl_obj;
static constexpr const vsetvl<true> vsetvlmax_obj;
static constexpr const loadstore<false, LST_UNIT_STRIDE, false> vle_obj;
@@ -2829,6 +2927,11 @@ static constexpr const vabd<UNSPEC_VUABD> vabdu_obj;
static constexpr const vabda<UNSPEC_VSABDA> vwabda_obj;
static constexpr const vabda<UNSPEC_VUABDA> vwabdau_obj;
+/* Zvdota. */
+static constexpr const vqwdota vqwdota_obj;
+static constexpr const vfwdota vfwdota_obj;
+static constexpr const vfqwdota vfqwdota_obj;
+
/* Declare the function base NAME, pointing it to an instance
of class <NAME>_obj. */
#define BASE(NAME) \
@@ -3162,4 +3265,8 @@ BASE (vabd)
BASE (vabdu)
BASE (vwabda)
BASE (vwabdau)
+/* Zvdota. */
+BASE (vqwdota)
+BASE (vfwdota)
+BASE (vfqwdota)
} // end namespace riscv_vector
diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.h
b/gcc/config/riscv/riscv-vector-builtins-bases.h
index
d7a727d6bc5b0c1323a2c82cca6452a1382339a1..9f4fbdbc636fe60adbd709b9793dbe1c15d94b2a
100644
--- a/gcc/config/riscv/riscv-vector-builtins-bases.h
+++ b/gcc/config/riscv/riscv-vector-builtins-bases.h
@@ -358,6 +358,10 @@ extern const function_base *const vabd;
extern const function_base *const vabdu;
extern const function_base *const vwabda;
extern const function_base *const vwabdau;
+/* Zvdota. */
+extern const function_base *const vqwdota;
+extern const function_base *const vfwdota;
+extern const function_base *const vfqwdota;
}
} // end namespace riscv_vector
diff --git a/gcc/config/riscv/riscv-vector-builtins-functions.def
b/gcc/config/riscv/riscv-vector-builtins-functions.def
index
a31e1c4e194cfe79b98c4c5dd93a2f63c665c86e..cdf755e767d7e30b04474e90a15604326f5021bb
100644
--- a/gcc/config/riscv/riscv-vector-builtins-functions.def
+++ b/gcc/config/riscv/riscv-vector-builtins-functions.def
@@ -431,6 +431,38 @@ DEF_RVV_FUNCTION (vfwmsac_frm, alu_frm, full_preds,
f_wwfv_ops)
DEF_RVV_FUNCTION (vfwnmsac_frm, alu_frm, full_preds, f_wwvv_ops)
DEF_RVV_FUNCTION (vfwnmsac_frm, alu_frm, full_preds, f_wwfv_ops)
+#undef REQUIRED_EXTENSIONS
+#define REQUIRED_EXTENSIONS ZVQWDOTA8I_EXT
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota8i_ss_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota8i_su_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota8i_us_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota8i_uu_vv_ops)
+
+#undef REQUIRED_EXTENSIONS
+#define REQUIRED_EXTENSIONS ZVQWDOTA16I_EXT
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota16i_ss_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota16i_su_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota16i_us_vv_ops)
+DEF_RVV_FUNCTION (vqwdota, zvdota, no_mu_preds, zvqwdota16i_uu_vv_ops)
+
+#undef REQUIRED_EXTENSIONS
+#define REQUIRED_EXTENSIONS ZVFWDOTA16BF_EXT
+DEF_RVV_FUNCTION (vfwdota, zvdota, no_mu_preds, zvfwdota16bf_vv_ops)
+
+#undef REQUIRED_EXTENSIONS
+#define REQUIRED_EXTENSIONS ZVFQWDOTA8F_EXT
+DEF_RVV_FUNCTION (vfqwdota, zvdota, no_mu_preds,
+ zvfqwdota8f_e4m3_e4m3_vv_ops)
+DEF_RVV_FUNCTION (vfqwdota, zvdota, no_mu_preds,
+ zvfqwdota8f_e4m3_e5m2_vv_ops)
+DEF_RVV_FUNCTION (vfqwdota, zvdota, no_mu_preds,
+ zvfqwdota8f_e5m2_e4m3_vv_ops)
+DEF_RVV_FUNCTION (vfqwdota, zvdota, no_mu_preds,
+ zvfqwdota8f_e5m2_e5m2_vv_ops)
+
+#undef REQUIRED_EXTENSIONS
+#define REQUIRED_EXTENSIONS VECTOR_EXT
+
// 13.8. Vector Floating-Point Square-Root Instruction
DEF_RVV_FUNCTION (vfsqrt, alu, full_preds, f_v_ops)
diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
index
a474509fa3e7105726532d8f54e26bf4e57e94be..c7d70edd3537b1e3ebef17a4dc559a301e4fd331
100644
--- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc
+++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc
@@ -97,7 +97,8 @@ supports_vectype_p (const function_group_info &group,
unsigned int vec_type_idx)
|| *group.shape == shapes::fault_load
|| *group.shape == shapes::seg_loadstore
|| *group.shape == shapes::seg_indexed_loadstore
- || *group.shape == shapes::seg_fault_load)
+ || *group.shape == shapes::seg_fault_load
+ || *group.shape == shapes::zvdota)
return true;
return false;
}
@@ -424,6 +425,43 @@ struct alu_def : public build_base
}
};
+/* zvdota_def class. */
+struct zvdota_def : public build_base
+{
+ char *get_name (function_builder &b, const function_instance &instance,
+ bool overloaded_p) const override
+ {
+ /* Return nullptr if it can not be overloaded. */
+ if (overloaded_p && !instance.base->can_be_overloaded_p (instance.pred))
+ return nullptr;
+
+ b.append_base_name (instance.base_name);
+
+ if (!overloaded_p)
+ {
+ vector_type_index vs2_type_idx
+ = instance.op_info->args[1].get_function_type_index (
+ instance.type.index);
+ vector_type_index vs1_type_idx
+ = instance.op_info->args[2].get_function_type_index (
+ instance.type.index);
+ vector_type_index ret_type_idx
+ = instance.op_info->ret.get_function_type_index (
+ instance.type.index);
+
+ b.append_name (operand_suffixes[instance.op_info->op]);
+ b.append_name (type_suffixes[vs2_type_idx].vector);
+ b.append_name (type_suffixes[vs1_type_idx].vector);
+ b.append_name (type_suffixes[ret_type_idx].vector);
+ }
+
+ if (overloaded_p && instance.pred == PRED_TYPE_m)
+ return b.finish_name ();
+ b.append_name (predication_suffixes[instance.pred]);
+ return b.finish_name ();
+ }
+};
+
/* The base class for frm build. */
struct build_frm_base : public build_base
{
@@ -1427,6 +1465,7 @@ SHAPE(seg_fault_load, seg_fault_load)
SHAPE(crypto_vv, crypto_vv)
SHAPE(crypto_vi, crypto_vi)
SHAPE(crypto_vv_no_op_type, crypto_vv_no_op_type)
+SHAPE (zvdota, zvdota)
SHAPE (sf_vqmacc, sf_vqmacc)
SHAPE (sf_vfnrclip, sf_vfnrclip)
SHAPE(sf_vcix_se, sf_vcix_se)
diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.h
b/gcc/config/riscv/riscv-vector-builtins-shapes.h
index
d9502d4c5b409363c2ede2979cd6768518208c7c..db3c645fb37b3120a4f4643abdf79b59d95cd357
100644
--- a/gcc/config/riscv/riscv-vector-builtins-shapes.h
+++ b/gcc/config/riscv/riscv-vector-builtins-shapes.h
@@ -32,6 +32,7 @@ extern const function_shape *const th_loadstore_width;
extern const function_shape *const th_indexed_loadstore_width;
extern const function_shape *const alu;
extern const function_shape *const alu_frm;
+extern const function_shape *const zvdota;
extern const function_shape *const widen_alu;
extern const function_shape *const widen_alu_frm;
extern const function_shape *const no_mask_policy;
diff --git a/gcc/config/riscv/riscv-vector-builtins.cc
b/gcc/config/riscv/riscv-vector-builtins.cc
index
64e8127f1b5b4828ac986278f7ac200b170a4ea8..25ddf19da11f67753bf1f30a500b35526ea7b9d8
100644
--- a/gcc/config/riscv/riscv-vector-builtins.cc
+++ b/gcc/config/riscv/riscv-vector-builtins.cc
@@ -604,6 +604,74 @@ static const rvv_type_info hu_su_ops[] = {
#include "riscv-vector-builtins-types.def"
{NUM_VECTOR_TYPES, 0}};
+static const rvv_type_info zvqwdota8i_i_ops[] = {
+ {VECTOR_TYPE_vint8mf8_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vint8mf4_t, 0},
+ {VECTOR_TYPE_vint8mf2_t, 0},
+ {VECTOR_TYPE_vint8m1_t, 0},
+ {VECTOR_TYPE_vint8m2_t, 0},
+ {VECTOR_TYPE_vint8m4_t, 0},
+ {VECTOR_TYPE_vint8m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvqwdota8i_u_ops[] = {
+ {VECTOR_TYPE_vuint8mf8_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vuint8mf4_t, 0},
+ {VECTOR_TYPE_vuint8mf2_t, 0},
+ {VECTOR_TYPE_vuint8m1_t, 0},
+ {VECTOR_TYPE_vuint8m2_t, 0},
+ {VECTOR_TYPE_vuint8m4_t, 0},
+ {VECTOR_TYPE_vuint8m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvqwdota16i_i_ops[] = {
+ {VECTOR_TYPE_vint16mf4_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vint16mf2_t, 0},
+ {VECTOR_TYPE_vint16m1_t, 0},
+ {VECTOR_TYPE_vint16m2_t, 0},
+ {VECTOR_TYPE_vint16m4_t, 0},
+ {VECTOR_TYPE_vint16m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvqwdota16i_u_ops[] = {
+ {VECTOR_TYPE_vuint16mf4_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vuint16mf2_t, 0},
+ {VECTOR_TYPE_vuint16m1_t, 0},
+ {VECTOR_TYPE_vuint16m2_t, 0},
+ {VECTOR_TYPE_vuint16m4_t, 0},
+ {VECTOR_TYPE_vuint16m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvfwdota16bf_ops[] = {
+ {VECTOR_TYPE_vbfloat16mf4_t,
+ RVV_REQUIRE_ELEN_BF_16 | RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vbfloat16mf2_t, RVV_REQUIRE_ELEN_BF_16},
+ {VECTOR_TYPE_vbfloat16m1_t, RVV_REQUIRE_ELEN_BF_16},
+ {VECTOR_TYPE_vbfloat16m2_t, RVV_REQUIRE_ELEN_BF_16},
+ {VECTOR_TYPE_vbfloat16m4_t, RVV_REQUIRE_ELEN_BF_16},
+ {VECTOR_TYPE_vbfloat16m8_t, RVV_REQUIRE_ELEN_BF_16},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvfqwdota8f_e4m3_ops[] = {
+ {VECTOR_TYPE_vfloat8e4m3mf8_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vfloat8e4m3mf4_t, 0},
+ {VECTOR_TYPE_vfloat8e4m3mf2_t, 0},
+ {VECTOR_TYPE_vfloat8e4m3m1_t, 0},
+ {VECTOR_TYPE_vfloat8e4m3m2_t, 0},
+ {VECTOR_TYPE_vfloat8e4m3m4_t, 0},
+ {VECTOR_TYPE_vfloat8e4m3m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
+static const rvv_type_info zvfqwdota8f_e5m2_ops[] = {
+ {VECTOR_TYPE_vfloat8e5m2mf8_t, RVV_REQUIRE_ELEN_64},
+ {VECTOR_TYPE_vfloat8e5m2mf4_t, 0},
+ {VECTOR_TYPE_vfloat8e5m2mf2_t, 0},
+ {VECTOR_TYPE_vfloat8e5m2m1_t, 0},
+ {VECTOR_TYPE_vfloat8e5m2m2_t, 0},
+ {VECTOR_TYPE_vfloat8e5m2m4_t, 0},
+ {VECTOR_TYPE_vfloat8e5m2m8_t, 0},
+ {NUM_VECTOR_TYPES, 0}};
+
static constexpr const rvv_arg_type_info rvv_arg_type_info_end
= rvv_arg_type_info (NUM_BASE_TYPES);
@@ -703,6 +771,41 @@ static constexpr const rvv_arg_type_info vv_args[]
= {rvv_arg_type_info (RVV_BASE_vector), rvv_arg_type_info (RVV_BASE_vector),
rvv_arg_type_info_end};
+static constexpr const rvv_arg_type_info zvdota_ss_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_signed_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_su_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_unsigned_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_us_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_signed_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_uu_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_uacc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_unsigned_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_f_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_f32_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_fp8_e4m3_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_f32_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_fp8e4m3_vector), rvv_arg_type_info_end};
+
+static constexpr const rvv_arg_type_info zvdota_fp8_e5m2_args[]
+ = {rvv_arg_type_info (RVV_BASE_zvdota_f32_acc),
+ rvv_arg_type_info (RVV_BASE_vector),
+ rvv_arg_type_info (RVV_BASE_fp8e5m2_vector), rvv_arg_type_info_end};
+
/* A list of args for vector_type func (vector_type, vector_type, vector_type)
* function. */
static constexpr const rvv_arg_type_info vvv_args[]
@@ -1558,6 +1661,84 @@ static constexpr const rvv_op_info f_vvvv_ops
rvv_arg_type_info (RVV_BASE_vector), /* Return type */
vvv_args /* Args */};
+static constexpr const rvv_op_info zvqwdota8i_ss_vv_ops
+ = {zvqwdota8i_i_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_ss_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota8i_su_vv_ops
+ = {zvqwdota8i_i_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_su_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota8i_us_vv_ops
+ = {zvqwdota8i_u_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_us_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota8i_uu_vv_ops
+ = {zvqwdota8i_u_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_uacc), /* Return type. */
+ zvdota_uu_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota16i_ss_vv_ops
+ = {zvqwdota16i_i_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_ss_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota16i_su_vv_ops
+ = {zvqwdota16i_i_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_su_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota16i_us_vv_ops
+ = {zvqwdota16i_u_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_acc), /* Return type. */
+ zvdota_us_args /* Args. */};
+
+static constexpr const rvv_op_info zvqwdota16i_uu_vv_ops
+ = {zvqwdota16i_u_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_uacc), /* Return type. */
+ zvdota_uu_args /* Args. */};
+
+static constexpr const rvv_op_info zvfwdota16bf_vv_ops
+ = {zvfwdota16bf_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_f32_acc), /* Return type. */
+ zvdota_f_args /* Args. */};
+
+static constexpr const rvv_op_info zvfqwdota8f_e4m3_e4m3_vv_ops
+ = {zvfqwdota8f_e4m3_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_f32_acc), /* Return type. */
+ zvdota_fp8_e4m3_args /* Args. */};
+
+static constexpr const rvv_op_info zvfqwdota8f_e4m3_e5m2_vv_ops
+ = {zvfqwdota8f_e4m3_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_f32_acc), /* Return type. */
+ zvdota_fp8_e5m2_args /* Args. */};
+
+static constexpr const rvv_op_info zvfqwdota8f_e5m2_e4m3_vv_ops
+ = {zvfqwdota8f_e5m2_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_f32_acc), /* Return type. */
+ zvdota_fp8_e4m3_args /* Args. */};
+
+static constexpr const rvv_op_info zvfqwdota8f_e5m2_e5m2_vv_ops
+ = {zvfqwdota8f_e5m2_ops, /* Types. */
+ OP_TYPE_vv, /* Suffix. */
+ rvv_arg_type_info (RVV_BASE_zvdota_f32_acc), /* Return type. */
+ zvdota_fp8_e5m2_args /* Args. */};
+
/* A static operand information for vector_type func (vector_type, scalar_type,
* vector_type) function registration. */
static constexpr const rvv_op_info f_vvfv_ops
@@ -3526,7 +3707,8 @@ static constexpr const function_type_info
function_types[] = {
SIGNED_EEW64_LMUL1_INTERPRET, UNSIGNED_EEW8_LMUL1_INTERPRET,
\
UNSIGNED_EEW16_LMUL1_INTERPRET, UNSIGNED_EEW32_LMUL1_INTERPRET,
\
UNSIGNED_EEW64_LMUL1_INTERPRET, X2, X2_VLMUL_EXT, X4_VLMUL_EXT,
X8_VLMUL_EXT,\
- X16_VLMUL_EXT, X32_VLMUL_EXT, X64_VLMUL_EXT, TUPLE_SUBPART)
\
+ X16_VLMUL_EXT, X32_VLMUL_EXT, X64_VLMUL_EXT, ZVDOTA_ACC, ZVDOTA_UACC, \
+ ZVDOTA_F32_ACC, FP8E4M3, FP8E5M2, TUPLE_SUBPART) \
{
\
VECTOR_TYPE_##VECTOR,
\
VECTOR_TYPE_INVALID,
\
@@ -3598,7 +3780,12 @@ static constexpr const function_type_info
function_types[] = {
VECTOR_TYPE_##X16_VLMUL_EXT,
\
VECTOR_TYPE_##X32_VLMUL_EXT,
\
VECTOR_TYPE_##X64_VLMUL_EXT,
\
- VECTOR_TYPE_INVALID,
\
+ VECTOR_TYPE_##ZVDOTA_ACC, \
+ VECTOR_TYPE_##ZVDOTA_UACC, \
+ VECTOR_TYPE_##ZVDOTA_F32_ACC, \
+ VECTOR_TYPE_##FP8E4M3, \
+ VECTOR_TYPE_##FP8E5M2, \
+ VECTOR_TYPE_INVALID, \
VECTOR_TYPE_##TUPLE_SUBPART,
\
},
#include "riscv-vector-builtins.def"
@@ -3726,6 +3913,14 @@ get_builtin_partition (required_ext ext, const
function_instance &instance)
return RVV_PARTITION_ZVFOFP8MIN;
case ZVABD_EXT:
return RVV_PARTITION_ZVABD;
+ case ZVQWDOTA8I_EXT:
+ return RVV_PARTITION_ZVQWDOTA8I;
+ case ZVQWDOTA16I_EXT:
+ return RVV_PARTITION_ZVQWDOTA16I;
+ case ZVFWDOTA16BF_EXT:
+ return RVV_PARTITION_ZVFWDOTA16BF;
+ case ZVFQWDOTA8F_EXT:
+ return RVV_PARTITION_ZVFQWDOTA8F;
case XSFVQMACCQOQ_EXT:
return RVV_PARTITION_XSFVQMACCQOQ;
case XSFVQMACCDOD_EXT:
@@ -4070,6 +4265,8 @@ register_builtin_types_on_null ()
tree int16_type_node = get_typenode_from_name (INT16_TYPE);
tree int32_type_node = get_typenode_from_name (INT32_TYPE);
tree int64_type_node = get_typenode_from_name (INT64_TYPE);
+ tree float8e4m3_type_node = build_distinct_type_copy (uint8_type_node);
+ tree float8e5m2_type_node = build_distinct_type_copy (uint8_type_node);
machine_mode mode;
#define DEF_RVV_TYPE(NAME, NCHARS, ABI_NAME, SCALAR_TYPE, VECTOR_MODE,
\
@@ -5413,6 +5610,38 @@ registered_function_hasher::equal (value_type value,
const compare_type &key)
return value->instance == key;
}
+/* Return the ABI name of an FP8 vector type, including fixed-length variants.
+ The two FP8 formats share integer modes but are distinct overload types. */
+static const char *
+mangle_fp8_type (const_tree type)
+{
+ if (!VECTOR_TYPE_P (type))
+ return nullptr;
+
+ const char *name = mangle_builtin_type (type);
+ if (!name)
+ return nullptr;
+
+ for (vector_type_index index : {VECTOR_TYPE_vfloat8e4m3mf8_t,
+ VECTOR_TYPE_vfloat8e5m2mf8_t,
+ VECTOR_TYPE_vfloat8e4m3mf4_t,
+ VECTOR_TYPE_vfloat8e5m2mf4_t,
+ VECTOR_TYPE_vfloat8e4m3mf2_t,
+ VECTOR_TYPE_vfloat8e5m2mf2_t,
+ VECTOR_TYPE_vfloat8e4m3m1_t,
+ VECTOR_TYPE_vfloat8e5m2m1_t,
+ VECTOR_TYPE_vfloat8e4m3m2_t,
+ VECTOR_TYPE_vfloat8e5m2m2_t,
+ VECTOR_TYPE_vfloat8e4m3m4_t,
+ VECTOR_TYPE_vfloat8e5m2m4_t,
+ VECTOR_TYPE_vfloat8e4m3m8_t,
+ VECTOR_TYPE_vfloat8e5m2m8_t})
+ if (strcmp (name, vector_types[index].mangled_name) == 0)
+ return name;
+
+ return nullptr;
+}
+
hashval_t
registered_function::overloaded_hash () const
{
@@ -5437,6 +5666,8 @@ registered_function::overloaded_hash () const
{
h.add_int (unsigned_p);
h.add_int (mode_p);
+ if (const char *name = mangle_fp8_type (type))
+ h.add (name, strlen (name));
}
else if (instance.base->may_require_vxrm_p ()
|| instance.base->may_require_frm_p ())
diff --git a/gcc/config/riscv/riscv-vector-builtins.def
b/gcc/config/riscv/riscv-vector-builtins.def
index
e4e23ce32b24e0b8879fc5a60be7d75066bbb016..6ef1c9720594890b00d3580d743b30d0a6ff8110
100644
--- a/gcc/config/riscv/riscv-vector-builtins.def
+++ b/gcc/config/riscv/riscv-vector-builtins.def
@@ -83,7 +83,8 @@ along with GCC; see the file COPYING3. If not see
SIGNED_EEW64_LMUL1_INTERPRET, UNSIGNED_EEW8_LMUL1_INTERPRET,
\
UNSIGNED_EEW16_LMUL1_INTERPRET, UNSIGNED_EEW32_LMUL1_INTERPRET,
\
UNSIGNED_EEW64_LMUL1_INTERPRET, X2, X2_VLMUL_EXT, X4_VLMUL_EXT,
X8_VLMUL_EXT,\
- X16_VLMUL_EXT, X32_VLMUL_EXT, X64_VLMUL_EXT, TUPLE_SUBPART)
+ X16_VLMUL_EXT, X32_VLMUL_EXT, X64_VLMUL_EXT, ZVDOTA_ACC, ZVDOTA_UACC, \
+ ZVDOTA_F32_ACC, FP8E4M3, FP8E5M2, TUPLE_SUBPART)
#endif
/* Define RVV_VXRM rounding mode enum for fixed-point intrinsics. */
@@ -126,6 +127,10 @@ DEF_RVV_TYPE (vint8mf8_t, 15, __rvv_int8mf8_t, int8,
RVVMF8QI, _i8mf8, _i8,
_e8mf8)
DEF_RVV_TYPE (vuint8mf8_t, 16, __rvv_uint8mf8_t, uint8, RVVMF8QI, _u8mf8, _u8,
_e8mf8)
+DEF_RVV_TYPE (vfloat8e4m3mf8_t, 21, __rvv_float8e4m3mf8_t, float8e4m3,
+ RVVMF8QI, _f8e4m3mf8, _f8e4m3, _e8mf8)
+DEF_RVV_TYPE (vfloat8e5m2mf8_t, 21, __rvv_float8e5m2mf8_t, float8e5m2,
+ RVVMF8QI, _f8e5m2mf8, _f8e5m2, _e8mf8)
/* Define tuple types for SEW = 8, LMUL = MF8. */
DEF_RVV_TUPLE_TYPE (vint8mf8x2_t, 17, __rvv_int8mf8x2_t, vint8mf8_t, int8, 2,
_i8mf8x2)
DEF_RVV_TUPLE_TYPE (vuint8mf8x2_t, 18, __rvv_uint8mf8x2_t, vuint8mf8_t, uint8,
2, _u8mf8x2)
@@ -147,6 +152,10 @@ DEF_RVV_TYPE (vint8mf4_t, 15, __rvv_int8mf4_t, int8,
RVVMF4QI, _i8mf4, _i8,
_e8mf4)
DEF_RVV_TYPE (vuint8mf4_t, 16, __rvv_uint8mf4_t, uint8, RVVMF4QI, _u8mf4, _u8,
_e8mf4)
+DEF_RVV_TYPE (vfloat8e4m3mf4_t, 21, __rvv_float8e4m3mf4_t, float8e4m3,
+ RVVMF4QI, _f8e4m3mf4, _f8e4m3, _e8mf4)
+DEF_RVV_TYPE (vfloat8e5m2mf4_t, 21, __rvv_float8e5m2mf4_t, float8e5m2,
+ RVVMF4QI, _f8e5m2mf4, _f8e5m2, _e8mf4)
/* Define tuple types for SEW = 8, LMUL = MF4. */
DEF_RVV_TUPLE_TYPE (vint8mf4x2_t, 17, __rvv_int8mf4x2_t, vint8mf4_t, int8, 2,
_i8mf4x2)
DEF_RVV_TUPLE_TYPE (vuint8mf4x2_t, 18, __rvv_uint8mf4x2_t, vuint8mf4_t, uint8,
2, _u8mf4x2)
@@ -168,6 +177,10 @@ DEF_RVV_TYPE (vint8mf2_t, 15, __rvv_int8mf2_t, int8,
RVVMF2QI, _i8mf2, _i8,
_e8mf2)
DEF_RVV_TYPE (vuint8mf2_t, 16, __rvv_uint8mf2_t, uint8, RVVMF2QI, _u8mf2, _u8,
_e8mf2)
+DEF_RVV_TYPE (vfloat8e4m3mf2_t, 21, __rvv_float8e4m3mf2_t, float8e4m3,
+ RVVMF2QI, _f8e4m3mf2, _f8e4m3, _e8mf2)
+DEF_RVV_TYPE (vfloat8e5m2mf2_t, 21, __rvv_float8e5m2mf2_t, float8e5m2,
+ RVVMF2QI, _f8e5m2mf2, _f8e5m2, _e8mf2)
/* Define tuple types for SEW = 8, LMUL = MF2. */
DEF_RVV_TUPLE_TYPE (vint8mf2x2_t, 17, __rvv_int8mf2x2_t, vint8mf2_t, int8, 2,
_i8mf2x2)
DEF_RVV_TUPLE_TYPE (vuint8mf2x2_t, 18, __rvv_uint8mf2x2_t, vuint8mf2_t, uint8,
2, _u8mf2x2)
@@ -188,6 +201,10 @@ DEF_RVV_TUPLE_TYPE (vuint8mf2x8_t, 18, __rvv_uint8mf2x8_t,
vuint8mf2_t, uint8, 8
DEF_RVV_TYPE (vint8m1_t, 14, __rvv_int8m1_t, int8, RVVM1QI, _i8m1, _i8, _e8m1)
DEF_RVV_TYPE (vuint8m1_t, 15, __rvv_uint8m1_t, uint8, RVVM1QI, _u8m1, _u8,
_e8m1)
+DEF_RVV_TYPE (vfloat8e4m3m1_t, 20, __rvv_float8e4m3m1_t, float8e4m3,
+ RVVM1QI, _f8e4m3m1, _f8e4m3, _e8m1)
+DEF_RVV_TYPE (vfloat8e5m2m1_t, 20, __rvv_float8e5m2m1_t, float8e5m2,
+ RVVM1QI, _f8e5m2m1, _f8e5m2, _e8m1)
/* Define tuple types for SEW = 8, LMUL = M1. */
DEF_RVV_TUPLE_TYPE (vint8m1x2_t, 16, __rvv_int8m1x2_t, vint8m1_t, int8, 2,
_i8m1x2)
DEF_RVV_TUPLE_TYPE (vuint8m1x2_t, 17, __rvv_uint8m1x2_t, vuint8m1_t, uint8, 2,
_u8m1x2)
@@ -208,6 +225,10 @@ DEF_RVV_TUPLE_TYPE (vuint8m1x8_t, 17, __rvv_uint8m1x8_t,
vuint8m1_t, uint8, 8, _
DEF_RVV_TYPE (vint8m2_t, 14, __rvv_int8m2_t, int8, RVVM2QI, _i8m2, _i8, _e8m2)
DEF_RVV_TYPE (vuint8m2_t, 15, __rvv_uint8m2_t, uint8, RVVM2QI, _u8m2, _u8,
_e8m2)
+DEF_RVV_TYPE (vfloat8e4m3m2_t, 20, __rvv_float8e4m3m2_t, float8e4m3,
+ RVVM2QI, _f8e4m3m2, _f8e4m3, _e8m2)
+DEF_RVV_TYPE (vfloat8e5m2m2_t, 20, __rvv_float8e5m2m2_t, float8e5m2,
+ RVVM2QI, _f8e5m2m2, _f8e5m2, _e8m2)
/* Define tuple types for SEW = 8, LMUL = M2. */
DEF_RVV_TUPLE_TYPE (vint8m2x2_t, 16, __rvv_int8m2x2_t, vint8m2_t, int8, 2,
_i8m2x2)
DEF_RVV_TUPLE_TYPE (vuint8m2x2_t, 17, __rvv_uint8m2x2_t, vuint8m2_t, uint8, 2,
_u8m2x2)
@@ -220,6 +241,10 @@ DEF_RVV_TUPLE_TYPE (vuint8m2x4_t, 17, __rvv_uint8m2x4_t,
vuint8m2_t, uint8, 4, _
DEF_RVV_TYPE (vint8m4_t, 14, __rvv_int8m4_t, int8, RVVM4QI, _i8m4, _i8, _e8m4)
DEF_RVV_TYPE (vuint8m4_t, 15, __rvv_uint8m4_t, uint8, RVVM4QI, _u8m4, _u8,
_e8m4)
+DEF_RVV_TYPE (vfloat8e4m3m4_t, 20, __rvv_float8e4m3m4_t, float8e4m3,
+ RVVM4QI, _f8e4m3m4, _f8e4m3, _e8m4)
+DEF_RVV_TYPE (vfloat8e5m2m4_t, 20, __rvv_float8e5m2m4_t, float8e5m2,
+ RVVM4QI, _f8e5m2m4, _f8e5m2, _e8m4)
/* Define tuple types for SEW = 8, LMUL = M4. */
DEF_RVV_TUPLE_TYPE (vint8m4x2_t, 16, __rvv_int8m4x2_t, vint8m4_t, int8, 2,
_i8m4x2)
DEF_RVV_TUPLE_TYPE (vuint8m4x2_t, 17, __rvv_uint8m4x2_t, vuint8m4_t, uint8, 2,
_u8m4x2)
@@ -228,6 +253,10 @@ DEF_RVV_TUPLE_TYPE (vuint8m4x2_t, 17, __rvv_uint8m4x2_t,
vuint8m4_t, uint8, 2, _
DEF_RVV_TYPE (vint8m8_t, 14, __rvv_int8m8_t, int8, RVVM8QI, _i8m8, _i8, _e8m8)
DEF_RVV_TYPE (vuint8m8_t, 15, __rvv_uint8m8_t, uint8, RVVM8QI, _u8m8, _u8,
_e8m8)
+DEF_RVV_TYPE (vfloat8e4m3m8_t, 20, __rvv_float8e4m3m8_t, float8e4m3,
+ RVVM8QI, _f8e4m3m8, _f8e4m3, _e8m8)
+DEF_RVV_TYPE (vfloat8e5m2m8_t, 20, __rvv_float8e5m2m8_t, float8e5m2,
+ RVVM8QI, _f8e5m2m8, _f8e5m2, _e8m8)
/* LMUL = 1/4:
Only enable when TARGET_MIN_VLEN > 32.
@@ -755,6 +784,11 @@ DEF_RVV_BASE_TYPE (vlmul_ext_x8, get_vector_type
(type_idx))
DEF_RVV_BASE_TYPE (vlmul_ext_x16, get_vector_type (type_idx))
DEF_RVV_BASE_TYPE (vlmul_ext_x32, get_vector_type (type_idx))
DEF_RVV_BASE_TYPE (vlmul_ext_x64, get_vector_type (type_idx))
+DEF_RVV_BASE_TYPE (zvdota_acc, get_vector_type (type_idx))
+DEF_RVV_BASE_TYPE (zvdota_uacc, get_vector_type (type_idx))
+DEF_RVV_BASE_TYPE (zvdota_f32_acc, get_vector_type (type_idx))
+DEF_RVV_BASE_TYPE (fp8e4m3_vector, get_vector_type (type_idx))
+DEF_RVV_BASE_TYPE (fp8e5m2_vector, get_vector_type (type_idx))
DEF_RVV_BASE_TYPE (size_ptr, build_pointer_type (size_type_node))
DEF_RVV_BASE_TYPE (tuple_subpart, get_tuple_subpart_type (type_idx))
DEF_RVV_BASE_TYPE (xfqf_float, get_xfqf_float_type (type_idx))
diff --git a/gcc/config/riscv/riscv-vector-builtins.h
b/gcc/config/riscv/riscv-vector-builtins.h
index
8e5cba1e1b629af9b61c2b5b9cb3b2873a67b2da..8773ca4af05086d9c7f45e198a3e2831ea8c4efd
100644
--- a/gcc/config/riscv/riscv-vector-builtins.h
+++ b/gcc/config/riscv/riscv-vector-builtins.h
@@ -132,6 +132,10 @@ enum required_ext
ZVFBFWMA_EXT, /* Zvfbfwma extension */
ZVFOFP8MIN_EXT, /* Zvfofp8min extension */
ZVABD_EXT, /* Zvabd extension */
+ ZVQWDOTA8I_EXT, /* Zvqwdota8i extension. */
+ ZVQWDOTA16I_EXT, /* Zvqwdota16i extension. */
+ ZVFWDOTA16BF_EXT, /* Zvfwdota16bf extension. */
+ ZVFQWDOTA8F_EXT, /* Zvfqwdota8f extension. */
XSFVQMACCQOQ_EXT, /* XSFVQMACCQOQ extension */
XSFVQMACCDOD_EXT, /* XSFVQMACCDOD extension */
XSFVFNRCLIPXFQF_EXT, /* XSFVFNRCLIPXFQF extension */
@@ -164,6 +168,10 @@ enum rvv_builtin_partition
RVV_PARTITION_ZVFH,
RVV_PARTITION_ZVFOFP8MIN,
RVV_PARTITION_ZVABD,
+ RVV_PARTITION_ZVQWDOTA8I,
+ RVV_PARTITION_ZVQWDOTA16I,
+ RVV_PARTITION_ZVFWDOTA16BF,
+ RVV_PARTITION_ZVFQWDOTA8F,
RVV_PARTITION_XSFVQMACCQOQ,
RVV_PARTITION_XSFVQMACCDOD,
RVV_PARTITION_XSFVFNRCLIPXFQF,
@@ -220,6 +228,14 @@ static inline const char * required_ext_to_isa_name (enum
required_ext required)
return "zvfofp8min";
case ZVABD_EXT:
return "zvabd";
+ case ZVQWDOTA8I_EXT:
+ return "zvqwdota8i";
+ case ZVQWDOTA16I_EXT:
+ return "zvqwdota16i";
+ case ZVFWDOTA16BF_EXT:
+ return "zvfwdota16bf";
+ case ZVFQWDOTA8F_EXT:
+ return "zvfqwdota8f";
case XSFVQMACCQOQ_EXT:
return "xsfvqmaccqoq";
case XSFVQMACCDOD_EXT:
@@ -279,6 +295,14 @@ static inline bool required_extensions_specified (enum
required_ext required)
return TARGET_ZVFOFP8MIN;
case ZVABD_EXT:
return TARGET_ZVABD;
+ case ZVQWDOTA8I_EXT:
+ return TARGET_ZVQWDOTA8I;
+ case ZVQWDOTA16I_EXT:
+ return TARGET_ZVQWDOTA16I;
+ case ZVFWDOTA16BF_EXT:
+ return TARGET_ZVFWDOTA16BF;
+ case ZVFQWDOTA8F_EXT:
+ return TARGET_ZVFQWDOTA8F;
case XSFVQMACCQOQ_EXT:
return TARGET_XSFVQMACCQOQ;
case XSFVQMACCDOD_EXT:
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index
cc96cc0ad8bfde50ead2e8d446e2c3aa803a454b..f7abbafda50f337227e2c1b6ea7cc1c40989bd57
100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -7974,7 +7974,7 @@ riscv_vector_element_bitsize (const_tree type)
if (strstr (name, "bool") != NULL)
return 1;
- else if (strstr (name, "int8") != NULL)
+ else if (strstr (name, "int8") != NULL || strstr (name, "float8") != NULL)
return 8;
else if (strstr (name, "int16") != NULL || strstr (name, "float16") != NULL)
return 16;
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-altfmt-chain.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-altfmt-chain.c
new file mode 100644
index
0000000000000000000000000000000000000000..f522bafe05f554b0200c9edafbdada4b29ff8224
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-altfmt-chain.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvqwdota8i -mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+vint32m1_t
+test_altfmt_chain (vbool8_t mask, vint32m1_t acc, vint8m1_t a,
+ vint8m1_t b, vuint8m1_t c, size_t vl)
+{
+ acc = __riscv_vqwdota_vv_i8m1_i8m1_i32m1_m (mask, acc, a, b, vl);
+ acc = __riscv_vqwdota_vv_i8m1_u8m1_i32m1_m (mask, acc, a, c, vl);
+ return __riscv_vqwdota_vv_i8m1_i8m1_i32m1_m (mask, acc, a, b, vl);
+}
+
+/* { dg-final { scan-assembler-times {vqwdotas\.vv} 3 } } */
+/* { dg-final { scan-assembler-times {e8alt,\s*m1,} 2 } } */
+/* { dg-final { scan-assembler-times {e8,\s*m1,} 1 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-bf16-elen-fail.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-bf16-elen-fail.c
new file mode 100644
index
0000000000000000000000000000000000000000..29ee372d42dd7a0effcf421fda26928e28b646df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-bf16-elen-fail.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zve32f_zvl64b_zvfwdota16bf_zvfbfmin -mabi=lp64d
-O2" } */
+
+#include "riscv_vector.h"
+
+vfloat32m1_t
+test_bf16mf4 (vfloat32m1_t acc, vbfloat16mf4_t a, size_t vl)
+{
+ return __riscv_vfwdota_vv_bf16mf4_bf16mf4_f32m1 (acc, a, a, vl); /* {
dg-error {requires.*zve64x} } */
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-elen-dependency.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-elen-dependency.c
new file mode 100644
index
0000000000000000000000000000000000000000..4b0cb5e9eb783eef1490707411b64aa4cd4d3a15
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-elen-dependency.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64im_zvqwdota16i -mabi=lp64 -O2" } */
+
+#include "riscv_vector.h"
+
+/* Zvqwdota16i implies Zve64x, including fractional e16,mf4 support. */
+#ifndef __riscv_zve64x
+#error "Zvqwdota16i must imply Zve64x"
+#endif
+
+vint64m1_t
+test_i16mf4 (vint64m1_t acc, vint16mf4_t a, vint16mf4_t b, size_t vl)
+{
+ return __riscv_vqwdota_vv_i16mf4_i16mf4_i64m1 (acc, a, b, vl);
+}
+
+/* { dg-final { scan-assembler {vqwdotas\.vv} } } */
+/* { dg-final { scan-assembler {e16alt,\s*mf4,} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-mode-fail.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-mode-fail.c
new file mode 100644
index
0000000000000000000000000000000000000000..2fee543a9c68fbf4e7caed671482c9c5c0a86239
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-mode-fail.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zve32f_zvfqwdota8f -mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+/* The disabled mf8 modes must produce ABI diagnostics instead of an ICE. */
+void
+arg_e4 (vfloat8e4m3mf8_t x) /* { dg-error {argument
type[^\n]*64[^\n]*but[^\n]*32} } */
+{
+}
+
+void
+arg_e5 (vfloat8e5m2mf8_t x) /* { dg-error {argument
type[^\n]*64[^\n]*but[^\n]*32} } */
+{
+}
+
+vfloat8e4m3mf8_t
+ret_e4 (const vfloat8e4m3mf8_t *x) /* { dg-error {return
type[^\n]*64[^\n]*but[^\n]*32} } */
+{
+ return *x;
+}
+
+vfloat8e5m2mf8_t
+ret_e5 (const vfloat8e5m2mf8_t *x) /* { dg-error {return
type[^\n]*64[^\n]*but[^\n]*32} } */
+{
+ return *x;
+}
diff --git
a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded-fixed.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded-fixed.c
new file mode 100644
index
0000000000000000000000000000000000000000..2d53cb06b3bb0b25a8ab04a5768afba386dacd9c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded-fixed.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfqwdota8f_zvl128b -mabi=lp64d
-mrvv-vector-bits=zvl -O2" } */
+
+#define FIXED_RVV
+#include "zvdota-fp8-overloaded.c"
+
+/* { dg-final { scan-assembler-times {vfqwdota\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {vfqwdota\.alt\.vv} 2 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded.c
new file mode 100644
index
0000000000000000000000000000000000000000..e0ed80150397d6f43d952480ea19451b869660ad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-fp8-overloaded.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfqwdota8f -mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+#ifdef FIXED_RVV
+typedef vfloat8e4m3m1_t fp8e4_t
+ __attribute__ ((riscv_rvv_vector_bits (128)));
+typedef vfloat8e5m2m1_t fp8e5_t
+ __attribute__ ((riscv_rvv_vector_bits (128)));
+#else
+typedef vfloat8e4m3m1_t fp8e4_t;
+typedef vfloat8e5m2m1_t fp8e5_t;
+#endif
+
+/* Load complete vector objects containing pre-encoded FP8 data. The four
+ format combinations must resolve to distinct overloaded intrinsics. */
+#define TEST(NAME, TYPE2, TYPE1) \
+ void NAME (float *acc, const TYPE2 *a, const TYPE1 *b, size_t vl) \
+ { \
+ vfloat32m1_t vd = __riscv_vle32_v_f32m1 (acc, 1); \
+ vd = __riscv_vfqwdota (vd, *a, *b, vl); \
+ __riscv_vse32_v_f32m1 (acc, vd, 1); \
+ }
+
+TEST (test_e4_e4, fp8e4_t, fp8e4_t)
+TEST (test_e4_e5, fp8e4_t, fp8e5_t)
+TEST (test_e5_e4, fp8e5_t, fp8e4_t)
+TEST (test_e5_e5, fp8e5_t, fp8e5_t)
+
+/* { dg-final { scan-assembler-times {vfqwdota\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {vfqwdota\.alt\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {e8alt,\s*m1,} 2 } } */
+/* { dg-final { scan-assembler {vl1re8\.v} } } */
+/* { dg-final { scan-assembler-times {vse32\.v} 4 } } */
diff --git
a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-i16-require-extension.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-i16-require-extension.c
new file mode 100644
index
0000000000000000000000000000000000000000..28932a127ac4eed7bf8e4f31571e174df67fe10e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-i16-require-extension.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64im_zve32x -mabi=lp64 -O2" } */
+
+#include "riscv_vector.h"
+
+void
+test_i16 (vint64m1_t *acc, vint16m1_t a, size_t vl)
+{
+ *acc = __riscv_vqwdota_vv_i16m1_i16m1_i64m1 (*acc, a, a, vl); /* { dg-error
{requires.*zvqwdota16i} } */
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-intrinsic.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-intrinsic.c
new file mode 100644
index
0000000000000000000000000000000000000000..0f8c753475502e6ff957d881abba36998d46fb62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-intrinsic.c
@@ -0,0 +1,106 @@
+/* { dg-do compile } */
+/* { dg-options
"-march=rv64gcv_zvqwdota8i_zvqwdota16i_zvfwdota16bf_zvfqwdota8f_zvfbfmin
-mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+vuint32m1_t
+test_vqwdota_uu_8 (vuint32m1_t vd, vuint8mf4_t vs2,
+ vuint8mf4_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_u8mf4_u8mf4_u32m1 (vd, vs2, vs1, vl);
+}
+
+vint32m1_t
+test_vqwdota_us_8 (vint32m1_t vd, vuint8mf4_t vs2,
+ vint8mf4_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_u8mf4_i8mf4_i32m1 (vd, vs2, vs1, vl);
+}
+
+vint32m1_t
+test_vqwdota_su_8 (vint32m1_t vd, vint8mf4_t vs2,
+ vuint8mf4_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_i8mf4_u8mf4_i32m1 (vd, vs2, vs1, vl);
+}
+
+vint32m1_t
+test_vqwdota_ss_8 (vint32m1_t vd, vint8mf4_t vs2,
+ vint8mf4_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_i8mf4_i8mf4_i32m1 (vd, vs2, vs1, vl);
+}
+
+vuint64m1_t
+test_vqwdota_uu_16 (vuint64m1_t vd, vuint16mf2_t vs2,
+ vuint16mf2_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_u16mf2_u16mf2_u64m1 (vd, vs2, vs1, vl);
+}
+
+vint64m1_t
+test_vqwdota_us_16 (vint64m1_t vd, vuint16mf2_t vs2,
+ vint16mf2_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_u16mf2_i16mf2_i64m1 (vd, vs2, vs1, vl);
+}
+
+vint64m1_t
+test_vqwdota_su_16 (vint64m1_t vd, vint16mf2_t vs2,
+ vuint16mf2_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_i16mf2_u16mf2_i64m1 (vd, vs2, vs1, vl);
+}
+
+vint64m1_t
+test_vqwdota_ss_16 (vint64m1_t vd, vint16mf2_t vs2,
+ vint16mf2_t vs1, size_t vl)
+{
+ return __riscv_vqwdota_vv_i16mf2_i16mf2_i64m1 (vd, vs2, vs1, vl);
+}
+
+vfloat32m1_t
+test_vfqwdota_e4m3_e4m3 (vfloat32m1_t vd, vfloat8e4m3mf4_t vs2,
+ vfloat8e4m3mf4_t vs1, size_t vl)
+{
+ return __riscv_vfqwdota_vv_f8e4m3mf4_f8e4m3mf4_f32m1 (vd, vs2, vs1, vl);
+}
+
+vfloat32m1_t
+test_vfqwdota_e4m3_e5m2 (vfloat32m1_t vd, vfloat8e4m3mf4_t vs2,
+ vfloat8e5m2mf4_t vs1, size_t vl)
+{
+ return __riscv_vfqwdota_vv_f8e4m3mf4_f8e5m2mf4_f32m1 (vd, vs2, vs1, vl);
+}
+
+vfloat32m1_t
+test_vfqwdota_e5m2_e4m3 (vfloat32m1_t vd, vfloat8e5m2mf4_t vs2,
+ vfloat8e4m3mf4_t vs1, size_t vl)
+{
+ return __riscv_vfqwdota_vv_f8e5m2mf4_f8e4m3mf4_f32m1 (vd, vs2, vs1, vl);
+}
+
+vfloat32m1_t
+test_vfqwdota_e5m2_e5m2 (vfloat32m1_t vd, vfloat8e5m2mf4_t vs2,
+ vfloat8e5m2mf4_t vs1, size_t vl)
+{
+ return __riscv_vfqwdota_vv_f8e5m2mf4_f8e5m2mf4_f32m1 (vd, vs2, vs1, vl);
+}
+
+vfloat32m1_t
+test_vfwdota_bf16 (vfloat32m1_t vd, vbfloat16mf2_t vs2,
+ vbfloat16mf2_t vs1, size_t vl)
+{
+ return __riscv_vfwdota_vv_bf16mf2_bf16mf2_f32m1 (vd, vs2, vs1, vl);
+}
+
+/* { dg-final { scan-assembler-times {vqwdotau\.vv} 4 } } */
+/* { dg-final { scan-assembler-times {vqwdotas\.vv} 4 } } */
+/* { dg-final { scan-assembler-times {vfqwdota\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {vfqwdota\.alt\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {vfwdota\.vv} 1 } } */
+
+/* { dg-final { scan-assembler-times
{vsetvli\s+zero,\s*[a-z0-9]+,\s*e8,\s*mf4,\s*ta,\s*ma} 4 } } */
+/* { dg-final { scan-assembler-times
{vsetvli\s+zero,\s*[a-z0-9]+,\s*e8alt,\s*mf4,\s*ta,\s*ma} 4 } } */
+/* { dg-final { scan-assembler-times
{vsetvli\s+zero,\s*[a-z0-9]+,\s*e16,\s*mf2,\s*ta,\s*ma} 2 } } */
+/* { dg-final { scan-assembler-times
{vsetvli\s+zero,\s*[a-z0-9]+,\s*e16alt,\s*mf2,\s*ta,\s*ma} 3 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-lmul.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-lmul.c
new file mode 100644
index
0000000000000000000000000000000000000000..53b7ed6657af866fefd429bb496d2edefdea17c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-lmul.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvqwdota8i_zvqwdota16i -mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+/* The accumulator remains LMUL=1 even for the largest source groups. */
+vint32m1_t
+test_i8m8 (vint32m1_t acc, vint8m8_t a, vint8m8_t b, size_t vl)
+{
+ return __riscv_vqwdota_vv_i8m8_i8m8_i32m1 (acc, a, b, vl);
+}
+
+vint64m1_t
+test_i16m4 (vint64m1_t acc, vint16m4_t a, vint16m4_t b, size_t vl)
+{
+ return __riscv_vqwdota_vv_i16m4_i16m4_i64m1 (acc, a, b, vl);
+}
+
+/* { dg-final { scan-assembler-times {vqwdotas\.vv} 2 } } */
+/* { dg-final { scan-assembler {e8alt,\s*m8,} } } */
+/* { dg-final { scan-assembler {e16alt,\s*m4,} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-no-rm-fail.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-no-rm-fail.c
new file mode 100644
index
0000000000000000000000000000000000000000..86d834fa75425eab5cfb139db9cd4f6a2a692c80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-no-rm-fail.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfwdota16bf_zvfqwdota8f_zvfbfmin -mabi=lp64d
-O2 -Werror=implicit-function-declaration" } */
+
+#include "riscv_vector.h"
+
+void
+test_vfwdota_rm (vfloat32m1_t vd, vbfloat16mf2_t vs2,
+ vbfloat16mf2_t vs1, size_t vl)
+{
+ (void) __riscv_vfwdota_vv_bf16mf2_bf16mf2_f32m1_rm (vd, vs2, vs1,
__RISCV_FRM_RNE, vl); /* { dg-error "implicit declaration of function" } */
+}
+
+void
+test_vfqwdota_rm (vfloat32m1_t vd, vfloat8e4m3mf4_t vs2,
+ vfloat8e4m3mf4_t vs1, size_t vl)
+{
+ (void) __riscv_vfqwdota_vv_f8e4m3mf4_f8e4m3mf4_f32m1_rm (vd, vs2, vs1,
__RISCV_FRM_RNE, vl); /* { dg-error "implicit declaration of function" } */
+}
+
+void
+test_vfqwdota_e5m2_rm (vfloat32m1_t vd, vfloat8e5m2mf4_t vs2,
+ vfloat8e4m3mf4_t vs1, size_t vl)
+{
+ (void) __riscv_vfqwdota_vv_f8e5m2mf4_f8e4m3mf4_f32m1_rm (vd, vs2, vs1,
__RISCV_FRM_RNE, vl); /* { dg-error "implicit declaration of function" } */
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-require-extension.c
b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-require-extension.c
new file mode 100644
index
0000000000000000000000000000000000000000..86019a753c7480f0ac1c4a22cc8a730e064d462b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvdota-require-extension.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O2" } */
+
+#include "riscv_vector.h"
+
+vint32m1_t
+test_i8 (vint32m1_t acc, vint8m1_t a, size_t vl)
+{
+ return __riscv_vqwdota_vv_i8m1_i8m1_i32m1 (acc, a, a, vl); /* { dg-error
{requires.*zvqwdota8i} } */
+}
--
2.43.0