[RISC-V] vector segment load/store width as a riscv_tune_param

Robin Dapp rdapp.gcc@gmail.com
Wed Mar 26 08:44:21 GMT 2025


> You won't see failures in the testsuite. The failures only show-up when I
> attempt to impose huge costs on NF above threshold. A quick & dirty way to
> expose the bug is apply the appended patch, then observe that you get output
> from this only for mask_struct_store-*.c and not for mask_struct_load-*.c

I suppose that's due to Richi's restructuring of the vector/SLP code.  What 
might work is (untested):

diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc
index 167375ca751..3c8ff760a4e 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -1114,7 +1114,7 @@ segment_loadstore_group_size (enum vect_cost_for_stmt kind,
 unsigned
 costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, loop_vec_info loop,
                         stmt_vec_info stmt_info,
-                        slp_tree, tree vectype, int stmt_cost)
+                        slp_tree node, tree vectype, int stmt_cost)
 {
   const cpu_vector_cost *costs = get_vector_costs ();
   switch (kind)
@@ -1138,6 +1138,8 @@ costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, loop_vec_info loop,
                 costs for each.  */
              /* TODO: Indexed and ordered/unordered cost.  */
              int group_size = segment_loadstore_group_size (kind, stmt_info);
+             if (!group_size && node->ldst_lanes)
+               group_size = node->lanes;
              if (group_size > 1)
                {
		  switch (group_size)


-- 
Regards
 Robin



More information about the Gcc mailing list