Hi,
This patch adds a --param=autovec-mode=<MODE_NAME>. When the param is
specified we make autovectorize_vector_modes return exactly this mode if
it is available. This helps when testing different vectorizer settings.
Regtested on rv64gcv_zvl512b.
Regards
Robin
gcc/ChangeLog:
* config/riscv/riscv-v.cc (autovectorize_vector_modes): Return
user-specified mode if available.
* config/riscv/riscv.opt: New param.
---
gcc/config/riscv/riscv-v.cc | 20 ++++++++++++++++++++
gcc/config/riscv/riscv.opt | 4 ++++
2 files changed, 24 insertions(+)
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index 1b5ef51886e..a7f2f0a4abe 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2821,6 +2821,26 @@ autovectorize_vector_modes (vector_modes *modes, bool)
i++;
size = base_size / (1U << i);
}
+
+ /* If the user specified the exact mode to use look if it is available and
+ remove all other ones before returning. */
+ if (riscv_autovec_mode)
+ {
+ auto_vector_modes ms;
+ ms.safe_splice (*modes);
+ modes->truncate (0);
+
+ for (machine_mode mode : ms)
+ {
+ if (!strcmp (GET_MODE_NAME (mode), riscv_autovec_mode))
+ {
+ modes->safe_push (mode);
+ return 0;
+ }
+ }
+ return 0;
+ }
+
/* Enable LOOP_VINFO comparison in COST model. */
return VECT_COMPARE_COSTS;
}
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 527e09549a8..5b6dbc6bb4e 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -286,6 +286,10 @@ Max number of bytes to compare as part of inlined
strcmp/strncmp routines (defau
Target RejectNegative Joined UInteger Var(gpr2vr_cost)
Init(GPR2VR_COST_UNPROVIDED)
Set the cost value of the rvv instruction when operate from GPR to VR.
+-param=autovec-mode=
+Target Undocumented RejectNegative Joined Var(riscv_autovec_mode) Save
+Set the only autovec mode to try.
+
Enum
Name(rvv_max_lmul) Type(enum rvv_max_lmul_enum)
The RVV possible LMUL (-mrvv-max-lmul=):
--
2.49.0