Hi, thank you for the feedback.

I’ve updated the model to clamp all reservations to 7 cycles, while keeping
the full latencies. I wasn’t aware that large reservation values could
significantly impact DFA build times, so thank you for pointing that out.

Regarding -madjust-lmul-cost, using it for Spacemit-X60 would require
adjusting the condition in riscv.cc in the function riscv_sched_adjust_cost
on line 11829:

-  if (!TARGET_VECTOR || riscv_microarchitecture != generic_ooo)
+  if (!TARGET_VECTOR || (riscv_microarchitecture != generic_ooo
 && riscv_microarchitecture != spacemit_x60))

Would that be preferable to explicit LMUL handling?

Pipeline costs are based on llvm/test/tools/llvm-mca/RISCV/SpacemitX60/rvv
simulations using the existing Spacemit-X60 model, combined with RVV
instruction-level microbenchmarks from the camel-cdr/rvv-bench repo,
which I ran on the Banana Pi BPI-F3 board.

In the patch I intentionally treat the VXU as a single logical unit.
I don’t have enough data to reliably classify all instruction types,
so I kept the model simple. The same applies to vector FP.

2026-02-05  Nikola Ratkovac  <[email protected]>

gcc/ChangeLog:

 * config/riscv/spacemit-x60.md: Add primary vector pipeline model
 for the Spacemit-X60 core.
 (vector_lmul): New attribute mapping machine modes to LMUL.
 (spacemit_x60_dummy): Rename from spacemi6_x60_dummy.


CONFIDENTIALITY: The contents of this e-mail are confidential and intended only 
for the above addressee(s). If you are not the intended recipient, or the 
person responsible for delivering it to the intended recipient, copying or 
delivering it to anyone else or using it in any unauthorized manner is 
prohibited and may be unlawful. If you receive this e-mail by mistake, please 
notify the sender and the systems administrator at [email protected] 
immediately.
---
 gcc/config/riscv/spacemit-x60.md | 843 ++++++++++++++++++++++++++++++-
 1 file changed, 836 insertions(+), 7 deletions(-)

diff --git a/gcc/config/riscv/spacemit-x60.md b/gcc/config/riscv/spacemit-x60.md
index fdd7b87b3..a47f42273 100644
--- a/gcc/config/riscv/spacemit-x60.md
+++ b/gcc/config/riscv/spacemit-x60.md
@@ -26,10 +26,9 @@
 ;; There's actually two VXU units and ops get split across them
 ;; to give the illusion of a single wider unit with higher 
 ;; performance.  There are a few ops that can only be fed into
-;; one of the two units.  Probably best to initially model as
-;; a single unit
+;; one of the two units.  For the purposes of this scheduling
+;; model, the VXU is treated as a single unit.
 ;;
-;; The VXU is not currently modeled.
 ;; Some ops like shadd.uw and add.uw, cpop take an extra cycle
 ;; Given everything is in-order, anti-dependencies probably matter
 ;; FP sign injection isn't handled correctly
@@ -38,13 +37,35 @@
 (define_automaton "spacemit_x60")
 (define_cpu_unit "spacemit_x60_alu0,spacemit_x60_alu1" "spacemit_x60")
 (define_cpu_unit "spacemit_x60_lsu0,spacemit_x60_lsu1" "spacemit_x60")
-;;(define_cpu_unit "spacemit_x60_vxu0" "spacemit_x60")
+(define_cpu_unit "spacemit_x60_vxu0" "spacemit_x60")
 (define_cpu_unit "spacemit_x60_fpalu" "spacemit_x60")
 (define_cpu_unit "spacemit_x60_fdivsqrt" "spacemit_x60")
 
 (define_reservation "spacemit_x60_lsu" "spacemit_x60_lsu0, spacemit_x60_lsu1")
 (define_reservation "spacemit_x60_alu" "spacemit_x60_alu0, spacemit_x60_alu1")
 
