Hi,

Perhaps there was a good reason not to introduce the loop vect
scalar cost multiplier to SLP but before missing the boat
I figured I'd at least propose a patch.

Bootstrapped and regtested on x86 and power10, regtested on riscv64.

Regards
 Robin

gcc/ChangeLog:

        * tree-vect-slp.cc (vect_bb_vectorization_profitable_p):
        Multiply scalar cost by vect-scalar-cost-multiplier.
---
 gcc/tree-vect-slp.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index c0436ac20dc..9bd66069463 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9673,7 +9673,8 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
       while (si < li_scalar_costs.length ()
             && li_scalar_costs[si].first == sl);
       scalar_target_cost_data->finish_cost (nullptr);
-      scalar_cost = scalar_target_cost_data->body_cost ();
+      scalar_cost = (scalar_target_cost_data->body_cost ()
+                    * param_vect_scalar_cost_multiplier) / 100;
 
       /* Complete the target-specific vector cost calculation.  */
       class vector_costs *vect_target_cost_data = init_cost (bb_vinfo, false);
-- 
2.51.0


Reply via email to