Add reduction-style dot-product patterns with static altfmt requirements
and earlyclobber constraints. Keep integer extension guards in iterators.
Use dot-product types for shared VL/policy attributes and scheduling.
Exclude these types from AVL propagation because VL counts reduction
terms rather than accumulator elements.
gcc/ChangeLog:
* config/riscv/generic-vector-ooo.md (vec_imul, vec_fmul): Handle
dot-product types.
* config/riscv/andes-23-series.md (andes_23_unknown): Likewise.
* config/riscv/andes-25-series.md (andes_25_vector_unknown): Likewise.
* config/riscv/andes-45-series.md (andes_45_vector_unknown): Likewise.
* config/riscv/arcv-rhx100.md (arcv_rhx100_unknown): Likewise.
* config/riscv/arcv-rmx100.md (arcv_rmx100_unknown): Likewise.
* config/riscv/mips-p8700.md (mips_p8700_unknown): Likewise.
* config/riscv/sifive-7.md (sifive_7_vec_unknown): Likewise.
* config/riscv/sifive-p400.md (sifive_p400_unknown): Likewise.
* config/riscv/sifive-p600.md (sifive_p600_unknown): Likewise.
* config/riscv/spacemit-x60.md (spacemit_x60_dummy): Likewise.
* config/riscv/tt-ascalon-d8.md (tt_ascalon_d8_vec_unknown): Likewise.
* config/riscv/xiangshan.md (xiangshan_alu_unknown): Likewise.
* config/riscv/xt-c908.md (xt_c908_dummy): Likewise.
* config/riscv/predicates.md (zvbdota_ci_operand): New predicate.
* config/riscv/riscv-avlprop.cc (avl_can_be_propagated_p): Exclude
dot-product types.
* config/riscv/riscv-protos.h (altfmt_type): Extend comment.
* config/riscv/riscv.md (type, fp_vector_disabled): Add dot-product
types. Include vector-dot.md.
* config/riscv/vector.md (has_vtype_op, has_vl_op, ratio,
merge_op_idx, mode_idx, vl_op_idx, ta, ma, avl_type_idx): Handle
dot-product types.
* config/riscv/vector-dot.md: New file.
* config/riscv/vector-iterators.md: Add dot-product UNSPECs,
mode mappings and extension-specific iterators.
(V_EXT_LMUL1): Add BF16 modes.
---
gcc/config/riscv/andes-23-series.md | 3 +-
gcc/config/riscv/andes-25-series.md | 3 +-
gcc/config/riscv/andes-45-series.md | 3 +-
gcc/config/riscv/arcv-rhx100.md | 3 +-
gcc/config/riscv/arcv-rmx100.md | 3 +-
gcc/config/riscv/generic-vector-ooo.md | 5 +-
gcc/config/riscv/mips-p8700.md | 3 +-
gcc/config/riscv/predicates.md | 5 +
gcc/config/riscv/riscv-avlprop.cc | 12 +-
gcc/config/riscv/riscv-protos.h | 8 +-
gcc/config/riscv/riscv.md | 10 +-
gcc/config/riscv/sifive-7.md | 3 +-
gcc/config/riscv/sifive-p400.md | 24 ++-
gcc/config/riscv/sifive-p600.md | 24 ++-
gcc/config/riscv/spacemit-x60.md | 3 +-
gcc/config/riscv/tt-ascalon-d8.md | 3 +-
gcc/config/riscv/vector-dot.md | 202 +++++++++++++++++++++++++
gcc/config/riscv/vector-iterators.md | 191 +++++++++++++++++++++++
gcc/config/riscv/vector.md | 46 ++++--
gcc/config/riscv/xiangshan.md | 25 ++-
gcc/config/riscv/xt-c908.md | 3 +-
21 files changed, 545 insertions(+), 37 deletions(-)
create mode 100644 gcc/config/riscv/vector-dot.md
diff --git a/gcc/config/riscv/andes-23-series.md
b/gcc/config/riscv/andes-23-series.md
index
e2da00140aa68ae9aa1d8965cf12bd3394b62469..cb0f8e8b5ab58e43532a8e0d81cea2b4ceb116cf
100644
--- a/gcc/config/riscv/andes-23-series.md
+++ b/gcc/config/riscv/andes-23-series.md
@@ -186,5 +186,6 @@
vfslide1up,vfncvtftof,vsetvl,viwmuladd,vfredu,vfwredu,
vlsegde,vmiota,vstr,vgather,vssegts,vldux,vlsegds,vimul,
vste,vsetvl_pre,vimuladd,vcompress,vssegtux,wrfrm,rdfrm,
- vired"))
+ vired,
+ vidota,vfdota,vibdota,vfbdota"))
"andes_23_dummies")
diff --git a/gcc/config/riscv/andes-25-series.md
b/gcc/config/riscv/andes-25-series.md
index
28ed1ded6ff1e9b35140b4703957775818779fbb..0bf4da240d4f0365850bdc150f38bbd4699dffc3
100644
--- a/gcc/config/riscv/andes-25-series.md
+++ b/gcc/config/riscv/andes-25-series.md
@@ -318,5 +318,6 @@
vaeskf1,vandn,vaesdm,vclmul,vclmulh,vrol,vcpop,vbrev8,
vsm3me,vbrev,vctz,vgmul,vsha2ms,vaesz,vrev8,
vaeskf2,vsha2cl,vwsll,vaesdf,vaesem,vfwmaccbf16,
- sf_vqmacc,sf_vc,sf_vc_se,sf_vfnrclip"))
+ sf_vqmacc,sf_vc,sf_vc_se,sf_vfnrclip,
+ vidota,vfdota,vibdota,vfbdota"))
"andes_25_vector_dummies")
diff --git a/gcc/config/riscv/andes-45-series.md
b/gcc/config/riscv/andes-45-series.md
index
b379389e9b12d72d56dcc8a63411f361dea3554f..930cbdc9166d741ffe8775eccc20e034e82d9205
100644
--- a/gcc/config/riscv/andes-45-series.md
+++ b/gcc/config/riscv/andes-45-series.md
@@ -375,5 +375,6 @@
vaeskf1,vandn,vaesdm,vclmul,vclmulh,vrol,vcpop,vbrev8,
vsm3me,vbrev,vctz,vgmul,vsha2ms,vaesz,vrev8,
vaeskf2,vsha2cl,vwsll,vaesdf,vaesem,vfwmaccbf16,
- sf_vqmacc,sf_vc,sf_vc_se,sf_vfnrclip,vlsegde"))
+ sf_vqmacc,sf_vc,sf_vc_se,sf_vfnrclip,vlsegde,
+ vidota,vfdota,vibdota,vfbdota"))
"andes_45_vector_dummies")
diff --git a/gcc/config/riscv/arcv-rhx100.md b/gcc/config/riscv/arcv-rhx100.md
index
da46f714db46723bd506b31f1a5ebb1543997f60..0d290b01f73b3b492647b45c82b860aeedb89a13
100644
--- a/gcc/config/riscv/arcv-rhx100.md
+++ b/gcc/config/riscv/arcv-rhx100.md
@@ -104,7 +104,8 @@
vimerge,vror,rdvlenb,vfwcvtitof,vaesdf,viwmuladd,vrev8,
vsm4r,vsalu,vfminmax,vicalu,vslideup,vldox,vstm,
vfwcvtbf16,vfmovfv,vfslide1up,vimovxv,sf_vc,sf_vqmacc,
- sf_vc_se"))
+ sf_vc_se,
+ vidota,vfdota,vibdota,vfbdota"))
"(arcv_rhx100_issueA_fuse0 + arcv_rhx100_issueA_fuse1) |
(arcv_rhx100_issueB_fuse0 + arcv_rhx100_issueB_fuse1)")
;; Bypasses
diff --git a/gcc/config/riscv/arcv-rmx100.md b/gcc/config/riscv/arcv-rmx100.md
index
fb34d1202e462d4132d0234e6304d4c82623a1da..4b6fc5c3d38d947142b0652d217d746d8fabf20e
100644
--- a/gcc/config/riscv/arcv-rmx100.md
+++ b/gcc/config/riscv/arcv-rmx100.md
@@ -109,7 +109,8 @@
vimerge,vror,rdvlenb,vfwcvtitof,vaesdf,viwmuladd,vrev8,
vsm4r,vsalu,vfminmax,vicalu,vslideup,vldox,vstm,
vfwcvtbf16,vfmovfv,vfslide1up,vimovxv,sf_vc,sf_vqmacc,
- sf_vc_se"))
+ sf_vc_se,
+ vidota,vfdota,vibdota,vfbdota"))
"arcv_rmx100_ALU")
diff --git a/gcc/config/riscv/generic-vector-ooo.md
b/gcc/config/riscv/generic-vector-ooo.md
index
e0d9a9f972ead6a5ba7fa8dbd2cec79e388b193d..af07a43d4a47c834aebb8f54fe4fbe5e38ccceba
100644
--- a/gcc/config/riscv/generic-vector-ooo.md
+++ b/gcc/config/riscv/generic-vector-ooo.md
@@ -71,7 +71,7 @@
(define_insn_reservation "vec_imul" 4
(and (eq_attr "tune" "generic_ooo,generic")
(eq_attr "type" "vimul,viwmul,vimuladd,viwmuladd,vsmul,vclmul,vclmulh,\
- vghsh,vgmul"))
+ vghsh,vgmul,vidota,vibdota"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector float addition.
@@ -83,7 +83,8 @@
;; Vector float multiplication and FMA.
(define_insn_reservation "vec_fmul" 6
(and (eq_attr "tune" "generic_ooo,generic")
- (eq_attr "type"
"vfmul,vfwmul,vfmuladd,vfwmuladd,vfwmaccbf16,sf_vqmacc,sf_vfnrclip"))
+ (eq_attr "type" "vfmul,vfwmul,vfmuladd,vfwmuladd,vfwmaccbf16,\
+ vfdota,vfbdota,sf_vqmacc,sf_vfnrclip"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector crypto, assumed to be a generic operation for now.
diff --git a/gcc/config/riscv/mips-p8700.md b/gcc/config/riscv/mips-p8700.md
index
cd3adb71821d5f819bb1a47c8615fc32c9fa516e..6ec65728145c6c6c661b5f78e9d84c9b8bbc1af5
100644
--- a/gcc/config/riscv/mips-p8700.md
+++ b/gcc/config/riscv/mips-p8700.md
@@ -163,5 +163,6 @@
vgather,vcompress,vmov,vector,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vcpop,vrol,vror,vwsll,
vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz,
vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,
- sf_vc,sf_vc_se,ghost"))
+ sf_vc,sf_vc_se,ghost,
+ vidota,vfdota,vibdota,vfbdota"))
"mips_p8700_dummies")
diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index
f019426007cbf6d0842f814c17df3a93130d68cb..94ae8044262b215cd084cbd4c605d37ac07e3a36
100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -83,6 +83,11 @@
(and (match_code "const_int")
(match_test "IN_RANGE (INTVAL (op), 0, 10)")))
+(define_predicate "zvbdota_ci_operand"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (INTVAL (op), 0, 56)
+ && INTVAL (op) % 8 == 0")))
+
(define_predicate "csr_operand"
(ior (match_operand 0 "const_csr_operand")
(match_operand 0 "register_operand")))
diff --git a/gcc/config/riscv/riscv-avlprop.cc
b/gcc/config/riscv/riscv-avlprop.cc
index
a4088e8e51ce264880cef4320a3d40ac1c478fd5..f5b44d16c3981e7a302e0040a3fc11873e9ca8ba
100644
--- a/gcc/config/riscv/riscv-avlprop.cc
+++ b/gcc/config/riscv/riscv-avlprop.cc
@@ -137,12 +137,20 @@ avl_can_be_propagated_p (rtx_insn *rinsn)
vcompress v1, v2, v0 with avl = 4, v1 = {0x8, 0x2, 0x3, 0x4}.
vcompress v1, v2, v0 with avl = 2, v1 will be unchanged.
Thus, we cannot propagate avl of vcompress because it may has
- semantics change to the result. */
+ semantics change to the result.
+ Dot products:
+ - VL counts reduction terms rather than live accumulator elements,
+ so propagating it into an accumulator producer can discard values
+ that the dot product still needs. */
return get_attr_type (rinsn) != TYPE_VGATHER
&& get_attr_type (rinsn) != TYPE_VSLIDEDOWN
&& get_attr_type (rinsn) != TYPE_VISLIDE1DOWN
&& get_attr_type (rinsn) != TYPE_VFSLIDE1DOWN
- && get_attr_type (rinsn) != TYPE_VCOMPRESS;
+ && get_attr_type (rinsn) != TYPE_VCOMPRESS
+ && get_attr_type (rinsn) != TYPE_VIDOTA
+ && get_attr_type (rinsn) != TYPE_VFDOTA
+ && get_attr_type (rinsn) != TYPE_VIBDOTA
+ && get_attr_type (rinsn) != TYPE_VFBDOTA;
}
static bool
diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h
index
c0fb2839780975a3aebdf7f9566a821c24406e8e..a4d9381c31abe5228474f12e9dd8e6a36a45302b
100644
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@ -666,10 +666,10 @@ enum mask_policy
};
/* Values for the VTYPE altfmt field. Instructions that do not care about
- altfmt leave the "altfmt" insn attribute at its default (INVALID_ATTRIBUTE);
- FP8 instructions select between standard (ALTFMT_NONE, E4M3) and the
- alternate format (ALTFMT_ALT, E5M2) by setting the attribute via an
- operand. */
+ altfmt leave the "altfmt" insn attribute at its default (INVALID_ATTRIBUTE).
+ FP8 instructions select between standard (ALTFMT_NONE, E4M3) and alternate
+ (ALTFMT_ALT, E5M2) formats. Dot-product instructions use distinct UNSPECs
+ to select the signedness or FP8 format of vs1 statically. */
enum altfmt_type
{
ALTFMT_NONE = 0,
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index
76a566520ff597bf1f5ae98dff4fcf6254a3935c..5ce4cc1944fd17f131462976ab07b3b89cfc6487
100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -491,6 +491,11 @@
;; vfncvtbf16 vector narrowing single floating-point to brain floating-point
instruction
;; vfwcvtbf16 vector widening brain floating-point to single floating-point
instruction
;; vfwmaccbf16 vector BF16 widening multiply-accumulate
+;; 19. Vector dot-product instructions
+;; vidota vector integer dot-product accumulate instructions
+;; vfdota vector floating-point dot-product accumulate instructions
+;; vibdota vector integer batched dot-product accumulate instructions
+;; vfbdota vector floating-point batched dot-product accumulation
;; SiFive custom extension instructions
;; sf_vqmacc vector matrix integer multiply-add instructions
;; sf_vfnrclip vector fp32 to int8 ranged clip instructions
@@ -518,7 +523,7 @@
vgather,vcompress,vmov,vector,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vcpop,vrol,vror,vwsll,
vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz,
vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,
- sf_vc,sf_vc_se"
+ vidota,vfdota,vibdota,vfbdota,sf_vc,sf_vc_se"
(cond [(eq_attr "got" "load") (const_string "load")
;; If a doubleword move uses these expensive instructions,
@@ -554,7 +559,7 @@
(define_attr "fp_vector_disabled" "no,yes"
(cond [
(and (eq_attr "type" "vfmov,vfalu,vfmul,vfdiv,
- vfwalu,vfwmul,vfmuladd,vfwmuladd,
+ vfwalu,vfwmul,vfmuladd,vfwmuladd,vfdota,vfbdota,
vfsqrt,vfrecp,vfminmax,vfsgnj,vfcmp,
vfclass,vfmerge,
vfncvtitof,vfwcvtftoi,vfcvtftoi,vfcvtitof,
@@ -5504,6 +5509,7 @@
(include "vector.md")
(include "vector-crypto.md")
(include "vector-bfloat16.md")
+(include "vector-dot.md")
(include "zicond.md")
(include "mips-insn.md")
(include "sfb.md")
diff --git a/gcc/config/riscv/sifive-7.md b/gcc/config/riscv/sifive-7.md
index
cca54c6708fd7cdf584582ad07219366d17ec75b..e734b8148fa2ee5a10bcb2c768e721b041d5495f
100644
--- a/gcc/config/riscv/sifive-7.md
+++ b/gcc/config/riscv/sifive-7.md
@@ -301,5 +301,6 @@
(eq_attr "type" "vector,vclmul,vclmulh,vghsh,vgmul,
vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,
vaesz,vsha2ms,vsha2ch,vsha2cl,
- vsm4k,vsm4r,vsm3me,vsm3c,sf_vc,sf_vc_se"))
+ vsm4k,vsm4r,vsm3me,vsm3c,sf_vc,sf_vc_se,
+ vidota,vfdota,vibdota,vfbdota"))
"sifive_7_vcq,sifive_7_va*6")
diff --git a/gcc/config/riscv/sifive-p400.md b/gcc/config/riscv/sifive-p400.md
index
0acdbdab31e59db2e119320c27e323b08cb6a3a1..aca92caf4bf306faa1389527dabf95a4b58e9e59
100644
--- a/gcc/config/riscv/sifive-p400.md
+++ b/gcc/config/riscv/sifive-p400.md
@@ -192,7 +192,29 @@
;; they are just dummies like this one.
(define_insn_reservation "sifive_p400_unknown" 1
(and (eq_attr "tune" "sifive_p400")
- (eq_attr "type"
"ghost,vfrecp,vclmul,vldm,vmffs,vclmulh,vlsegde,vfcvtitof,vsm4k,vfcvtftoi,vfdiv,vsm3c,vsm4r,viwmuladd,vfwredu,vcpop,vfwmuladd,vstux,vsshift,vfwcvtftof,vfncvtftof,vfwmaccbf16,vext,vssegte,rdvl,vaeskf1,vfslide1up,vmov,vimovvx,vaesef,vfsqrt,viminmax,vfwcvtftoi,vssegtox,vfclass,viwmul,vector,vgmul,vsm3me,vfcmp,vstm,vfredo,vfwmul,vaeskf2,vstox,vfncvtbf16,vislide1up,vgather,vldox,viwred,vctz,vghsh,vsts,vslidedown,vfmerge,vicmp,vsmul,vlsegdff,vfalu,vfmov,vislide1down,vfminmax,vcompress,vldr,vldff,vlsegdux,vimuladd,vsalu,vidiv,sf_vqmacc,vfslide1down,vaesem,vimerge,vfncvtftoi,vfwcvtitof,vicalu,vaesz,sf_vc_se,vsha2cl,vmsfs,vldux,vmidx,vslideup,vired,vlde,vfwredo,vfmovfv,vbrev,vfncvtitof,rdfrm,vsetvl,vssegts,vimul,vialu,vbrev8,vfwalu,rdvlenb,sf_vfnrclip,vclz,vnclip,sf_vc,vimov,vste,vfmuladd,vfmovvf,vwsll,vsetvl_pre,vlds,vlsegds,vmiota,vmalu,wrvxrm,wrfrm,viwalu,vaesdm,vssegtux,vaesdf,vimovxv,vror,vnshift,vstr,vaalu,vsha2ms,crypto,vfwcvtbf16,vlsegdox,vrol,vandn,vfsgnj,vmpop,vfredu,vsha2ch,vshift,vrev8,vfmul"))
+ (eq_attr "type" "ghost,vfrecp,vclmul,vldm,vmffs,vclmulh,vlsegde,
+ vfcvtitof,vsm4k,vfcvtftoi,vfdiv,vsm3c,vsm4r,
+ viwmuladd,vfwredu,vcpop,vfwmuladd,vstux,vsshift,
+ vfwcvtftof,vfncvtftof,vfwmaccbf16,vext,vssegte,
+ rdvl,vaeskf1,vfslide1up,vmov,vimovvx,vaesef,
+ vfsqrt,viminmax,vfwcvtftoi,vssegtox,vfclass,
+ viwmul,vector,vgmul,vsm3me,vfcmp,vstm,vfredo,
+ vfwmul,vaeskf2,vstox,vfncvtbf16,vislide1up,
+ vgather,vldox,viwred,vctz,vghsh,vsts,vslidedown,
+ vfmerge,vicmp,vsmul,vlsegdff,vfalu,vfmov,
+ vislide1down,vfminmax,vcompress,vldr,vldff,
+ vlsegdux,vimuladd,vsalu,vidiv,sf_vqmacc,
+ vfslide1down,vaesem,vimerge,vfncvtftoi,vfwcvtitof,
+ vicalu,vaesz,sf_vc_se,vsha2cl,vmsfs,vldux,vmidx,
+ vslideup,vired,vlde,vfwredo,vfmovfv,vbrev,
+ vfncvtitof,rdfrm,vsetvl,vssegts,vimul,vialu,
+ vbrev8,vfwalu,rdvlenb,sf_vfnrclip,vclz,vnclip,
+ sf_vc,vimov,vste,vfmuladd,vfmovvf,vwsll,
+ vsetvl_pre,vlds,vlsegds,vmiota,vmalu,wrvxrm,wrfrm,
+ viwalu,vaesdm,vssegtux,vaesdf,vimovxv,vror,
+ vnshift,vstr,vaalu,vsha2ms,crypto,vfwcvtbf16,
+ vlsegdox,vrol,vandn,vfsgnj,vmpop,vfredu,vsha2ch,
+ vshift,vrev8,vfmul,vidota,vfdota,vibdota,vfbdota"))
"p400_int_pipe+sifive_p400_ialu")
diff --git a/gcc/config/riscv/sifive-p600.md b/gcc/config/riscv/sifive-p600.md
index
ccd006d16ed75a1768ce9c42a5d7865f0120a579..26f0558c562000516b5464d61fe4b801195657bf
100644
--- a/gcc/config/riscv/sifive-p600.md
+++ b/gcc/config/riscv/sifive-p600.md
@@ -195,5 +195,27 @@
;; they are just dummies like this one.
(define_insn_reservation "sifive_p600_unknown" 1
(and (eq_attr "tune" "sifive_p600")
- (eq_attr "type"
"vicmp,vssegte,vbrev8,vfwalu,vimov,vmpop,vaesdf,vislide1up,vror,vsha2cl,vrol,vslideup,vimuladd,vclmul,vaesef,vext,vlsegdff,vfmuladd,vfclass,vmsfs,vfcmp,vsmul,vsm3me,vmalu,vshift,viwmuladd,vfslide1up,vlsegde,vsm4k,wrvxrm,vislide1down,vsm3c,vfwmuladd,vaesdm,vclmulh,vfwcvtftof,vfwredu,vfredo,sf_vfnrclip,vaesz,vwsll,vmiota,vctz,vsetvl_pre,vstm,vidiv,vssegtux,vfwmul,vcompress,vste,vired,vlsegds,vaesem,vfminmax,ghost,vandn,crypto,vfmul,vialu,vfmovvf,rdfrm,vldff,vfmerge,vsshift,vnclip,sf_vqmacc,vnshift,vfdiv,vfslide1down,vfncvtitof,vfsqrt,vimovxv,vstr,vfwcvtbf16,vfwcvtitof,vbrev,vssegtox,vssegts,vcpop,vmffs,viwmul,vldr,vmidx,rdvlenb,vfalu,vslidedown,vlde,vfsgnj,vfmov,viwalu,vsha2ch,vfncvtbf16,vfcvtitof,rdvl,vsetvl,vsha2ms,vector,vstux,vimerge,vclz,sf_vc,vfcvtftoi,viminmax,vsm4r,sf_vc_se,wrfrm,vstox,vfmovfv,vfncvtftoi,vimul,vsalu,vmov,vgmul,vgather,vldux,vlsegdox,vfncvtftof,vimovvx,vghsh,vldm,vldox,vfwcvtftoi,vlds,vfrecp,vaeskf2,vsts,vfredu,vicalu,vaalu,vfwmaccbf16,vrev8,vfwredo,vlsegdux,viwred,vaeskf1"))
+ (eq_attr "type" "vicmp,vssegte,vbrev8,vfwalu,vimov,vmpop,vaesdf,
+ vislide1up,vror,vsha2cl,vrol,vslideup,vimuladd,
+ vclmul,vaesef,vext,vlsegdff,vfmuladd,vfclass,
+ vmsfs,vfcmp,vsmul,vsm3me,vmalu,vshift,viwmuladd,
+ vfslide1up,vlsegde,vsm4k,wrvxrm,vislide1down,
+ vsm3c,vfwmuladd,vaesdm,vclmulh,vfwcvtftof,vfwredu,
+ vfredo,sf_vfnrclip,vaesz,vwsll,vmiota,vctz,
+ vsetvl_pre,vstm,vidiv,vssegtux,vfwmul,vcompress,
+ vste,vired,vlsegds,vaesem,vfminmax,ghost,vandn,
+ crypto,vfmul,vialu,vfmovvf,rdfrm,vldff,vfmerge,
+ vsshift,vnclip,sf_vqmacc,vnshift,vfdiv,
+ vfslide1down,vfncvtitof,vfsqrt,vimovxv,vstr,
+ vfwcvtbf16,vfwcvtitof,vbrev,vssegtox,vssegts,
+ vcpop,vmffs,viwmul,vldr,vmidx,rdvlenb,vfalu,
+ vslidedown,vlde,vfsgnj,vfmov,viwalu,vsha2ch,
+ vfncvtbf16,vfcvtitof,rdvl,vsetvl,vsha2ms,vector,
+ vstux,vimerge,vclz,sf_vc,vfcvtftoi,viminmax,vsm4r,
+ sf_vc_se,wrfrm,vstox,vfmovfv,vfncvtftoi,vimul,
+ vsalu,vmov,vgmul,vgather,vldux,vlsegdox,
+ vfncvtftof,vimovvx,vghsh,vldm,vldox,vfwcvtftoi,
+ vlds,vfrecp,vaeskf2,vsts,vfredu,vicalu,vaalu,
+ vfwmaccbf16,vrev8,vfwredo,vlsegdux,viwred,vaeskf1,
+ vidota,vfdota,vibdota,vfbdota"))
"int_pipe+sifive_p600_ialu")
diff --git a/gcc/config/riscv/spacemit-x60.md b/gcc/config/riscv/spacemit-x60.md
index
702fc3cfefc31025e0952147b31634d613bd888d..59957aa5f0f304d6d52da052cc5f9759e809dcbf
100644
--- a/gcc/config/riscv/spacemit-x60.md
+++ b/gcc/config/riscv/spacemit-x60.md
@@ -405,5 +405,6 @@
vsha2cl,vsha2ch,vaesz,vclmulh,vghsh,vaeskf1,vaesdm,vgmul,
vaesem,vaesdf,ghost,vsm3me,sf_vc_se,vsm3c,
vaeskf2,vsha2ms,vector,wrvxrm,
- vclmul,rdfrm,wrfrm,sf_vc,vsm4k,vsm4r"))
+ vclmul,rdfrm,wrfrm,sf_vc,vsm4k,vsm4r,
+ vidota,vfdota,vibdota,vfbdota"))
"nothing")
diff --git a/gcc/config/riscv/tt-ascalon-d8.md
b/gcc/config/riscv/tt-ascalon-d8.md
index
1ca4eb31876bbc0ce659f4ed50d1a5d540e7f36f..036addecc4fe1006cf0432a43e35bab934455699
100644
--- a/gcc/config/riscv/tt-ascalon-d8.md
+++ b/gcc/config/riscv/tt-ascalon-d8.md
@@ -380,5 +380,6 @@
(and (eq_attr "tune" "tt_ascalon_d8,tt_ascalon_xg")
(eq_attr "type" "sf_vc,sf_vc_se,sf_vqmacc,sf_vfnrclip,\
vsm3me,vsm4r,vsm4k,vsm3c,ghost,\
- mfc,mtc,rdfrm"))
+ mfc,mtc,rdfrm,\
+ vidota,vfdota,vibdota,vfbdota"))
"tt_ascalon_d8_decode,tt_ascalon_d8_vec")
diff --git a/gcc/config/riscv/vector-dot.md b/gcc/config/riscv/vector-dot.md
new file mode 100644
index
0000000000000000000000000000000000000000..b5babf4df82321fbb3f63ac9b86ad93eeba43853
--- /dev/null
+++ b/gcc/config/riscv/vector-dot.md
@@ -0,0 +1,202 @@
+;; Machine description for RISC-V vector dot-product extensions.
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+;; Contributed by Jiawei Chen ([email protected]), ISCAS.
+
+;; This file is part of GCC.
+
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Earlyclobber prevents overlap with either source group or the mask.
+;; The accumulator is tied to the result.
+;; Distinct UNSPECs select each signedness or FP8 format combination, making
+;; the altfmt requirement an instruction property.
+;; Like reductions, these operations are opaque: VL counts source terms,
+;; not active accumulator elements. Zvdota masks source terms; Zvbdota
+;; masks the eight accumulator elements selected by ci.
+
+;; Zvdota dot-product instructions. The accumulator always has EMUL=1,
+;; independently of the source LMUL.
+
+(define_insn "@pred_<dot_name>_vv_zvdota<mode>"
+ [(set (match_operand:<V_QUAD_EXT_LMUL1> 0 "register_operand" "=&vr")
+ (unspec:<V_QUAD_EXT_LMUL1>
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 5 "vector_length_operand" "rvl")
+ (match_operand 6 "const_int_operand" "i")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:<V_QUAD_EXT_LMUL1>
+ [(match_operand:VI_ZVQWDOTA 3 "register_operand" "vr")
+ (match_operand:VI_ZVQWDOTA 4 "register_operand" "vr")
+ (match_operand:<V_QUAD_EXT_LMUL1> 2 "register_operand" "0")]
+ ZVQWDOT)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_VECTOR"
+ "<dot_asm>.vv\t%0,%3,%4%p1"
+ [(set_attr "type" "vidota")
+ (set_attr "mode" "<MODE>")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::<dot_altfmt>"))])
+
+(define_insn "@pred_vfwdota_vv_zvdota<mode>"
+ [(set (match_operand:<V_EXT_LMUL1> 0 "register_operand" "=&vr")
+ (unspec:<V_EXT_LMUL1>
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 5 "vector_length_operand" "rvl")
+ (match_operand 6 "const_int_operand" "i")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:<V_EXT_LMUL1>
+ [(match_operand:VF_ZVFBF16 3 "register_operand" "vr")
+ (match_operand:VF_ZVFBF16 4 "register_operand" "vr")
+ (match_operand:<V_EXT_LMUL1> 2 "register_operand" "0")]
+ UNSPEC_VFWDOTA)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_ZVFWDOTA16BF && TARGET_VECTOR_ELEN_FP_32"
+ "vfwdota.vv\t%0,%3,%4%p1"
+ [(set_attr "type" "vfdota")
+ (set_attr "mode" "<MODE>")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::ALTFMT_ALT"))])
+
+(define_insn "@pred_<dot_name>_vv_zvdota<mode>"
+ [(set (match_operand:RVVM1SF 0 "register_operand" "=&vr")
+ (unspec:RVVM1SF
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 5 "vector_length_operand" "rvl")
+ (match_operand 6 "const_int_operand" "i")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:RVVM1SF
+ [(match_operand:VI_Q 3 "register_operand" "vr")
+ (match_operand:VI_Q 4 "register_operand" "vr")
+ (match_operand:RVVM1SF 2 "register_operand" "0")]
+ ZVFQWDOT)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_ZVFQWDOTA8F && TARGET_VECTOR_ELEN_FP_32"
+ "<dot_asm>.vv\t%0,%3,%4%p1"
+ [(set_attr "type" "vfdota")
+ (set_attr "mode" "<MODE>")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::<dot_altfmt>"))])
+
+;; Zvbdota batched dot-product instructions. VTYPE uses LMUL=1; vs2 has
+;; EMUL=8 and vs1 has EMUL=1. Eight results are accumulated at offset ci
+;; in vd. The intrinsic checker requires capacity for at least eight results.
+
+(define_insn "@pred_<dot_name>_vv<mode>"
+ [(set (match_operand:VI_ZVQWBDOTA 0 "register_operand" "=&vr")
+ (unspec:VI_ZVQWBDOTA
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 6 "vector_length_operand" "rvl")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (match_operand 9 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:VI_ZVQWBDOTA
+ [(match_operand:<V_QUAD_TRUNC_LMUL8> 3 "register_operand" "vr")
+ (match_operand:<V_QUAD_TRUNC_LMUL1> 4 "register_operand" "vr")
+ (match_operand 5 "zvbdota_ci_operand" "i")
+ (match_operand:VI_ZVQWBDOTA 2 "register_operand" "0")]
+ ZVQWBDOT)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_VECTOR"
+ "<dot_asm>.vv\t%0,%3,%4,%5%p1"
+ [(set_attr "type" "vibdota")
+ (set_attr "mode" "<V_QUAD_TRUNC_LMUL1>")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::<dot_altfmt>"))])
+
+(define_insn "@pred_vfwbdota_vv<mode>"
+ [(set (match_operand:VF_S_NOFRAC 0 "register_operand"
"=&vr")
+ (unspec:VF_S_NOFRAC
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 6 "vector_length_operand" "rvl")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (match_operand 9 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:VF_S_NOFRAC
+ [(match_operand:RVVM8BF 3 "register_operand" "vr")
+ (match_operand:RVVM1BF 4 "register_operand" "vr")
+ (match_operand 5 "zvbdota_ci_operand" "i")
+ (match_operand:VF_S_NOFRAC 2 "register_operand" "0")]
+ UNSPEC_VFWBDOTA)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_ZVFWBDOTA16BF && TARGET_VECTOR_ELEN_BF_16"
+ "vfwbdota.vv\t%0,%3,%4,%5%p1"
+ [(set_attr "type" "vfbdota")
+ (set_attr "mode" "RVVM1BF")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::ALTFMT_ALT"))])
+
+(define_insn "@pred_<dot_name>_vv<mode>"
+ [(set (match_operand:VF_S_NOFRAC 0 "register_operand"
"=&vr")
+ (unspec:VF_S_NOFRAC
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 6 "vector_length_operand" "rvl")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (match_operand 9 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:VF_S_NOFRAC
+ [(match_operand:RVVM8QI 3 "register_operand" "vr")
+ (match_operand:RVVM1QI 4 "register_operand" "vr")
+ (match_operand 5 "zvbdota_ci_operand" "i")
+ (match_operand:VF_S_NOFRAC 2 "register_operand" "0")]
+ ZVFQWBDOT)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_ZVFQWBDOTA8F"
+ "<dot_asm>.vv\t%0,%3,%4,%5%p1"
+ [(set_attr "type" "vfbdota")
+ (set_attr "mode" "RVVM1QI")
+ (set (attr "altfmt") (symbol_ref "riscv_vector::<dot_altfmt>"))])
+
+(define_insn "@pred_vfbdota_vv<mode>"
+ [(set (match_operand:VF_S_NOFRAC 0 "register_operand"
"=&vr")
+ (unspec:VF_S_NOFRAC
+ [(unspec:<VM>
+ [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
+ (match_operand 6 "vector_length_operand" "rvl")
+ (match_operand 7 "const_int_operand" "i")
+ (match_operand 8 "const_int_operand" "i")
+ (match_operand 9 "const_int_operand" "i")
+ (match_operand 10 "const_int_operand" "i")
+ (reg:SI VL_REGNUM)
+ (reg:SI VTYPE_REGNUM)
+ (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
+ (unspec:VF_S_NOFRAC
+ [(match_operand:RVVM8SF 3 "register_operand" "vr")
+ (match_operand:RVVM1SF 4 "register_operand" "vr")
+ (match_operand 5 "zvbdota_ci_operand" "i")
+ (match_operand:VF_S_NOFRAC 2 "register_operand" "0")]
+ UNSPEC_VFBDOTA)
+ (match_dup 2)] UNSPEC_REDUC))]
+ "TARGET_ZVFBDOTA32F"
+ "vfbdota.vv\t%0,%3,%4,%5%p1"
+ [(set_attr "type" "vfbdota")
+ (set_attr "mode" "RVVM1SF")
+ (set (attr "frm_mode")
+ (symbol_ref "riscv_vector::get_frm_mode (operands[10])"))])
diff --git a/gcc/config/riscv/vector-iterators.md
b/gcc/config/riscv/vector-iterators.md
index
c0475b6b72af612570c794ca622f25debdd5f473..2613c77f8e40fdc5b849c70ca4d14c5b083f9cfe
100644
--- a/gcc/config/riscv/vector-iterators.md
+++ b/gcc/config/riscv/vector-iterators.md
@@ -83,6 +83,26 @@
UNSPEC_VFFMA
+ UNSPEC_VQWDOTA_SS
+ UNSPEC_VQWDOTA_SU
+ UNSPEC_VQWDOTA_US
+ UNSPEC_VQWDOTA_UU
+ UNSPEC_VFQWDOTA_E4M3_E4M3
+ UNSPEC_VFQWDOTA_E4M3_E5M2
+ UNSPEC_VFQWDOTA_E5M2_E4M3
+ UNSPEC_VFQWDOTA_E5M2_E5M2
+ UNSPEC_VQWBDOTA_SS
+ UNSPEC_VQWBDOTA_SU
+ UNSPEC_VQWBDOTA_US
+ UNSPEC_VQWBDOTA_UU
+ UNSPEC_VFQWBDOTA_E4M3_E4M3
+ UNSPEC_VFQWBDOTA_E4M3_E5M2
+ UNSPEC_VFQWBDOTA_E5M2_E4M3
+ UNSPEC_VFQWBDOTA_E5M2_E5M2
+ UNSPEC_VFWDOTA
+ UNSPEC_VFWBDOTA
+ UNSPEC_VFBDOTA
+
UNSPEC_VFMAX
UNSPEC_VFMIN
@@ -1468,6 +1488,84 @@
(V512DF "riscv_vector::vls_mode_valid_p (V512DFmode) &&
TARGET_VECTOR_ELEN_FP_64 && TARGET_MIN_VLEN >= 4096")
])
+;; Scalable integer modes with 8-bit elements.
+(define_mode_iterator VI_Q [
+ RVVM8QI RVVM4QI RVVM2QI RVVM1QI RVVMF2QI RVVMF4QI
+ (RVVMF8QI "TARGET_VECTOR_ELEN_64")
+])
+
+;; Dot products accept source LMULs through m8 and accumulate into m1.
+;; VQEXTI with V_QUAD_TRUNC cannot express the m4 and m8 source modes.
+(define_mode_iterator VI_ZVQWDOTA [
+ (VI_Q "TARGET_ZVQWDOTA8I")
+ (RVVM8HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM4HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM2HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM1HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVMF2HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVMF4HI "TARGET_ZVQWDOTA16I && TARGET_VECTOR_ELEN_64")
+])
+
+;; Scalable integer accumulator modes for batched dot products.
+(define_mode_iterator VI_ZVQWBDOTA [
+ (RVVM8SI "TARGET_ZVQWBDOTA8I")
+ (RVVM4SI "TARGET_ZVQWBDOTA8I")
+ (RVVM2SI "TARGET_ZVQWBDOTA8I")
+ (RVVM1SI "TARGET_ZVQWBDOTA8I")
+ (RVVM8DI "TARGET_ZVQWBDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM4DI "TARGET_ZVQWBDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM2DI "TARGET_ZVQWBDOTA16I && TARGET_VECTOR_ELEN_64")
+ (RVVM1DI "TARGET_ZVQWBDOTA16I && TARGET_VECTOR_ELEN_64")
+])
+
+;; Scalable single-precision modes with nonfractional LMUL.
+(define_mode_iterator VF_S_NOFRAC [
+ (RVVM8SF "TARGET_VECTOR_ELEN_FP_32")
+ (RVVM4SF "TARGET_VECTOR_ELEN_FP_32")
+ (RVVM2SF "TARGET_VECTOR_ELEN_FP_32")
+ (RVVM1SF "TARGET_VECTOR_ELEN_FP_32")
+])
+
+;; Quadruple the element width and use LMUL=1.
+(define_mode_attr V_QUAD_EXT_LMUL1 [
+ (RVVMF8QI "RVVM1SI")
+ (RVVMF4QI "RVVM1SI")
+ (RVVMF2QI "RVVM1SI")
+ (RVVM1QI "RVVM1SI")
+ (RVVM2QI "RVVM1SI")
+ (RVVM4QI "RVVM1SI")
+ (RVVM8QI "RVVM1SI")
+ (RVVMF4HI "RVVM1DI")
+ (RVVMF2HI "RVVM1DI")
+ (RVVM1HI "RVVM1DI")
+ (RVVM2HI "RVVM1DI")
+ (RVVM4HI "RVVM1DI")
+ (RVVM8HI "RVVM1DI")
+])
+
+;; Quarter the element width and select a fixed register-group size.
+(define_mode_attr V_QUAD_TRUNC_LMUL1 [
+ (RVVM1SI "RVVM1QI")
+ (RVVM2SI "RVVM1QI")
+ (RVVM4SI "RVVM1QI")
+ (RVVM8SI "RVVM1QI")
+ (RVVM1DI "RVVM1HI")
+ (RVVM2DI "RVVM1HI")
+ (RVVM4DI "RVVM1HI")
+ (RVVM8DI "RVVM1HI")
+])
+
+(define_mode_attr V_QUAD_TRUNC_LMUL8 [
+ (RVVM1SI "RVVM8QI")
+ (RVVM2SI "RVVM8QI")
+ (RVVM4SI "RVVM8QI")
+ (RVVM8SI "RVVM8QI")
+ (RVVM1DI "RVVM8HI")
+ (RVVM2DI "RVVM8HI")
+ (RVVM4DI "RVVM8HI")
+ (RVVM8DI "RVVM8HI")
+])
+
(define_mode_iterator VOEXTI [
(RVVM8DI "TARGET_VECTOR_ELEN_64") (RVVM4DI "TARGET_VECTOR_ELEN_64")
(RVVM2DI "TARGET_VECTOR_ELEN_64") (RVVM1DI "TARGET_VECTOR_ELEN_64")
@@ -1764,6 +1862,13 @@
])
(define_mode_attr V_EXT_LMUL1 [
+ (RVVMF4BF "RVVM1SF")
+ (RVVMF2BF "RVVM1SF")
+ (RVVM1BF "RVVM1SF")
+ (RVVM2BF "RVVM1SF")
+ (RVVM4BF "RVVM1SF")
+ (RVVM8BF "RVVM1SF")
+
(RVVM8QI "RVVM1HI") (RVVM4QI "RVVM1HI") (RVVM2QI "RVVM1HI") (RVVM1QI
"RVVM1HI") (RVVMF2QI "RVVM1HI") (RVVMF4QI "RVVM1HI") (RVVMF8QI "RVVM1HI")
(RVVM8HI "RVVM1SI") (RVVM4HI "RVVM1SI") (RVVM2HI "RVVM1SI") (RVVM1HI
"RVVM1SI") (RVVMF2HI "RVVM1SI") (RVVMF4HI "RVVM1SI")
@@ -5426,6 +5531,34 @@
(define_int_iterator VFCVTS [UNSPEC_VFCVT UNSPEC_UNSIGNED_VFCVT])
+(define_int_iterator ZVQWDOT [
+ UNSPEC_VQWDOTA_SS
+ UNSPEC_VQWDOTA_SU
+ UNSPEC_VQWDOTA_US
+ UNSPEC_VQWDOTA_UU
+])
+
+(define_int_iterator ZVFQWDOT [
+ UNSPEC_VFQWDOTA_E4M3_E4M3
+ UNSPEC_VFQWDOTA_E4M3_E5M2
+ UNSPEC_VFQWDOTA_E5M2_E4M3
+ UNSPEC_VFQWDOTA_E5M2_E5M2
+])
+
+(define_int_iterator ZVQWBDOT [
+ UNSPEC_VQWBDOTA_SS
+ UNSPEC_VQWBDOTA_SU
+ UNSPEC_VQWBDOTA_US
+ UNSPEC_VQWBDOTA_UU
+])
+
+(define_int_iterator ZVFQWBDOT [
+ UNSPEC_VFQWBDOTA_E4M3_E4M3
+ UNSPEC_VFQWBDOTA_E4M3_E5M2
+ UNSPEC_VFQWBDOTA_E5M2_E4M3
+ UNSPEC_VFQWBDOTA_E5M2_E5M2
+])
+
(define_int_attr order [
(UNSPEC_ORDERED "o") (UNSPEC_UNORDERED "u")
(UNSPEC_REDUC_SUM_ORDERED "o") (UNSPEC_REDUC_SUM_UNORDERED "u")
@@ -5438,6 +5571,64 @@
(UNSPEC_VNCLIP "") (UNSPEC_VNCLIPU "u")
(UNSPEC_VFCVT "") (UNSPEC_UNSIGNED_VFCVT "u")
(UNSPEC_SF_VFNRCLIP "") (UNSPEC_SF_VFNRCLIPU "u")])
+
+(define_int_attr dot_name [
+ (UNSPEC_VQWDOTA_SS "vqwdota_ss")
+ (UNSPEC_VQWDOTA_SU "vqwdota_su")
+ (UNSPEC_VQWDOTA_US "vqwdota_us")
+ (UNSPEC_VQWDOTA_UU "vqwdota_uu")
+ (UNSPEC_VFQWDOTA_E4M3_E4M3 "vfqwdota_e4m3_e4m3")
+ (UNSPEC_VFQWDOTA_E4M3_E5M2 "vfqwdota_e4m3_e5m2")
+ (UNSPEC_VFQWDOTA_E5M2_E4M3 "vfqwdota_e5m2_e4m3")
+ (UNSPEC_VFQWDOTA_E5M2_E5M2 "vfqwdota_e5m2_e5m2")
+ (UNSPEC_VQWBDOTA_SS "vqwbdota_ss")
+ (UNSPEC_VQWBDOTA_SU "vqwbdota_su")
+ (UNSPEC_VQWBDOTA_US "vqwbdota_us")
+ (UNSPEC_VQWBDOTA_UU "vqwbdota_uu")
+ (UNSPEC_VFQWBDOTA_E4M3_E4M3 "vfqwbdota_e4m3_e4m3")
+ (UNSPEC_VFQWBDOTA_E4M3_E5M2 "vfqwbdota_e4m3_e5m2")
+ (UNSPEC_VFQWBDOTA_E5M2_E4M3 "vfqwbdota_e5m2_e4m3")
+ (UNSPEC_VFQWBDOTA_E5M2_E5M2 "vfqwbdota_e5m2_e5m2")
+])
+
+(define_int_attr dot_asm [
+ (UNSPEC_VQWDOTA_SS "vqwdotas")
+ (UNSPEC_VQWDOTA_SU "vqwdotas")
+ (UNSPEC_VQWDOTA_US "vqwdotau")
+ (UNSPEC_VQWDOTA_UU "vqwdotau")
+ (UNSPEC_VFQWDOTA_E4M3_E4M3 "vfqwdota")
+ (UNSPEC_VFQWDOTA_E4M3_E5M2 "vfqwdota")
+ (UNSPEC_VFQWDOTA_E5M2_E4M3 "vfqwdota.alt")
+ (UNSPEC_VFQWDOTA_E5M2_E5M2 "vfqwdota.alt")
+ (UNSPEC_VQWBDOTA_SS "vqwbdotas")
+ (UNSPEC_VQWBDOTA_SU "vqwbdotas")
+ (UNSPEC_VQWBDOTA_US "vqwbdotau")
+ (UNSPEC_VQWBDOTA_UU "vqwbdotau")
+ (UNSPEC_VFQWBDOTA_E4M3_E4M3 "vfqwbdota")
+ (UNSPEC_VFQWBDOTA_E4M3_E5M2 "vfqwbdota")
+ (UNSPEC_VFQWBDOTA_E5M2_E4M3 "vfqwbdota.alt")
+ (UNSPEC_VFQWBDOTA_E5M2_E5M2 "vfqwbdota.alt")
+])
+
+(define_int_attr dot_altfmt [
+ (UNSPEC_VQWDOTA_SS "ALTFMT_ALT")
+ (UNSPEC_VQWDOTA_SU "ALTFMT_NONE")
+ (UNSPEC_VQWDOTA_US "ALTFMT_ALT")
+ (UNSPEC_VQWDOTA_UU "ALTFMT_NONE")
+ (UNSPEC_VFQWDOTA_E4M3_E4M3 "ALTFMT_NONE")
+ (UNSPEC_VFQWDOTA_E4M3_E5M2 "ALTFMT_ALT")
+ (UNSPEC_VFQWDOTA_E5M2_E4M3 "ALTFMT_NONE")
+ (UNSPEC_VFQWDOTA_E5M2_E5M2 "ALTFMT_ALT")
+ (UNSPEC_VQWBDOTA_SS "ALTFMT_ALT")
+ (UNSPEC_VQWBDOTA_SU "ALTFMT_NONE")
+ (UNSPEC_VQWBDOTA_US "ALTFMT_ALT")
+ (UNSPEC_VQWBDOTA_UU "ALTFMT_NONE")
+ (UNSPEC_VFQWBDOTA_E4M3_E4M3 "ALTFMT_NONE")
+ (UNSPEC_VFQWBDOTA_E4M3_E5M2 "ALTFMT_ALT")
+ (UNSPEC_VFQWBDOTA_E5M2_E4M3 "ALTFMT_NONE")
+ (UNSPEC_VFQWBDOTA_E5M2_E5M2 "ALTFMT_ALT")
+])
+
(define_int_attr sat_op [(UNSPEC_VAADDU "aaddu") (UNSPEC_VAADD "aadd")
(UNSPEC_VASUBU "asubu") (UNSPEC_VASUB "asub")
(UNSPEC_VSMUL "smul") (UNSPEC_VSSRL "ssrl")
diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index
f575e46084ee3273d966226b063b7e55f16539b4..78b1ccbe3cd1b07b54d34a0201582dae63c60dbf
100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -56,7 +56,9 @@
vssegtux,vssegtox,vlsegdff,vandn,vbrev,vbrev8,vrev8,vcpop,vclz,vctz,vrol,\
vror,vwsll,vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,\
-
vfncvtbf16,vfwcvtbf16,vfwmaccbf16,sf_vqmacc,sf_vfnrclip,sf_vc,sf_vc_se")
+ vfncvtbf16,vfwcvtbf16,vfwmaccbf16,sf_vqmacc,\
+ sf_vfnrclip,sf_vc,sf_vc_se,\
+ vidota,vfdota,vibdota,vfbdota")
(const_string "true")]
(const_string "false")))
@@ -87,7 +89,8 @@
vssegtux,vssegtox,vlsegdff,vandn,vbrev,vbrev8,vrev8,vcpop,vclz,vctz,vrol,\
vror,vwsll,vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,\
- vfncvtbf16,vfwcvtbf16,vfwmaccbf16")
+ vfncvtbf16,vfwcvtbf16,vfwmaccbf16,\
+ vidota,vfdota,vibdota,vfbdota")
(const_string "true")]
(const_string "false")))
@@ -507,7 +510,8 @@
vandn,vbrev,vbrev8,vrev8,vcpop,vclz,vctz,vrol,vror,vwsll,\
vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,\
- vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16")
+ vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,\
+ vidota,vfdota,vibdota,vfbdota")
(const_int INVALID_ATTRIBUTE)
(and (eq_attr "type" "vlde,vste,vlds,vsts,vlsegde,vssegte,vlsegds,\
vssegts,vlsegdff,vssegtux,vlsegdox,vlsegdux")
@@ -835,7 +839,8 @@
vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c")
(const_int 1)
- (eq_attr "type" "vimuladd,vfmuladd")
+ (eq_attr "type" "vimuladd,vfmuladd,\
+ vidota,vfdota,vibdota,vfbdota")
(const_int 2)]
(const_int INVALID_ATTRIBUTE)))
@@ -858,10 +863,14 @@
(const_int 2)
(eq_attr "type"
"vstux,vstox,vssegts,vssegtux,vssegtox,vfcvtftoi,vfwcvtitof,vfwcvtftoi,
-
vfwcvtftof,vmsfs,vired,viwred,vfredu,vfredo,vfwredu,vfwredo,vwsll,viwalu,vfwalu,viwmul,vfwmul")
+ vfwcvtftof,vmsfs,vired,viwred,vfredu,vfredo,\
+ vfwredu,vfwredo,vwsll,viwalu,vfwalu,viwmul,\
+ vfwmul,\
+ vidota,vfdota")
(const_int 3)
- (eq_attr "type" "viwmuladd,vfwmuladd")
+ (eq_attr "type" "viwmuladd,vfwmuladd,\
+ vibdota,vfbdota")
(const_int 4)]
(const_int INVALID_ATTRIBUTE)))
@@ -889,10 +898,12 @@
vfsgnj,vfmerge,vired,viwred,vfredu,vfredo,vfwredu,vfwredo,\
vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
vgather,viwmuladd,vfwmuladd,vlsegds,vlsegdux,vlsegdox,vandn,vrol,\
- vror,vwsll,vclmul,vclmulh,vfwmaccbf16")
+ vror,vwsll,vclmul,vclmulh,vfwmaccbf16,\
+ vidota,vfdota")
(const_int 5)
- (eq_attr "type" "vicmp,vimuladd,vfcmp,vfmuladd")
+ (eq_attr "type" "vicmp,vimuladd,vfcmp,vfmuladd,\
+ vibdota,vfbdota")
(const_int 6)
(eq_attr "type"
"vmpop,vmffs,vmidx,vssegte,vcpop,vclz,vctz,vgmul,vaesef,vaesem,vaesdf,\
@@ -924,10 +935,12 @@
vfredo,vfwredu,vfwredo,vslideup,vslidedown,vislide1up,\
vislide1down,vfslide1up,vfslide1down,vgather,viwmuladd,vfwmuladd,\
vlsegds,vlsegdux,vlsegdox,vandn,vrol,vror,vwsll,vclmul,vclmulh,\
- vfwmaccbf16,sf_vqmacc,sf_vfnrclip")
+ vfwmaccbf16,sf_vqmacc,sf_vfnrclip,\
+ vidota,vfdota")
(symbol_ref "riscv_vector::get_ta(operands[6])")
- (eq_attr "type" "vimuladd,vfmuladd")
+ (eq_attr "type" "vimuladd,vfmuladd,\
+ vibdota,vfbdota")
(symbol_ref "riscv_vector::get_ta(operands[7])")
(eq_attr "type" "vmidx,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaesz,vsm4r")
@@ -955,10 +968,13 @@
vfwalu,vfwmul,vfsgnj,vfcmp,vslideup,vslidedown,\
vislide1up,vislide1down,vfslide1up,vfslide1down,vgather,\
viwmuladd,vfwmuladd,vlsegds,vlsegdux,vlsegdox,vandn,vrol,\
-
vror,vwsll,vclmul,vclmulh,vfwmaccbf16,sf_vqmacc,sf_vfnrclip")
+ vror,vwsll,vclmul,vclmulh,vfwmaccbf16,sf_vqmacc,\
+ sf_vfnrclip,\
+ vidota,vfdota")
(symbol_ref "riscv_vector::get_ma(operands[7])")
- (eq_attr "type" "vimuladd,vfmuladd")
+ (eq_attr "type" "vimuladd,vfmuladd,\
+ vibdota,vfbdota")
(symbol_ref "riscv_vector::get_ma(operands[8])")
(eq_attr "type" "vmsfs,vmidx")
@@ -991,12 +1007,14 @@
vfsgnj,vfcmp,vslideup,vslidedown,vislide1up,\
vislide1down,vfslide1up,vfslide1down,vgather,viwmuladd,vfwmuladd,\
vlsegds,vlsegdux,vlsegdox,vandn,vrol,vror,vclmul,vclmulh,vwsll,\
- vfwmaccbf16")
+ vfwmaccbf16,\
+ vidota,vfdota")
(const_int 8)
(eq_attr "type" "vstux,vstox,vssegts,vssegtux,vssegtox")
(const_int 5)
- (eq_attr "type" "vimuladd,vfmuladd")
+ (eq_attr "type" "vimuladd,vfmuladd,\
+ vibdota,vfbdota")
(const_int 9)
(eq_attr "type"
"vmsfs,vmidx,vcompress,vghsh,vaeskf1,vaeskf2,vsha2ms,vsha2ch,vsha2cl,\
diff --git a/gcc/config/riscv/xiangshan.md b/gcc/config/riscv/xiangshan.md
index
61791408781514d952db6b9876b2e8fe3b21578b..966166d9e66cb442de23ace12cd4b3938a3a52f1
100644
--- a/gcc/config/riscv/xiangshan.md
+++ b/gcc/config/riscv/xiangshan.md
@@ -107,7 +107,30 @@
;; they are just dummies like this one.
(define_insn_reservation "xiangshan_alu_unknown" 1
(and (eq_attr "tune" "xiangshan")
- (eq_attr "type"
"zicond,min,max,minu,maxu,clz,ctz,cpop,ghost,rotate,clmul,condmove,crypto,mvpair,rdvlenb,rdvl,wrvxrm,wrfrm,rdfrm,vsetvl,vsetvl_pre,vlde,vste,vldm,vstm,vlds,vsts,vldux,vldox,vstux,vstox,vldff,vldr,vstr,vlsegde,vssegte,vlsegds,vssegts,vlsegdux,vlsegdox,vssegtux,vssegtox,vlsegdff,vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp,viminmax,vimul,vidiv,viwmul,vimuladd,sf_vqmacc,viwmuladd,vimerge,vimov,vsalu,vaalu,vsmul,vsshift,vnclip,sf_vfnrclip,vfalu,vfwalu,vfmul,vfdiv,vfwmul,vfmuladd,vfwmuladd,vfsqrt,vfrecp,vfcmp,vfminmax,vfsgnj,vfclass,vfmerge,vfmov,vfcvtitof,vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,vired,viwred,vfredu,vfredo,vfwredu,vfwredo,vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,vfmovvf,vfmovfv,vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,vgather,vcompress,vmov,vector,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vcpop,vrol,vror,vwsll,vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,sf_vc,sf_vc_se"))
+ (eq_attr "type" "zicond,min,max,minu,maxu,clz,ctz,cpop,ghost,
+ rotate,clmul,condmove,crypto,mvpair,rdvlenb,rdvl,
+ wrvxrm,wrfrm,rdfrm,vsetvl,vsetvl_pre,vlde,vste,
+ vldm,vstm,vlds,vsts,vldux,vldox,vstux,vstox,vldff,
+ vldr,vstr,vlsegde,vssegte,vlsegds,vssegts,
+ vlsegdux,vlsegdox,vssegtux,vssegtox,vlsegdff,
+ vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp,
+ viminmax,vimul,vidiv,viwmul,vimuladd,sf_vqmacc,
+ viwmuladd,vimerge,vimov,vsalu,vaalu,vsmul,vsshift,
+ vnclip,sf_vfnrclip,vfalu,vfwalu,vfmul,vfdiv,
+ vfwmul,vfmuladd,vfwmuladd,vfsqrt,vfrecp,vfcmp,
+ vfminmax,vfsgnj,vfclass,vfmerge,vfmov,vfcvtitof,
+ vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,
+ vfncvtitof,vfncvtftoi,vfncvtftof,vired,viwred,
+ vfredu,vfredo,vfwredu,vfwredo,vmalu,vmpop,vmffs,
+ vmsfs,vmiota,vmidx,vimovvx,vimovxv,vfmovvf,
+ vfmovfv,vslideup,vslidedown,vislide1up,
+ vislide1down,vfslide1up,vfslide1down,vgather,
+ vcompress,vmov,vector,vandn,vbrev,vbrev8,vrev8,
+ vclz,vctz,vcpop,vrol,vror,vwsll,vclmul,vclmulh,
+ vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaeskf1,
+ vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,
+ vsm3me,vsm3c,vfncvtbf16,vfwcvtbf16,vfwmaccbf16,
+ sf_vc,sf_vc_se,vidota,vfdota,vibdota,vfbdota"))
"xs_alu_rs")
diff --git a/gcc/config/riscv/xt-c908.md b/gcc/config/riscv/xt-c908.md
index
9037a362e317499438de221dc12872f968ddb12f..3af74fd229e13389a05c785c86edf3d8953fd4d6
100644
--- a/gcc/config/riscv/xt-c908.md
+++ b/gcc/config/riscv/xt-c908.md
@@ -133,5 +133,6 @@
vror,vsalu,vsetvl,vsetvl_pre,vsha2ch,vsha2cl,vsha2ms,
vshift,vslidedown,vslideup,vsm3c,vsm3me,vsm4k,vsm4r,
vsmul,vssegte,vssegtox,vssegts,vssegtux,vsshift,vste,
- vstm,vstox,vstr,vsts,vstux,vwsll,wrfrm,wrvxrm"))
+ vstm,vstox,vstr,vsts,vstux,vwsll,wrfrm,wrvxrm,
+ vidota,vfdota,vibdota,vfbdota"))
"nothing")
--
2.43.0