+;; Fractional LMUL (F2/F4/...) treated as m1 for scheduling
+(define_attr "vector_lmul" "m1,m2,m4,m8"
+  (cond [
+    (eq_attr "mode" "RVVM1QI,RVVM1HI,RVVM1SI,RVVM1DI,RVVM1HF,RVVM1BF,RVVM1SF,
+       RVVM1DF,RVVMF2QI,RVVMF2HI,RVVMF2SI,RVVMF2SF,RVVMF2HF,RVVMF2BF,RVVMF2BI,
+       RVVMF4QI,RVVMF4HI,RVVMF4BF,RVVMF4HF,RVVMF4BI,RVVMF8QI,RVVMF8BI,
+       RVVMF16BI,RVVMF32BI,RVVMF64BI,RVVM1BI")
+    (const_string "m1")
+
+    (eq_attr "mode" "RVVM2QI,RVVM2HI,RVVM2SI,RVVM2DI,
+       RVVM2HF,RVVM2BF,RVVM2SF,RVVM2DF")
+    (const_string "m2")
+
+    (eq_attr "mode" "RVVM4QI,RVVM4HI,RVVM4SI,RVVM4DI,
+       RVVM4HF,RVVM4BF,RVVM4SF,RVVM4DF")
+    (const_string "m4")
+
+    (eq_attr "mode" "RVVM8QI,RVVM8HI,RVVM8SI,RVVM8DI,
+       RVVM8HF,RVVM8BF,RVVM8SF,RVVM8DF")
+    (const_string "m8")
+  ] (const_string "m1")))
+
 ;; ----------------------------------------------------
 ;; Memory (load/store)
 ;; ----------------------------------------------------
@@ -183,8 +204,816 @@
            (eq_attr "mode" "DF")))
   "spacemit_x60_fdivsqrt*7")
 
-(define_insn_reservation "spacemi6_x60_dummy" 1
+;; ----------------------------------------------------
+;; Vector
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vsetvl" 1
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vsetvl_pre,vsetvl,rdvlenb,rdvl"))
+  "spacemit_x60_vxu0")
+
+;; ----------------------------------------------------
+;; Vector Memory (load/store)
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_load_m1" 3
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlde,vldr")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*3")
+
+(define_insn_reservation "spacemit_x60_vec_load_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlde,vldr")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_load_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlde,vldr")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_load_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlde,vldr")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_store_m1" 3
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vste,vstr")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*3")
+
+(define_insn_reservation "spacemit_x60_vec_store_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vste,vstr")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_store_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vste,vstr")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_store_m8" 19
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vste,vstr")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_mask_load" 1
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vldm"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_mask_store" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vstm"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_vldff_m1" 5
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldff")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*5")
+
+(define_insn_reservation "spacemit_x60_vec_vldff_m2" 7
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldff")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_vldff_m4" 11
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldff")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_vldff_m8" 19
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldff")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_strided_m1" 32
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlds,vsts")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_strided_m2" 64
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlds,vsts")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_strided_m4" 128
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlds,vsts")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_strided_m8" 256
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlds,vsts")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_indexed_m1" 64
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldux,vldox,vstux,vstox,
+      vlsegdux,vlsegdox,vssegtux,vssegtox")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_indexed_m2" 96
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldux,vldox,vstux,vstox,
+      vlsegdux,vlsegdox,vssegtux,vssegtox")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_indexed_m4" 128
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldux,vldox,vstux,vstox,
+      vlsegdux,vlsegdox,vssegtux,vssegtox")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_indexed_m8" 256
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vldux,vldox,vstux,vstox,
+      vlsegdux,vlsegdox,vssegtux,vssegtox")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_segmented_m1" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlsegde,vlsegds,vlsegdff,vssegte,vssegts")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_segmented_m2" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlsegde,vlsegds,vlsegdff,vssegte,vssegts")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_segmented_m4" 32
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlsegde,vlsegds,vlsegdff,vssegte,vssegts")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_segmented_m8" 128
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vlsegde,vlsegds,vlsegdff,vssegte,vssegts")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Integer Arithmetic
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_ialu_m1" 1
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vialu")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_m2" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vialu")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_m4" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vialu")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_m8" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vialu")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_shift_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vshift")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_shift_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vshift")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_shift_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vshift")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_shift_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vshift")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_sshift_m1" 1
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsshift")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_sshift_m2" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsshift")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_sshift_m4" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsshift")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_sshift_m8" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsshift")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_cmp" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vicmp"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_slow_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viminmax,vbrev,vext,
+       vbrev8,vclz,vctz,vcpop,vrol,vror,vandn")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_slow_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viminmax,vbrev,vext,
+       vbrev8,vclz,vctz,vcpop,vrol,vror,vandn")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_slow_m4" 5
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viminmax,vbrev,vext,
+       vbrev8,vclz,vctz,vcpop,vrol,vror,vandn")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_ialu_slow_m8" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viminmax,vbrev,vext,
+       vbrev8,vclz,vctz,vcpop,vrol,vror,vandn")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_imul_m1" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimul")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_imul_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimul")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_imul_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimul")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_imul_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimul")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_imuladd_m1" 7
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimuladd")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_imuladd_m2" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimuladd")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_imuladd_m4" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimuladd")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_imuladd_m8" 32
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimuladd")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_iwalu_m1" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwalu,viwmul,viwmuladd,vwsll")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_iwalu_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwalu,viwmul,viwmuladd,vwsll")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_iwalu_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwalu,viwmul,viwmuladd,vwsll")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_div_m1" 24
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vidiv")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_div_m2" 48
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vidiv")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_div_m4" 96
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vidiv")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_div_m8" 192
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vidiv")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Fixed Point
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsalu,vaalu")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsalu,vaalu")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_m4" 5
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsalu,vaalu")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_m8" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsalu,vaalu")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_slow_m1" 7
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsmul")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_slow_m2" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsmul")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_slow_m4" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsmul")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fixed_point_slow_m8" 32
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vsmul")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_narrow_fixed_point_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vnshift,vnclip")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_narrow_fixed_point_m2" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vnshift,vnclip")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_narrow_fixed_point_m4" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vnshift,vnclip")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Floating Point
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_falu_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfalu,vfmul,vfmuladd,vfminmax,vfrecp,
+       vfcvtitof,vfcvtftoi,vfmerge")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_falu_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfalu,vfmul,vfmuladd,vfminmax,vfrecp,
+       vfcvtitof,vfcvtftoi,vfmerge")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_falu_m4" 5
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfalu,vfmul,vfmuladd,vfminmax,vfrecp,
+       vfcvtitof,vfcvtftoi,vfmerge")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_falu_m8" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfalu,vfmul,vfmuladd,vfminmax,vfrecp,
+       vfcvtitof,vfcvtftoi,vfmerge")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwalu_m1" 5
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwalu,vfwmul,vfwmuladd,vfwmaccbf16,vfwcvtitof,
+      vfwcvtftoi,vfwcvtftof,vfwcvtbf16,vfncvtitof,vfncvtftoi,vfncvtftof,
+      vfncvtbf16,sf_vfnrclip,sf_vqmacc")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fwalu_m2" 9
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwalu,vfwmul,vfwmuladd,vfwmaccbf16,vfwcvtitof,
+      vfwcvtftoi,vfwcvtftof,vfwcvtbf16,vfncvtitof,vfncvtftoi,vfncvtftof,
+      vfncvtbf16,sf_vfnrclip,sf_vqmacc")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwalu_m4" 17
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwalu,vfwmul,vfwmuladd,vfwmaccbf16,vfwcvtitof,
+      vfwcvtftoi,vfwcvtftof,vfwcvtbf16,vfncvtitof,vfncvtftoi,vfncvtftof,
+      vfncvtbf16,sf_vfnrclip,sf_vqmacc")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fcmp_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfcmp")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_fcmp_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfcmp")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_fcmp_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfcmp")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fcmp_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfcmp")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fmov" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vfmovfv,vfmov"))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fsimple_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfmovvf,vfclass,vfsgnj")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_fsimple_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfmovvf,vfclass,vfsgnj")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_fsimple_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfmovvf,vfclass,vfsgnj")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fsimple_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfmovvf,vfclass,vfsgnj")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fsqrt_fdiv_m1" 12
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfsqrt,vfdiv")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fsqrt_fdiv_m2" 24
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfsqrt,vfdiv")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fsqrt_fdiv_m4" 48
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfsqrt,vfdiv")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fsqrt_fdiv_m8" 96
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfsqrt,vfdiv")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Mask Operations
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_mask_alu" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vmalu"))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_mask_pop" 6
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vmpop,vmffs"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_mask_special_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmidx,vmiota")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_mask_special_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmidx,vmiota")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_mask_special_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmidx,vmiota")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_mask_special_m8" 16
   (and (eq_attr "tune" "spacemit_x60")
-       (eq_attr "type" 
"viminmax,vfmuladd,vfmovvf,vssegte,vlsegds,rdvlenb,vaesef,vfcmp,vmpop,vwsll,vsha2cl,vfwcvtbf16,vfncvtftoi,vgather,vsha2ch,vsts,vldm,vmsfs,vfmul,vcompress,vaesz,vssegtox,vstox,vclmulh,vghsh,vaalu,vslideup,vfalu,vaeskf1,vfcvtitof,vaesdm,vmffs,vandn,vstm,vgmul,vlds,viwmul,vfmerge,vlsegdff,vshift,vaesem,vaesdf,vste,ghost,viwred,vsalu,vfwredu,vmidx,sf_vfnrclip,vstux,vfslide1down,vfcvtftoi,vfncvtitof,vnshift,vsm3me,vired,vlde,vfwalu,sf_vc_se,vlsegdux,vicmp,vfncvtftof,vror,vfwmaccbf16,vfminmax,vldff,vstr,vsm3c,vfwcvtftoi,vbrev,vaeskf2,vidiv,vfwcvtftof,rdvl,vimul,vfsgnj,vimovvx,vsha2ms,vialu,vfredo,vctz,vlsegde,viwmuladd,vcpop,vsetvl,vldux,vfwmuladd,vector,wrvxrm,vsshift,vfredu,vimerge,vlsegdox,vfrecp,vnclip,vfclass,vbrev8,vslidedown,vldox,vmalu,vext,vimuladd,sf_vqmacc,vldr,vrol,vmov,vsmul,vclmul,vfmov,vislide1up,vssegtux,vclz,rdfrm,vfwcvtitof,vfncvtbf16,vfmovfv,vislide1down,vfwmul,vfsqrt,vrev8,vicalu,vimov,wrfrm,vfdiv,sf_vc,vsm4k,vmiota,vsm4r,viwalu,vsetvl_pre,vimovxv,vfwredo,vfslide1up,vssegts"))
-  "nothing")
+       (and (eq_attr "type" "vmidx,vmiota")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
 
+(define_insn_reservation "spacemit_x60_vec_mask_vmsfs_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmsfs")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_mask_vmsfs_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmsfs")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_mask_vmsfs_m4" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmsfs")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_mask_vmsfs_m8" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vmsfs")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*4")
+
+;; ----------------------------------------------------
+;; Vector Permutations
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_mov" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vmov,vimovxv,vimovvx,vimov"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_merge_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimerge")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_merge_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimerge")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_merge_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimerge")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_merge_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vimerge")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_gather_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vgather")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_gather_m2" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vgather")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_gather_m4" 64
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vgather")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_gather_m8" 256
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vgather")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_compress_m1" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vcompress")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*3")
+
+(define_insn_reservation "spacemit_x60_vec_compress_m2" 10
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vcompress")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_compress_m4" 36
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vcompress")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_compress_m8" 136
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vcompress")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_slide_m1" 2
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vslideup,vslidedown,vislide1up,
+      vislide1down,vfslide1up,vfslide1down")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0")
+
+(define_insn_reservation "spacemit_x60_vec_slide_m2" 4
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vslideup,vslidedown,vislide1up,
+      vislide1down,vfslide1up,vfslide1down")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_slide_m4" 8
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vslideup,vslidedown,vislide1up,
+      vislide1down,vfslide1up,vfslide1down")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_slide_m8" 16
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vslideup,vslidedown,vislide1up,
+      vislide1down,vfslide1up,vfslide1down")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Reductions
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_vec_red" 7
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vired"))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_wred_m1" 6
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwred")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*2")
+
+(define_insn_reservation "spacemit_x60_vec_wred_m2" 10
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwred")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*4")
+
+(define_insn_reservation "spacemit_x60_vec_wred_m4" 18
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwred")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_wred_m8" 35
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "viwred")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwred_m1" 32
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwredo,vfwredu")
+           (eq_attr "vector_lmul" "m1")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwred_m2" 64
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwredo,vfwredu")
+           (eq_attr "vector_lmul" "m2")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwred_m4" 128
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwredo,vfwredu")
+           (eq_attr "vector_lmul" "m4")))
+  "spacemit_x60_vxu0*7")
+
+(define_insn_reservation "spacemit_x60_vec_fwred_m8" 256
+  (and (eq_attr "tune" "spacemit_x60")
+       (and (eq_attr "type" "vfwredo,vfwredu")
+           (eq_attr "vector_lmul" "m8")))
+  "spacemit_x60_vxu0*7")
+
+;; ----------------------------------------------------
+;; Vector Unknown
+;; ----------------------------------------------------
+
+(define_insn_reservation "spacemit_x60_dummy" 1
+  (and (eq_attr "tune" "spacemit_x60")
+       (eq_attr "type" "vaesef,
+      vsha2cl,vsha2ch,vaesz,vclmulh,vghsh,vaeskf1,vaesdm,vgmul,
+      vaesem,vaesdf,ghost,vicalu,vsm3me,sf_vc_se,vsm3c,
+      vaeskf2,vsha2ms,vfredo,vector,wrvxrm,vfredu,
+      vclmul,rdfrm,wrfrm,sf_vc,vsm4k,vsm4r"))
+  "nothing")
\ No newline at end of file
-- 
2.43.0

Reply via email to