alias_off = build_int_cst (ref_type, 0);
stmt_vec_info next_stmt_info = first_stmt_info;
auto_vec<tree> vec_oprnds (ncopies);
+ /* For costing some adjacent vector stores, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_stores = 0;
for (g = 0; g < group_size; g++)
{
running_off = offvar;
store to avoid ICE like 110776. */
if (VECTOR_TYPE_P (ltype)
&& known_ne (TYPE_VECTOR_SUBPARTS (ltype), 1U))
- vect_get_store_cost (vinfo, stmt_info, 1,
- alignment_support_scheme,
- misalignment, &inside_cost,
- cost_vec);
+ n_adjacent_stores++;
else
inside_cost
+= record_stmt_cost (cost_vec, 1, scalar_store,
break;
}
- if (costing_p && dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_store_cost: inside_cost = %d, "
- "prologue_cost = %d .\n",
- inside_cost, prologue_cost);
+ if (costing_p)
+ {
+ if (n_adjacent_stores > 0)
+ vect_get_store_cost (vinfo, stmt_info, n_adjacent_stores,
+ alignment_support_scheme, misalignment,
+ &inside_cost, cost_vec);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_store_cost: inside_cost = %d, "
+ "prologue_cost = %d .\n",
+ inside_cost, prologue_cost);
+ }
return true;
}
{
gcc_assert (!slp && grouped_store);
unsigned inside_cost = 0, prologue_cost = 0;
+ /* For costing some adjacent vector stores, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_stores = 0;
for (j = 0; j < ncopies; j++)
{
gimple *new_stmt;
if (costing_p)
{
- for (i = 0; i < vec_num; i++)
- vect_get_store_cost (vinfo, stmt_info, 1,
- alignment_support_scheme, misalignment,
- &inside_cost, cost_vec);
+ n_adjacent_stores += vec_num;
continue;
}
STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_stmt);
}
- if (costing_p && dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_store_cost: inside_cost = %d, "
- "prologue_cost = %d .\n",
- inside_cost, prologue_cost);
+ if (costing_p)
+ {
+ if (n_adjacent_stores > 0)
+ vect_get_store_cost (vinfo, stmt_info, n_adjacent_stores,
+ alignment_support_scheme, misalignment,
+ &inside_cost, cost_vec);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_store_cost: inside_cost = %d, "
+ "prologue_cost = %d .\n",
+ inside_cost, prologue_cost);
+ }
return true;
}
|| memory_access_type == VMAT_CONTIGUOUS_REVERSE);
unsigned inside_cost = 0, prologue_cost = 0;
+ /* For costing some adjacent vector stores, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_stores = 0;
auto_vec<tree> result_chain (group_size);
auto_vec<tree, 1> vec_oprnds;
for (j = 0; j < ncopies; j++)
if (costing_p)
{
- vect_get_store_cost (vinfo, stmt_info, 1,
- alignment_support_scheme, misalignment,
- &inside_cost, cost_vec);
+ n_adjacent_stores++;
if (!slp)
{
if (costing_p)
{
+ if (n_adjacent_stores > 0)
+ vect_get_store_cost (vinfo, stmt_info, n_adjacent_stores,
+ alignment_support_scheme, misalignment,
+ &inside_cost, cost_vec);
+
/* When vectorizing a store into the function result assign
a penalty if the function returns in a multi-register location.
In this case we assume we'll end up with having to spill the
unsigned HOST_WIDE_INT
elsz = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (vectype)));
unsigned int n_groups = 0;
+ /* For costing some adjacent vector loads, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_loads = 0;
for (j = 0; j < ncopies; j++)
{
if (nloads > 1 && !costing_p)
avoid ICE, see PR110776. */
if (VECTOR_TYPE_P (ltype)
&& memory_access_type != VMAT_ELEMENTWISE)
- vect_get_load_cost (vinfo, stmt_info, 1,
- alignment_support_scheme, misalignment,
- false, &inside_cost, nullptr, cost_vec,
- cost_vec, true);
+ n_adjacent_loads++;
else
inside_cost += record_stmt_cost (cost_vec, 1, scalar_load,
stmt_info, 0, vect_body);
false, &n_perms);
}
- if (costing_p && dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: inside_cost = %u, "
- "prologue_cost = 0 .\n",
- inside_cost);
+ if (costing_p)
+ {
+ if (n_adjacent_loads > 0)
+ vect_get_load_cost (vinfo, stmt_info, n_adjacent_loads,
+ alignment_support_scheme, misalignment, false,
+ &inside_cost, nullptr, cost_vec, cost_vec,
+ true);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_load_cost: inside_cost = %u, "
+ "prologue_cost = 0 .\n",
+ inside_cost);
+ }
return true;
}
gcc_assert (grouped_load && !slp);
unsigned int inside_cost = 0, prologue_cost = 0;
+ /* For costing some adjacent vector loads, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_loads = 0;
for (j = 0; j < ncopies; j++)
{
if (costing_p)
true);
}
}
- vect_get_load_cost (vinfo, stmt_info, 1, alignment_support_scheme,
- misalignment, false, &inside_cost,
- &prologue_cost, cost_vec, cost_vec, true);
+ n_adjacent_loads++;
continue;
}
*vec_stmt = STMT_VINFO_VEC_STMTS (stmt_info)[0];
}
- if (costing_p && dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: inside_cost = %u, "
- "prologue_cost = %u .\n",
- inside_cost, prologue_cost);
+ if (costing_p)
+ {
+ if (n_adjacent_loads > 0)
+ vect_get_load_cost (vinfo, stmt_info, n_adjacent_loads,
+ alignment_support_scheme, misalignment, false,
+ &inside_cost, &prologue_cost, cost_vec,
+ cost_vec, true);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_load_cost: inside_cost = %u, "
+ "prologue_cost = %u .\n",
+ inside_cost, prologue_cost);
+ }
return true;
}
poly_uint64 group_elt = 0;
unsigned int inside_cost = 0, prologue_cost = 0;
+ /* For costing some adjacent vector loads, we'd like to cost with
+ the total number of them once instead of cost each one by one. */
+ unsigned int n_adjacent_loads = 0;
for (j = 0; j < ncopies; j++)
{
/* 1. Create the vector or array pointer update chain. */
|| memory_access_type == VMAT_CONTIGUOUS_REVERSE
|| (memory_access_type == VMAT_CONTIGUOUS_PERMUTE
&& (!grouped_load || first_stmt_info_p)))
- vect_get_load_cost (vinfo, stmt_info, 1,
- alignment_support_scheme, misalignment,
- add_realign_cost, &inside_cost,
- &prologue_cost, cost_vec, cost_vec, true);
+ {
+ /* Leave realign cases alone to keep them simple. */
+ if (alignment_support_scheme == dr_explicit_realign_optimized
+ || alignment_support_scheme == dr_explicit_realign)
+ vect_get_load_cost (vinfo, stmt_info, 1,
+ alignment_support_scheme, misalignment,
+ add_realign_cost, &inside_cost,
+ &prologue_cost, cost_vec, cost_vec,
+ true);
+ else
+ n_adjacent_loads++;
+ }
}
else
{
gcc_assert (memory_access_type == VMAT_CONTIGUOUS
|| memory_access_type == VMAT_CONTIGUOUS_REVERSE
|| memory_access_type == VMAT_CONTIGUOUS_PERMUTE);
+ if (n_adjacent_loads > 0)
+ vect_get_load_cost (vinfo, stmt_info, n_adjacent_loads,
+ alignment_support_scheme, misalignment, false,
+ &inside_cost, &prologue_cost, cost_vec, cost_vec,
+ true);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_load_cost: inside_cost = %u, "