[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] vect: Add vect-scalar-cost-multiplier for SLP.

Jeff Law law@gcc.gnu.org
Fri Jan 30 07:12:28 GMT 2026


https://gcc.gnu.org/g:cf695e32dced59138a2d15bb380ebadf147f2216

commit cf695e32dced59138a2d15bb380ebadf147f2216
Author: Robin Dapp <rdapp@ventanamicro.com>
Date:   Sun Nov 16 18:43:15 2025 +0100

    vect: Add vect-scalar-cost-multiplier for SLP.
    
    This adds the same vect-scalar-cost-multiplier to SLP costing that loop
    costing already has.
    
    gcc/ChangeLog:
    
            * tree-vect-slp.cc (vect_bb_vectorization_profitable_p):
            Multiply scalar cost by vect-scalar-cost-multiplier.
    
    (cherry picked from commit a2f4b0466be29c853c32498ae49c1acfa1594f30)

Diff:
---
 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 5799ef83a460..123661a521e3 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9076,7 +9076,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);


More information about the Gcc-cvs mailing list