https://gcc.gnu.org/g:3c5d49a2f046e223c32d44719999d253db0ea0bb
commit r17-439-g3c5d49a2f046e223c32d44719999d253db0ea0bb Author: Richard Biener <[email protected]> Date: Wed May 6 13:43:27 2026 +0200 adjust OMP SIMD call cost The following adds special handling to OMP SIMD vector call costs which were not costed at all and for which a single simple vector stmt isn't appropriate. PR125174 shows that even when AVX imposes more overhead (from also slightly bogus costing) than SSE, when there's two OMP SIMD calls involved doing less of those should trump that. PR target/125174 * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Cost calls as 10 times FMA. Diff: --- gcc/config/i386/i386.cc | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index e73c2d7f7d04..9aecd51119f3 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -26591,20 +26591,32 @@ ix86_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind, if ((kind == vector_stmt || kind == scalar_stmt) && stmt_info && stmt_info->stmt - && (cfn = gimple_call_combined_fn (stmt_info->stmt)) != CFN_LAST) - switch (cfn) - { - case CFN_FMA: - stmt_cost = ix86_vec_cost (mode, - mode == SFmode ? ix86_cost->fmass - : ix86_cost->fmasd); - break; - case CFN_MULH: - stmt_cost = ix86_multiplication_cost (ix86_cost, mode); - break; - default: - break; - } + && is_gimple_call (stmt_info->stmt)) + { + tree fndecl = gimple_call_fndecl (stmt_info->stmt); + cgraph_node *node; + if ((fndecl + && (node = cgraph_node::get (fndecl)) + && node->simd_clones) + || gimple_call_internal_p (stmt_info->stmt, IFN_MASK_CALL)) + stmt_cost = 10 * ix86_vec_cost (mode, + mode == SFmode ? ix86_cost->fmass + : ix86_cost->fmasd); + else if ((cfn = gimple_call_combined_fn (stmt_info->stmt)) != CFN_LAST) + switch (cfn) + { + case CFN_FMA: + stmt_cost = ix86_vec_cost (mode, + mode == SFmode ? ix86_cost->fmass + : ix86_cost->fmasd); + break; + case CFN_MULH: + stmt_cost = ix86_multiplication_cost (ix86_cost, mode); + break; + default: + break; + } + } if (kind == vec_promote_demote) {
